PEM_ASN1_write

Encode an ASN.1 object with i2d and write it as PEM to a FILE.

Synopsis

Declared in <openssl/pem.h>

int
PEM_ASN1_write(
    i2d_of_void* i2d,
    char const* name,
    FILE* fp,
    void const* x,
    EVP_CIPHER const* enc,
    unsigned char const* kstr,
    int klen,
    pem_password_cb* callback,
    void* u);

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
i2dASN.1 encode callback for the object type.
namePEM type label used on the BEGIN/END lines.
fpFILE to write to.
xObject to encode.
encOptional cipher for traditional PEM encryption, or NULL.
kstrOptional key material for enc, or NULL to prompt via callback.
klenLength of kstr in bytes.
callbackPassword callback when encrypting without kstr, or NULL.
uApplication data passed to callback.