On Friday 20 June 2003 06:58, Wu Junwei wrote:
> Hi,all
>
> I have a question on reading the private key out from a certificate file.

Normally there's no private key in a certificate

> I 'd like to read a private key in a certificate file and returns the
> private key data and length in memroy, which functions in OpenSSL should I
> choose to use?
>
> d2i/i2d_PKCS8PrivateKey_xx or PEM_read_bio_PrivateKey ?
>
> Can some one kindly tell me the difference among them?

d2i_PKCS8PrivateKey decodes a DER encoded PKCS#8 private key
object and PEM_read_bio_PrivateKey reads a PEM encoded private
(a PKCS8 key or the OpenSSL internal format) from BIO. 
Which function you need to load your private depends on the format
of your key i.e. if it's PEM encoded please read the 'pem' manpage or
in general look how it's done in the OpenSSL tools in the apps/
directory.

Nils

PS: Please don't post the same mail to openssl-dev *and*
      openssl-users. One mailing list is sufficient (in this case
      openssl-users).


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

Reply via email to