help for using Python rsa
mhr1224 at gmail.com
mhr1224 at gmail.com
Sat Feb 7 00:14:35 EST 2015
I use this code to create public and private keys:
import rsa
(pubkey, privkey) = rsa.newkeys(512)
And then convert it to PEM format:
exppub =pubkey.save_pkcs1(format='PEM')
exppriv = privkey.save_pkcs1(format='PEM')
When i encrypt massage with this keys:
message = 'hello Bob!'
crypto = rsa.encrypt(message, pubkey)
encrypted massage is like this:
"@\xc4\xb2\x14r\xf1x\xb8\xb2\t;\x9a:\x1dl\x11\xe2\x10\xa9E\xee\x8b\xac\xd0\xd3Y\xfb}\xd9@\xdd\x0c\xa5\xd2\xfc1\xd6\x06\xf0\xb8\x944\xe1\xc2r\xe5anyq\xac\xdfh\xeb\x10\x80\x98\xa1\xee'\xe6hpi"
and i know it should be like this:
SEcPB1mYNrfeE4zP4RI3z2K4Rh9HDNfPhuF28IyxHFjEOJ9Z+1zdIwPF0jsJGQDJyKpAju7dcYueHHXXeH8d+w==
How can i change the format of this?
More information about the Python-list
mailing list