Re: m2crypto basic question
Ng Pheng Siong <[email protected]>
| Newsgroups | gmane.comp.python.cryptography |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Dec 08, 2004 at 04:18:01PM -0800, Monte Goode wrote: > but when i call X509.get_pubkey() - i can not figure out what to do with > the pointer that is returned. this is the point at which i get stuck. > so: is there a way to take the return value of X509.get_pubkey() and get > it into some sort of RSA_pub-like object so i can examine it's contents? X509.get_pubkey calls get_pubkey() in SWIG/_x509.i and returns an EVP_PKEY*. OpenSSL has function EVP_PKEY_get1_RSA which returns an RSA* from the EVP_PKEY*. This function isn't available in M2Crypto. Its wrapper should go into M2Crypt.EVP.PKey which has method assign_rsa - "Assign the RSA key pair to self". This method you want should be called, say, extract_rsa (and analogously extract_rsa_pub) - "Extract self's RSA keypair (pubkey) into an RSA.RSA (RSA.RSA_pub) instance". I thank you in advance for your patches. ;-) > or is there a simpler way using the api to verify that the certifiate > matches my keypair? Dunno, by trying to use the certificate together with the key pair? I can't estimate the programming effort off hand. HTH. Cheers. -- Ng Pheng Siong <[email protected]> http://sandbox.rulemaker.net/ngps -+- M2Crypto, ZServerSSL for Zope, Blog http://www.sqlcrypt.com -+- Database Engine with Transparent AES Encryption