PKCS12_add_key

Create a key safeBag and append it to a stack of safeBags.

Synopsis

Declared in <openssl/pkcs12.h>

PKCS12_SAFEBAG*
PKCS12_add_key(
    stack_st_PKCS12_SAFEBAG** pbags,
    EVP_PKEY* key,
    int key_usage,
    int iter,
    int key_nid,
    char const* pass);

Return Value

The new safeBag, or NULL on error.

Parameters

NameDescription
pbagsAddress of safeBag stack pointer (created if *pbags is NULL).
keyPrivate key to add.
key_usageMS key-usage flag (KEY_SIG or KEY_EX), or 0 to omit.
iterIteration count for key encryption, or 0 for default.
key_nidPBE NID for key encryption, or -1 for an unencrypted keyBag.
passPassphrase when key_nid selects encryption, or NULL otherwise.