[#CMS_EnvelopedData_decrypt]
= CMS&lowbar;EnvelopedData&lowbar;decrypt
:mrdocs:

Decrypt a CMS EnvelopedData structure and return a BIO of the plaintext&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BIO.adoc[BIO]*
CMS&lowbar;EnvelopedData&lowbar;decrypt(
    xref:CMS_EnvelopedData.adoc[CMS&lowbar;EnvelopedData]* env,
    xref:BIO.adoc[BIO]* detached&lowbar;data,
    xref:EVP_PKEY.adoc[EVP&lowbar;PKEY]* pkey,
    xref:X509.adoc[X509]* cert,
    xref:ASN1_OCTET_STRING.adoc[ASN1&lowbar;OCTET&lowbar;STRING]* secret,
    unsigned int flags,
    xref:OSSL_LIB_CTX.adoc[OSSL&lowbar;LIB&lowbar;CTX]* libctx,
    char const* propq);
----

== Return Value

BIO containing the decrypted content, or NULL on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *env*
| EnvelopedData to decrypt&period;
| *detached&lowbar;data*
| Detached encrypted&hyphen;content BIO when applicable&semi; normally NULL&period;
| *pkey*
| Recipient private key when `secret` is NULL&period;
| *cert*
| Recipient certificate used to select the RecipientInfo&semi; recommended when `pkey` is set&period;
| *secret*
| Pre&hyphen;shared content&hyphen;encryption key, or NULL to unwrap with `pkey&period;`
| *flags*
| Optional CMS decrypt flags (for example CMS&lowbar;TEXT)&period;
| *libctx*
| Library context for algorithm fetches, or NULL for the default&period;
| *propq*
| Property query for provider selection, or NULL&period;
|===


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