[PYTHON-CRYPTO] Accessing RSA private key

Mads Kiilerich mads at KIILERICH.COM
Thu Jun 5 22:20:54 CEST 2008


Hi,

I would like to be able to get the private key of an RSA key. A 
milestone could be to be able to implement "openssl rsa -text -in 
a-key.pem -noout" in python. (Existing C implementation can be found in 
openssl-0.9.8g/crypto/asn1/t_pkey.c : RSA_print)

The public e and n is easily accessed on an m2crypto RSA key instance, 
but I can't find any way to access the private part?

In m2crypto implementation I see references to rsa->e and rsa->n, but 
not any to for example rsa->d.

Is there any way to get the private key through m2crypto? Or if I add 
ctypes to the soup?

If not: Is it intentional or just a coincidence that SWIG/_rsa.i 
apparently doesn't implement any getters for the private parts?

/Mads
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3435 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-crypto/attachments/20080605/1952062d/attachment.bin>


More information about the python-crypto mailing list