CMS_ENCRYPTEDDATA_DECRYPT(3ossl)
π CMS_ENCRYPTEDDATA_DECRYPT(3ossl) π
okay bestie, sit down, hydrate, and let's talk about OpenSSL because this one is literally the manual page for CMS_EncryptedData_decrypt and CMS_EnvelopedData_decrypt β yes, both of them, sharing one page like the iconic duo they are. It's giving cryptography, it's giving decryption era, and we're gonna get through it together π«Ά
β¨ NAME β¨
CMS_EncryptedData_decrypt, CMS_EnvelopedData_decrypt β Decrypt CMS EncryptedData or EnvelopedData
no cap, that's the whole vibe: you got some encrypted CMS stuff and you want the content back. slay.
πΈ SYNOPSIS πΈ
#include <openssl/cms.h>
int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
const unsigned char *key, size_t keylen,
BIO *dcont, BIO *out, unsigned int flags);
BIO *CMS_EnvelopedData_decrypt(CMS_EnvelopedData *env, BIO *detached_data,
EVP_PKEY *pkey, X509 *cert,
ASN1_OCTET_STRING *secret, unsigned int flags,
OSSL_LIB_CTX *libctx, const char *propq);
look at those signatures. main character energy, both of them π
π¦ DESCRIPTION π¦
π CMS_EncryptedData_decrypt()
so this one decrypts a cms EncryptedData object using the symmetric key of size keylen bytes. that's the tea. π΅
β οΈ AEAD cipher algorithms are not supported. like, at all. don't try it, bestie, it's not the move.
Here's the cast of characters:
outβ aBIOto write the content to πflagsβ an optional set of flagsdcontβ used in the rare case where the encrypted content is detached. it will normally be set toNULL. (emphasis on rare, she's shy π)
the flags you can pass in the flags parameter
CMS_TEXTβ if this flag is set, MIME headers for type"text/plain"are deleted from the content. but β οΈ if the content is not of type"text/plain", then an error is returned. so like, vibe check your content type first, fr fr.
π CMS_EnvelopedData_decrypt()
this one decrypts a CMS EnvelopedData object env, similarly to CMS_decrypt(3), using:
- the symmetric key
secretif it is notNULLπ - otherwise the private key of the recipient
pkeyπ
and hmm, if pkey is given? it is recommended to also provide the associated certificate in cert β see CMS_decrypt(3) and the NOTES on cert there. (go read it, i'll wait π
)
the optional parameters flags and dcont are used as described above βοΈ (yes, same flags, same dcont, same energy).
the optional parameters library context libctx and property query propq are used when retrieving algorithms from providers. very provider-core of them β¨
π RETURN VALUES π
CMS_EncryptedData_decrypt()returns0if an error occurred, otherwise returns1. simple. binary. iconic. βοΈCMS_EnvelopedData_decrypt()returnsNULLif an error occurred, otherwise aBIOcontaining the decrypted content. π
π SEE ALSO π
the whole friend group, honestly π«Ά
β HISTORY β
CMS_EnvelopedData_decrypt() was added in OpenSSL 3.2. so if you're on something older and it's not workingβ¦ yeah, that's why bestie π
π COPYRIGHT π
Copyright 2020-2026 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>.
like, legally speaking, read the license. it's giving required π
and that's the page, babe!! πΈ this was OpenSSL 3.5.9, dated 2026-09-29, and it lives under CMS_ENCRYPTEDDATA_DECRYPT(3ossl) forever and ever. go decrypt something responsibly, mwah πβ¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms