[#CMS_EncryptedData_encrypt_ex]
= CMS&lowbar;EncryptedData&lowbar;encrypt&lowbar;ex
:mrdocs:

Create a CMS EncryptedData ContentInfo by encrypting data from a BIO (with libctx)&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:CMS_ContentInfo.adoc[CMS&lowbar;ContentInfo]*
CMS&lowbar;EncryptedData&lowbar;encrypt&lowbar;ex(
    xref:BIO.adoc[BIO]* in,
    xref:EVP_CIPHER-07.adoc[EVP&lowbar;CIPHER] const* cipher,
    unsigned char const* key,
    size&lowbar;t keylen,
    unsigned int flags,
    xref:OSSL_LIB_CTX.adoc[OSSL&lowbar;LIB&lowbar;CTX]* libctx,
    char const* propq);
----

== Description

Unless CMS&lowbar;STREAM and&sol;or CMS&lowbar;PARTIAL is set, CMS&lowbar;final() is called internally&period;

== Return Value

New EncryptedData ContentInfo, or NULL on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *in*
| BIO supplying the plaintext to encrypt&period;
| *cipher*
| Symmetric cipher&semi; must support ASN&period;1 encoding of its parameters (AEAD not supported)&period;
| *key*
| Encryption key bytes&period;
| *keylen*
| Length of `key` in bytes&period;
| *flags*
| CMS&lowbar;&ast; option flags such as CMS&lowbar;DETACHED, CMS&lowbar;STREAM, or CMS&lowbar;PARTIAL&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]#
