Could I suggest to add this in the default .h files?:
#define d2i_PrivateKey_bio(bp,x) (EVP_PKEY *)ASN1_d2i_bio(\
(char *(*)())EVP_PKEY_new, (char *(*)())d2i_PrivateKey, bp, \
(unsigned char **)x)
I wanted to be able to save my private keys in DER format, and read them
later... I didn't find the macro/function to do it... Unfortunately, my
definition doesn't handle encrypted keys...
On Fri, 10 Dec 1999, Dr Stephen Henson wrote:
> 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.
>
--
Erwann ABALEA
System and Development Engineer - Certplus SA
[EMAIL PROTECTED]
- RSA PGP Key ID: 0x2D0EABD5 -
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]