Pycrypto RSA Issue

Jordan Apgar twistedphrame at
Tue Feb 9 19:09:53 CET 2010

I am trying to encrypt public data along with another tuple and then
decrypt it after sending. RSA is needed for negotiation of keys for
AES. But I just get garbage after I decrypt it. This is what I'm
attempting to do:

from Crypto.PublicKey import RSA
from Crypto import Random

gkey = RSA.generate(384,
string = str((gkey.publickey().__getstate__(),
print string
data = gkey.encrypt(string,"")
print "data:",data
print "decrypt"
print "decrypt,", gkey.decrypt(data)
print "done"

All I get are junk values when printing the decrypted value.

More information about the Python-list mailing list