Package M2Crypto :: Module EC :: Class EC
[frames] | no frames]

Class EC




Object interface to a EC key pair.

Instance Methods
 
m2_ec_key_free(...)
 
__init__(self, ec, _pyfree=0)
 
__del__(self)
 
__len__(self)
 
gen_key(self)
Generates the key pair from its parameters.
 
pub(self)
 
sign_dsa(self, digest)
Sign the given digest using ECDSA.
 
verify_dsa(self, digest, r, s)
Verify the given digest using ECDSA.
 
sign_dsa_asn1(self, digest)
 
verify_dsa_asn1(self, digest, blob)
 
compute_dh_key(self, pub_key)
Compute the ECDH shared key of this key pair and the given public key object.
 
save_key_bio(self, bio, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x83b2a04>)
Save the key pair to an M2Crypto.BIO.BIO object in PEM format.
 
save_key(self, file, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x83b2a04>)
Save the key pair to a file in PEM format.
 
save_pub_key_bio(self, bio)
Save the public key to an M2Crypto.BIO.BIO object in PEM format.
 
save_pub_key(self, file)
Save the public key to a file in PEM format.
 
check_key(self)
Method Details

gen_key(self)

 

Generates the key pair from its parameters. Use:

   keypair = EC.gen_params(curve)
   keypair.gen_key()

to create an EC key pair.

sign_dsa(self, digest)

 

Sign the given digest using ECDSA. Returns a tuple (r,s), the two ECDSA signature parameters.

verify_dsa(self, digest, r, s)

 

Verify the given digest using ECDSA. r and s are the ECDSA signature parameters.

compute_dh_key(self, pub_key)

 

Compute the ECDH shared key of this key pair and the given public key object. They must both use the same curve. Returns the shared key in binary as a buffer object. No Key Derivation Function is applied.

save_key_bio(self, bio, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x83b2a04>)

 

Save the key pair to an M2Crypto.BIO.BIO object in PEM format.

Parameters:
  • bio (M2Crypto.BIO.BIO) - M2Crypto.BIO.BIO object to save key to.
  • cipher (string) - Symmetric cipher to protect the key. The default cipher is 'aes_128_cbc'. If cipher is None, then the key is saved in the clear.
  • callback (Python callable) - A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.

save_key(self, file, cipher='aes_128_cbc', callback=<function passphrase_callback at 0x83b2a04>)

 

Save the key pair to a file in PEM format.

Parameters:
  • file (string) - Name of file to save key to.
  • cipher (string) - Symmetric cipher to protect the key. The default cipher is 'aes_128_cbc'. If cipher is None, then the key is saved in the clear.
  • callback (Python callable) - A Python callable object that is invoked to acquire a passphrase with which to protect the key. The default is util.passphrase_callback.

save_pub_key_bio(self, bio)

 

Save the public key to an M2Crypto.BIO.BIO object in PEM format.

Parameters:
  • bio (M2Crypto.BIO.BIO) - M2Crypto.BIO.BIO object to save key to.

save_pub_key(self, file)

 

Save the public key to a file in PEM format.

Parameters:
  • file (string) - Name of file to save key to.