problem in encryption
Piet van Oostrum
piet at cs.uu.nl
Tue Sep 22 09:27:55 EDT 2009
>>>>> jayshree <jayshree06comp at gmail.com> (j) wrote:
>j> hello ,
>j> The community members,
>j> Using following code :
>j> fileHandle = open ('jay1key.py','wb')
>j> #fileHandle = open ('jay1key.pem',rb).read()
>j> print fileHandle.write (data) #data variable is contains the key
>j> fileHandle.close()
>j> otp = 'jyshri69'
>j> pub_key = M2Crypto.RSA.load_pub_key('jay1key.py')
[Why do you give your key file a .py extension? .pem would be better.]
Your key in the next posting (when the broken lines are reconstructed)
seems to be in PKCS1 format. That's what -----BEGIN RSA PUBLIC KEY-----
indicates. However, M2Crypto.RSA.load_pub_key expects the key in X.509
format, which starts with -----BEGIN PUBLIC KEY----- and also has a
different format inside, so just changing the header and trailer won't
work.
Anyway, I doubt that the key is correct as it seems to large for just a
public key. How was that key generated?
--
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
More information about the Python-list
mailing list