---
name: "CMS_EncryptedData_set1_key"
section: "3ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/CMS_EncryptedData_set1_key"
---

# CMS\_EncryptedData\_set1\_key(3ssl)

Sets the cipher and key for CMS EncryptedData

## NAME

CMS\_EncryptedData\_set1\_key - Sets the cipher and key for CMS EncryptedData

## SYNOPSIS

```
 #include <openssl/cms.h>
 int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
                                const unsigned char *key, size_t keylen);
```

## DESCRIPTION

**CMS\_EncryptedData\_set1\_key()** takes in a *cms* EncryptedData object and sets the appropriate attributes to *ciph*, it makes a copy of the symmetric *key* of size *keylen*. AEAD cipher algorithms are not supported.

## RETURN VALUES

**CMS\_EncryptedData\_set1\_key()** returns 0 if an error occurred otherwise returns 1.

## SEE ALSO

**CMS\_EncryptedData\_encrypt**(3), **CMS\_EncryptedData\_decrypt**(3)

## COPYRIGHT

Copyright 2025 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License").  You may not use this file except in compliance with the License.  You can obtain a copy in the file LICENSE in the source distribution or at \<https://www.openssl.org/source/license.html\>.
