PEM_bytes_read_bio

Read a named PEM object from a BIO, decrypting if needed, and return its DER bytes.

Synopsis

Declared in <openssl/pem.h>

int
PEM_bytes_read_bio(
    unsigned char** pdata,
    long* plen,
    char** pnm,
    char const* name,
    BIO* bp,
    pem_password_cb* cb,
    void* u);

Return Value

1 on success, or 0 on failure.

Parameters

NameDescription
pdataReceives newly allocated DER payload (caller frees with OPENSSL_free).
plenReceives the length of *pdata in bytes.
pnmOptional; receives the actual PEM type name from the BEGIN line (caller frees).
nameExpected PEM type label (for example "CERTIFICATE"); non-matching types are skipped.
bpBIO to read from.
cbPassword callback for encrypted PEM, or NULL.
uApplication data passed to cb.