[PYTHON-CRYPTO] m2crypto basic question

Monte Goode MMGoode at LBL.GOV
Thu Dec 9 01:18:01 CET 2004


greetings all,

i had a question about the m2crypto library.  i'm rather new to this
sort of thing, so if this question is overly obvious, i do apologize.

i'm using the m2crypto library to generate a keypair, then generate a
x509 request using said keypair.  then i send my request off to a CA
which then issues a certificate based on my request.

all of this works and using the m2crypto lib for this is great.

however my trouble begins when i recieve my certificate.  i would like
to verify that the public key in the certificate matches the one in my
keypair.  (i've used the openssl command-line tool to verify that they
do, in fact, match).

i have no problem opening up the key pair, isolating the public key and
looking at the pem format of it using m2crypto.  however, my adventures
with the certificate has not been as smooth.

i load the certificate up in and X509 object w/out any trouble.  and by
using the various get_* methods verify that it is successful.

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?
  or is there a simpler way using the api to verify that the certifiate
matches my keypair?

any insight very appreciated.

cheers all,

monte





More information about the python-crypto mailing list