Easy to use wrapper around cryptographic libraries for Python.
from ezcrypto.pki.rsa import PrivateKey
private_key = PrivateKey.generate()
private_key = PrivateKey.load_from_pem_file('/path/to/priv.pem')
public_key = private_key.get_public_key()
public_key = PublicKey.load_from_pem_file('/path/to/pub.pem')
my_key.export_as_pem()
private_key = PrivateKey(pem)
data = my_key.encrypt_as_base64(data)
data = my_key.decrypt_from_base64(data)
signature = private_key.sign(message)
private_key.verify(message, signature)
signature = private_key.sign_after_hashing(message)
private_key.verify_after_hashing(message, signature)
NOTES:
- EZCrypto uses PyCrypto for all cryptographic operations.
- Hashing is made using the SHA1 function from Python's hashlib standard module.
(c) 2012-2013 - Antonio Ognio [email protected]