[#CMS_EncryptedData_set1_key]
= CMS&lowbar;EncryptedData&lowbar;set1&lowbar;key
:mrdocs:

Set the content&hyphen;encryption cipher and copy the symmetric key into a CMS EncryptedData&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
CMS&lowbar;EncryptedData&lowbar;set1&lowbar;key(
    xref:CMS_ContentInfo.adoc[CMS&lowbar;ContentInfo]* cms,
    xref:EVP_CIPHER-07.adoc[EVP&lowbar;CIPHER] const* ciph,
    unsigned char const* key,
    size&lowbar;t keylen);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *cms*
| ContentInfo expected to contain EncryptedData (AEAD ciphers are not supported)&period;
| *ciph*
| Symmetric cipher whose ASN&period;1 parameters are recorded&period;
| *key*
| Symmetric key bytes to copy&period;
| *keylen*
| Length of `key` in octets&period;
|===


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