PKCS8_encrypt_ex

Encrypt a PKCS#8 private key info structure.

Synopsis

Declared in <openssl/pkcs12.h>

X509_SIG*
PKCS8_encrypt_ex(
    int pbe_nid,
    EVP_CIPHER const* cipher,
    char const* pass,
    int passlen,
    unsigned char* salt,
    int saltlen,
    int iter,
    PKCS8_PRIV_KEY_INFO* p8,
    OSSL_LIB_CTX* ctx,
    char const* propq);

Return Value

Encrypted key in an X509_SIG, or NULL on error.

Parameters

NameDescription
pbe_nidPBE algorithm NID.
cipherCipher for PBES2, or NULL when pbe_nid selects a full PBE scheme.
passPassphrase for encryption.
passlenLength of pass, or -1 to use strlen().
saltSalt for key derivation.
saltlenLength of salt in bytes.
iterIteration count for key derivation.
p8Private key info to encrypt.
ctxLibrary context for algorithm fetching, or NULL for default.
propqProperty query for algorithm fetching, or NULL.