PEM_write_PKCS8PrivateKey_nid

Write a private key as PEM PKCS#8 using a PKCS#5 v1.5 / PKCS#12 PBE NID.

Synopsis

Declared in <openssl/pem.h>

int
PEM_write_PKCS8PrivateKey_nid(
    FILE* fp,
    EVP_PKEY const* x,
    int nid,
    char const* kstr,
    int klen,
    pem_password_cb* cb,
    void* u);

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
fpFILE to write to.
xPrivate key to encode.
nidNID of the PBE algorithm OBJECT IDENTIFIER.
kstrOptional passphrase; if NULL, cb is used when encryption requires one.
klenLength of kstr when provided.
cbPassword callback when a passphrase is needed, or NULL.
uApplication data passed to cb.