Erwann ABALEA wrote:
> 
> I found how to do that....
> 
> pkcs8privkeyinfo=(PKCS8_PRIV_KEY_INFO *)PEM_ASN1_read_bio((char 
>*(*)())d2i_PKCS8_PRIV_KEY_INFO, PEM_STRING_PKCS8INF, in, NULL, NULL, NULL);
> pkey=EVP_PKCS82PKEY(pkcs8privkeyinfo);
> 

Thats not the best way to do it and it wont handle encrypted keys.

The standard PEM_read_bio_PrivateKey() automatically handles PKCS#8
format (encrypted and unencrypted) in OpenSSL 0.9.4 as well as the
"traditional" forms.

0.9.5 will also handle PKCS#8 with PEM_read_bio_RSAPrivateKey() and
PEM_read_bio_DSAPrivateKey().

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to