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

Name

Description

pbe_nid

PBE algorithm NID.

cipher

Cipher for PBES2, or NULL when pbe_nid selects a full PBE scheme.

pass

Passphrase for encryption.

passlen

Length of pass, or ‐1 to use strlen().

salt

Salt for key derivation.

saltlen

Length of salt in bytes.

iter

Iteration count for key derivation.

p8

Private key info to encrypt.

ctx

Library context for algorithm fetching, or NULL for default.

propq

Property query for algorithm fetching, or NULL.

Created with MrDocs