[#PKCS12_create]
= PKCS12&lowbar;create
:mrdocs:

Create a PKCS&num;12 structure from a key, certificate, and optional CA stack (default library context)&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:PKCS12.adoc[PKCS12]*
PKCS12&lowbar;create(
    char const* pass,
    char const* name,
    xref:EVP_PKEY.adoc[EVP&lowbar;PKEY]* pkey,
    xref:X509.adoc[X509]* cert,
    xref:stack_st_X509.adoc[stack&lowbar;st&lowbar;X509]* ca,
    int nid&lowbar;key,
    int nid&lowbar;cert,
    int iter,
    int mac&lowbar;iter,
    int keytype);
----

== Return Value

New PKCS&num;12 structure, or NULL on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *pass*
| Passphrase for encryption and MAC&period;
| *name*
| Friendly name for the key and certificate&period;
| *pkey*
| Private key to include, or NULL&period;
| *cert*
| Entity certificate to include, or NULL&period;
| *ca*
| Optional additional certificates, or NULL&period;
| *nid&lowbar;key*
| PBE NID for key encryption, or 0&sol;&hyphen;1 for defaults&sol;no encryption&period;
| *nid&lowbar;cert*
| PBE NID for certificate encryption, or 0&sol;&hyphen;1 for defaults&sol;no encryption&period;
| *iter*
| Encryption iteration count, or 0 for default&period;
| *mac&lowbar;iter*
| MAC iteration count, or 0&sol;&hyphen;1 for default&sol;omit MAC&period;
| *keytype*
| MS key&hyphen;usage flag (KEY&lowbar;SIG or KEY&lowbar;EX), or 0 to omit&period;
|===


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