problem in encryption

jayshree jayshree06comp at
Tue Sep 22 10:44:03 CEST 2009

hello ,
The community members,

Using following code  :

fileHandle = open ('','wb')
#fileHandle = open ('jay1key.pem',rb).read()
print fileHandle.write (data) #data variable is contains the key

otp = 'jyshri69'

pub_key = M2Crypto.RSA.load_pub_key('')

encrypted = pub_key.public_encrypt(otp, M2Crypto.RSA.pkcs1_padding)
print "encrypted text is =   "
print "-----------------------"
print encrypted

the above code gives me following error :
Traceback (most recent call last):
  File "", line 71, in ?
    pub_key = M2Crypto.RSA.load_pub_key('')
  File "/usr/lib/python2.4/site-packages/M2Crypto/", line 344,
in load_pub_key
    return load_pub_key_bio(bio)
  File "/usr/lib/python2.4/site-packages/M2Crypto/", line 360,
in load_pub_key_bio
  File "/usr/lib/python2.4/site-packages/M2Crypto/", line 240,
in rsa_error
    raise RSAError, m2.err_reason_error_string(m2.err_get_error())
M2Crypto.RSA.RSAError: no start line

not getting how to resolve it ?

More information about the Python-list mailing list