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

Name

Description

pbags

Address of safeBag stack pointer (created if *`pbags` is NULL).

key

Private key to add.

key_usage

MS key‐usage flag (KEY_SIG or KEY_EX), or 0 to omit.

iter

Iteration count for key encryption, or 0 for default.

key_nid

PBE NID for key encryption, or ‐1 for an unencrypted keyBag.

pass

Passphrase when key_nid selects encryption, or NULL otherwise.

Created with MrDocs