[#PEM_ASN1_read]
= PEM&lowbar;ASN1&lowbar;read
:mrdocs:

Read a named PEM object from a FILE and decode it with `d2i&period;`

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void*
PEM&lowbar;ASN1&lowbar;read(
    xref:d2i_of_void.adoc[d2i&lowbar;of&lowbar;void]* d2i,
    char const* name,
    FILE* fp,
    void** x,
    xref:pem_password_cb.adoc[pem&lowbar;password&lowbar;cb]* cb,
    void* u);
----

== Return Value

Decoded object on success, or NULL on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *d2i*
| ASN&period;1 decode callback for the expected type&period;
| *name*
| PEM type label expected on the BEGIN line (e&period;g&period; &quot;CERTIFICATE&quot;)&period;
| *fp*
| FILE to read from&period;
| *x*
| Optional address of an object pointer to reuse, or NULL&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]#
