[#PKCS8_pkey_set0]
= PKCS8&lowbar;pkey&lowbar;set0
:mrdocs:

Set the algorithm, version, parameters, and encoded private key on a PKCS&num;8 PrivateKeyInfo&period;

== Synopsis

Declared in `&lt;openssl&sol;x509&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
PKCS8&lowbar;pkey&lowbar;set0(
    xref:PKCS8_PRIV_KEY_INFO.adoc[PKCS8&lowbar;PRIV&lowbar;KEY&lowbar;INFO]* priv,
    xref:ASN1_OBJECT.adoc[ASN1&lowbar;OBJECT]* aobj,
    int version,
    int ptype,
    void* pval,
    unsigned char* penc,
    int penclen);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *priv*
| PKCS&num;8 structure to update&period;
| *aobj*
| Algorithm OID to assign (ownership transferred as implemented)&period;
| *version*
| PKCS&num;8 version field value&period;
| *ptype*
| ASN&period;1 type of `pval` (V&lowbar;ASN1&lowbar;&ast;)&period;
| *pval*
| Algorithm parameters value matching `ptype,` or NULL&period;
| *penc*
| Encoded private&hyphen;key octets&semi; ownership transferred on success&period;
| *penclen*
| Length of `penc` in bytes&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
