CMS_ENCRYPTEDDATA_SET1_KEY(3ossl)

πŸ’– CMS_ENCRYPTEDDATA_SET1_KEY πŸ’–

okay bestie, so this is a page from the OpenSSL manual, section 3ossl β€” and we're talking about CMS_EncryptedData_set1_key. yes it's a mouthful, yes it's iconic, let's go 🫢


✨ 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);

look at that signature, so clean, so demure πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So CMS_EncryptedData_set1_key() takes in a cms EncryptedData object and sets the appropriate attributes to ciph. ✨ And the way it makes a copy of the symmetric key of size keylen?? Obsessed. It's giving "your key is safe with me, I'm making my own copy bestie."

πŸ’€ BUT β€” listen, this is important β€” AEAD cipher algorithms are not supported. Not a vibe. Don't try it. No cap.

πŸ‘‘ RETURN VALUES πŸ‘‘

  • CMS_EncryptedData_set1_key() returns 0 if an error occurred 😭
  • otherwise it returns 1 β€” slay ✨

literally that's it, binary queen, no in-between πŸ’…


🌈 SEE ALSO 🌈

go read those too, they're the besties of this function fr fr 🫢


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>.


okay and that's the whole page, bestie!! 🌸 this version dropped in 3.5.9 on 2026-09-29, straight from the OpenSSL girlies. go set some keys, stay hydrated, and remember: no AEAD allowed. mwah πŸ’–βœ¨πŸ§š

πŸ“¦ where this page comes from