Accessing RSA private key

Mads Kiilerich <[email protected]> Thu, 5 Jun 2008 22:20:54 +0200
Newsgroups gmane.comp.python.cryptography
Message-ID <[email protected]>
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
smime.p7s (application/x-pkcs7-signature, 3.4 KB) - not displayed