RSA in python

Abhisek Datta abhisek.datta at gmail.com
Fri Feb 17 09:49:52 EST 2006


Hello,

I am looking for good RSA implementations in python that can import a
public key in PEM format and encrypt a buffer using the imported
public key. I tried m2crypto, but somehow it is giving me exceptions
which I couldnt solve as of now.

I get the following with m2crypto:
rsa = M2Crypto.RSA.load_pub_key("pubkey.pem")
gives me:
  File "KB_Client.py", line 63, in SessionInit
    rsa = M2Crypto.RSA.load_pub_key("pubkey.pem")
  File "/usr/lib/python2.4/site-packages/M2Crypto/RSA.py", line 225,
in load_pub_key
    return load_pub_key_bio(bio)
  File "/usr/lib/python2.4/site-packages/M2Crypto/RSA.py", line 237,
in load_pub_key_bio
    rsa_error()
  File "/usr/lib/python2.4/site-packages/M2Crypto/RSA.py", line 162,
in rsa_error
    raise RSAError, m2.err_reason_error_string(m2.err_get_error())
M2Crypto.RSA.RSAError: no start line


Any help will be highly appreciated.

Regards,
-abhisek



More information about the Python-list mailing list