[#PKCS12_add_safe]
= PKCS12&lowbar;add&lowbar;safe
:mrdocs:

Pack safeBags into a PKCS&num;7 contentInfo and append it to a stack of safes&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
PKCS12&lowbar;add&lowbar;safe(
    stack&lowbar;st&lowbar;PKCS7** psafes,
    stack&lowbar;st&lowbar;PKCS12&lowbar;SAFEBAG* bags,
    int safe&lowbar;nid,
    int iter,
    char const* pass);
----

== Return Value

1 on success, 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *psafes*
| Address of PKCS&num;7 stack pointer (created if &ast;`psafes` is NULL)&period;
| *bags*
| Stack of safeBags to pack&period;
| *safe&lowbar;nid*
| &hyphen;1 for plain data, 0 for default encrypted, or a PBE NID for encrypted&period;
| *iter*
| Iteration count for encryption, or 0 for default (2048)&period;
| *pass*
| Passphrase when `safe&lowbar;nid` selects encryption, or NULL for plain data&period;
|===


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