[#PEM_bytes_read_bio_secmem]
= PEM&lowbar;bytes&lowbar;read&lowbar;bio&lowbar;secmem
:mrdocs:

Read a named PEM object from a BIO into secure memory, decrypting if needed&period;

== Synopsis

Declared in `&lt;openssl&sol;pem&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
PEM&lowbar;bytes&lowbar;read&lowbar;bio&lowbar;secmem(
    unsigned char** pdata,
    long* plen,
    char** pnm,
    char const* name,
    xref:BIO.adoc[BIO]* bp,
    xref:pem_password_cb.adoc[pem&lowbar;password&lowbar;cb]* cb,
    void* u);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *pdata*
| Receives newly allocated DER payload in secure memory (caller frees with OPENSSL&lowbar;secure&lowbar;free)&period;
| *plen*
| Receives the length of &ast;`pdata` in bytes&period;
| *pnm*
| Optional&semi; receives the actual PEM type name from the BEGIN line (caller frees)&period;
| *name*
| Expected PEM type label (for example &quot;CERTIFICATE&quot;)&semi; non&hyphen;matching types are skipped&period;
| *bp*
| BIO to read from&period;
| *cb*
| Password callback for encrypted PEM, or NULL&period;
| *u*
| Application data passed to `cb&period;`
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
