Created
October 19, 2013 18:46
-
-
Save glynrob/7059847 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rsa = RSA.load_pub_key("mykey.pub") | |
ctxt = rsa.public_encrypt(secretstring, RSA.pkcs1_padding) | |
encryptedText = ctxt.encode('base64') | |
print 'Encrypted Text = '+encryptedText | |
priv = RSA.load_key("mykey.pem") | |
decodeEncryptedText = encryptedText.decode('base64') | |
decryptedText = priv.private_decrypt(decodeEncryptedText, RSA.pkcs1_padding) | |
print 'Decrypted Text = '+decryptedText |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment