
#use wml::openssl-macros area=docs page=d2i_PKCS8PrivateKey

<title>Documents, d2i_PKCS8PrivateKey(3)</title>

<h1>d2i_PKCS8PrivateKey(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#NOTES">NOTES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
d2i_PKCS8PrivateKey_bio, d2i_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_bio,
i2d_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_nid_bio,
i2d_PKCS8PrivateKey_nid_fp - PKCS#8 format private key functions

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/evp.h&gt;
</PRE>
<PRE> EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);
 EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);
</PRE>
<PRE> int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
                                  char *kstr, int klen,
                                  pem_password_cb *cb, void *u);
</PRE>
<PRE> int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
                                  char *kstr, int klen,
                                  pem_password_cb *cb, void *u);
</PRE>
<PRE> int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
                                  char *kstr, int klen,
                                  pem_password_cb *cb, void *u);
</PRE>
<PRE> int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
                                  char *kstr, int klen,
                                  pem_password_cb *cb, void *u);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
The PKCS#8 functions encode and decode private keys in PKCS#8 format using
both PKCS#5 v1.5 and PKCS#5 v2.0 password based encryption algorithms.

</P>
<P>
Other than the use of DER as opposed to PEM these functions are identical
to the corresponding <STRONG>PEM</STRONG> function as described in the <A HREF="../crypto/pem.html#">pem(3)</A> manual page.

</P>
<P>
<HR>
<H1><A NAME="NOTES">NOTES</A></H1>
<P>
Before using these functions <A HREF="../crypto/OpenSSL_add_all_algorithms.html#">OpenSSL_add_all_algorithms(3)</A>
should be called to initialize the internal algorithm lookup tables
otherwise errors about unknown algorithms will occur if an attempt is made
to decrypt a private key. 

</P>
<P>
These functions are currently the only way to store encrypted private keys
using DER format.

</P>
<P>
Currently all the functions use BIOs or FILE pointers, there are no
functions which work directly on memory: this can be readily worked around
by converting the buffers to memory BIOs, see <A HREF="../crypto/BIO_s_mem.html#">BIO_s_mem(3)</A> for details.

</P>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../crypto/pem.html#">pem(3)</A>



</P>
:}

