[#PEM_ASN1_write_bio]
= PEM&lowbar;ASN1&lowbar;write&lowbar;bio
:mrdocs:

Encode an ASN&period;1 object with `i2d` and write it as a PEM block to a BIO&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
PEM&lowbar;ASN1&lowbar;write&lowbar;bio(
    xref:i2d_of_void.adoc[i2d&lowbar;of&lowbar;void]* i2d,
    char const* name,
    xref:BIO.adoc[BIO]* bp,
    void const* x,
    xref:EVP_CIPHER-07.adoc[EVP&lowbar;CIPHER] const* enc,
    unsigned char const* kstr,
    int klen,
    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
| *i2d*
| Encoder such as i2d&lowbar;X509&period;
| *name*
| PEM type label written after &quot;&hyphen;&hyphen;&hyphen;&hyphen;&hyphen;BEGIN &quot;&period;
| *bp*
| BIO that receives the PEM text&period;
| *x*
| Object passed to `i2d&period;`
| *enc*
| Optional cipher for encrypting the PEM, or NULL for cleartext&period;
| *kstr*
| Optional encryption key bytes when `enc` is non&hyphen;NULL, or NULL to use `cb&period;`
| *klen*
| Length of `kstr` in bytes&period;
| *cb*
| Password callback used when `enc` is set and `kstr` is NULL, or NULL&period;
| *u*
| Application data passed to `cb&period;`
|===


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