[#SMIME_write_ASN1_ex]
= SMIME&lowbar;write&lowbar;ASN1&lowbar;ex
:mrdocs:

Write an ASN&period;1 CMS&sol;PKCS&num;7 value as an S&sol;MIME message with library context&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
SMIME&lowbar;write&lowbar;ASN1&lowbar;ex(
    xref:BIO.adoc[BIO]* bio,
    xref:ASN1_VALUE.adoc[ASN1&lowbar;VALUE]* val,
    xref:BIO.adoc[BIO]* data,
    int flags,
    int ctype&lowbar;nid,
    int econt&lowbar;nid,
    stack&lowbar;st&lowbar;X509&lowbar;ALGOR* mdalgs,
    xref:ASN1_ITEM.adoc[ASN1&lowbar;ITEM] const* it,
    xref:OSSL_LIB_CTX.adoc[OSSL&lowbar;LIB&lowbar;CTX]* libctx,
    char const* propq);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *bio*
| BIO that receives the S&sol;MIME output&period;
| *val*
| CMS&lowbar;ContentInfo or PKCS7 value to wrap (not const because streaming may update state)&period;
| *data*
| Optional content BIO when streaming &sol; detached content is used, or NULL&period;
| *flags*
| CMS&lowbar;&ast; &sol; SMIME&lowbar;&ast; flags (for example CMS&lowbar;DETACHED, CMS&lowbar;TEXT, CMS&lowbar;STREAM)&period;
| *ctype&lowbar;nid*
| NID of the content type&period;
| *econt&lowbar;nid*
| NID of the embedded content type&period;
| *mdalgs*
| Digest algorithms for SignedData, or NULL when unused&period;
| *it*
| Item descriptor such as ASN1&lowbar;ITEM&lowbar;rptr(CMS&lowbar;ContentInfo) or ASN1&lowbar;ITEM&lowbar;rptr(PKCS7)&period;
| *libctx*
| Library context for algorithm fetches, or NULL for the default&period;
| *propq*
| Property query for those fetches, or NULL&period;
|===


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