Getting public key out of an X509 object

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting public key out of an X509 object

Edward Chan
Getting public key out of an X509 object

Can someone point me to how I can get the public key out of an X509 object?  Basically, what I am trying to achieve is to sign something using the EVP interface and either a DSA or RSA private key, where the associated public key is in the cert.  So now I want to get the public key out of the cert to verify the signature, again using the EVP interface.  Am I going about this the right way?  Or is there another set of API's that I should use that deal directly with the X509* instead?

Thanks,
Ed

Reply | Threaded
Open this post in threaded view
|

Re: Getting public key out of an X509 object

Dr. Stephen Henson
On Sat, Jul 23, 2005, Edward Chan wrote:

> Can someone point me to how I can get the public key out of an X509
> object?  Basically, what I am trying to achieve is to sign something
> using the EVP interface and either a DSA or RSA private key, where the
> associated public key is in the cert.  So now I want to get the public
> key out of the cert to verify the signature, again using the EVP
> interface.  Am I going about this the right way?  Or is there another
> set of API's that I should use that deal directly with the X509*
> instead?
>

X509_get_pubkey().

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: Getting public key out of an X509 object

Edward Chan
In reply to this post by Edward Chan
RE: Getting public key out of an X509 object

Before anybody blasts me, I just noticed a previous post on this subject :)

EVP_PKEY *509_get_pubkey(cert)

Looks like it will work.  I'll try that.  But my second question holds, is this the right way to do the sig verification, or is there another or better way?

    _____________________________________________
    From:   Edward Chan 
    Sent:   Saturday, July 23, 2005 10:25 AM
    To:     '[hidden email]'
    Subject:        Getting public key out of an X509 object

    Can someone point me to how I can get the public key out of an X509 object?  Basically, what I am trying to achieve is to sign something using the EVP interface and either a DSA or RSA private key, where the associated public key is in the cert.  So now I want to get the public key out of the cert to verify the signature, again using the EVP interface.  Am I going about this the right way?  Or is there another set of API's that I should use that deal directly with the X509* instead?

    Thanks,
    Ed