On Wed, Nov 12, 2003, Geoffrey Huang wrote: > Hi there, > > I'm new to using OpenSSL. I've gathered that the EVP* structures are the > high-level structures that OpenSSL prefers me to use. Specifically, I'm > using the EVP_PKEY structure to store key pairs in an internal database - > it's flexible enough to store RSA and DSA keys. > > Anyhoo, so here's what I'm trying to do. Given a certificate presented to > me (possibly over the network, possibly in a file), I want to store the > public key in an EVP_PKEY structure. > > Any suggestions for the best way to do this? I'm trying to call > d2i_X509_PKEY() on the raw cert. This should give me an X509_PKEY > structure. Now, how to get the public key and go back to EVP_PKEY? >
First this should be in openssl-users not openssl-dev. You can use the function X509_get_pubkey() to get an EVP_PKEY structure from an X509 object, that will contain the public key. >From there you can use the PUBKEY functions such as i2d_PUBKEY() and so on. 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://drh-consultancy.demon.co.uk ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]