-
Notifications
You must be signed in to change notification settings - Fork 5
leifj/rsa_x509_pem
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
rsa_x509_pem Handle OpenSSL PEM RSA keys and x509 certificates in native Python. © 2011 Andrew D. Yates [email protected] https://[email protected]/andrewdyates/rsa_x509_pem.git https://github.com/andrewdyates See test.py for unit tests and additional sample usage. ======== SAMPLE USE: # Read "private_rsa_key.pem", make private RSA key, sign something, verify >>> data = open("private_rsa_key.pem").read() ... key_dict = parse(data) ... key = get_key(key_dict) ... signature = key.sign("Hello.", None) ... assert key.verify("Hello.", signature) # Read "rsa_cert.pem", make public RSA key, verify some signature, print >>> data = open("rsa_cert.pem").read() ... cert_dict = parse(data) ... key = get_key(cert_dict) ... assert key.verify("Hello.", my_signature) ... print cert_dict["subject"] ... print cert_dict["body"] # Return "nice" public and private key functions from a key object >>> f_my_public = f_public(key) ... f_my_private = f_private(key) ... msg = "hello" ... assert msg == f_my_public(f_my_public(msg)) ... assert msg == f_my_private(f_my_public(msg)) RUN UNIT TESTS: $ python test.py ======== Sources: RSA implementation: PyCrypto http://www.dlitz.net/software/pycrypto/ PEM implementation: PyASN1 http://pyasn1.sourceforge.net/
About
Handle OpenSSL PEM RSA keys and x509 certificates in native Python.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published