Package M2Crypto :: Module DSA :: Class DSA_pub
[frames] | no frames]

Class DSA_pub




This class is a DSA context that only supports a public key and verification. It does NOT support a private key or signing.

Instance Methods
tuple
sign(self, *argv)
Sign the digest.
tuple
sign_asn1(self, *argv)
Sign the digest.
int
check_key(self)
Check to be sure the DSA object has a valid private key.
 
save_key(self, filename)
Save the DSA public key (with parameters) to a file.
 
save_key_bio(self, bio)
Save DSA public key (with parameters) to a BIO object.

Inherited from DSA: __del__, __getattr__, __init__, __len__, __setattr__, gen_key, m2_dsa_free, save_params, save_params_bio, save_pub_key, save_pub_key_bio, set_params, verify, verify_asn1

Method Details

sign(self, *argv)

 

Sign the digest.

Parameters:
  • digest - SHA-1 hash of message (same as output from MessageDigest, a "byte string")
Returns: tuple
DSA signature, a tuple of two values, r and s, both "byte strings".
Overrides: DSA.sign
(inherited documentation)

sign_asn1(self, *argv)

 

Sign the digest.

Parameters:
  • digest - SHA-1 hash of message (same as output from MessageDigest, a "byte string")
Returns: tuple
DSA signature, a tuple of two values, r and s, both "byte strings".
Overrides: DSA.sign_asn1

check_key(self)

 

Check to be sure the DSA object has a valid private key.

Returns: int
1 (true) if a valid private key
Overrides: DSA.check_key
(inherited documentation)

save_key(self, filename)

 

Save the DSA public key (with parameters) to a file.

Parameters:
  • filename (str) - Save DSA public key (with parameters) to this file.
Returns:
1 (true) if successful
Overrides: DSA.save_key

save_key_bio(self, bio)

 

Save DSA public key (with parameters) to a BIO object.

Parameters:
  • bio (M2Crypto.BIO object) - Save DSA public key (with parameters) to this object.
Returns:
1 (true) if successful
Overrides: DSA.save_key_bio