CMS_ADD1_RECIPIENT_CERT(3ossl)
π CMS_ADD1_RECIPIENT_CERT π
okay bestie, this is the CMS_ADD1_RECIPIENT_CERT(3ossl) page from the OpenSSL fam, and it's literally all about hand-adding recipients to your CMS enveloped data structure. no cap, it's giving "I want finer control than the default" energy. let's get into it π«Ά
β¨ NAME β¨
CMS_add1_recipient, CMS_add1_recipient_cert, CMS_add0_recipient_key β add recipients to a CMS enveloped data structure π
πΈ SYNOPSIS πΈ
#include <openssl/cms.h>
CMS_RecipientInfo *CMS_add1_recipient(CMS_ContentInfo *cms, X509 *recip,
EVP_PKEY *originatorPrivKey,
X509 *originator, unsigned int flags);
CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
X509 *recip, unsigned int flags);
CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
unsigned char *key, size_t keylen,
unsigned char *id, size_t idlen,
ASN1_GENERALIZEDTIME *date,
ASN1_OBJECT *otherTypeId,
ASN1_TYPE *otherType);
π DESCRIPTION π
so CMS_add1_recipient() adds the recipient recip and also hands over the originator pkey originatorPrivKey plus the originator certificate originator to CMS_ContentInfo. and here's the tea β β those originator-related fields only matter when you're using the keyAgreement method of providing the shared key. otherwise? they're just vibing there.
CMS_add1_recipient_cert() adds the recipient recip to the CMS_ContentInfo enveloped data structure cms as a KeyTransRecipientInfo structure. iconic, straightforward, we love her β¨
CMS_add0_recipient_key() adds the symmetric key key of length keylen, using wrapping algorithm nid, identifier id of length idlen, and the optional values date, otherTypeId and otherType, to the CMS_ContentInfo enveloped data structure cms as a KEKRecipientInfo structure. queen behavior honestly π
heads up bestie: you should get thatCMS_ContentInfostructure from an initial call toCMS_encrypt()with the flagCMS_PARTIALset. don't skip that step, fr fr.
π¦ NOTES π¦
the main character purpose of these functions? giving you finer control over a CMS enveloped data structure when the simpler CMS_encrypt() defaults just aren't the vibe. for example, if one or more KEKRecipientInfo structures need to be added. and you can also add new attributes using the returned CMS_RecipientInfo structure plus the CMS attribute utility functions. multi-purpose king π
by default, OpenSSL identifies recipient certificates using issuer name and serial number. but if CMS_USE_KEYID is set, it'll use the subject key identifier value instead. and listen β an error occurs if all recipient certificates do not have a subject key identifier extension. so like, check that first bestie π
and now the important bit ngl: currently only AES based key wrapping algorithms are supported for nid, specifically:
NID_id_aes128_wrapNID_id_aes192_wrapNID_id_aes256_wrap
if nid is set to NID_undef, then an AES wrap algorithm will be used consistent with keylen. slay, adaptive π
β RETURN VALUES β
CMS_add1_recipient_cert() and CMS_add0_recipient_key() return an internal pointer to the CMS_RecipientInfo structure that was just added β or NULL if an error occurs. that's it, that's the deal π
π SEE ALSO π
π HISTORY π
CMS_add1_recipient_cert and CMS_add0_recipient_key were added in OpenSSL 3.0. so they're like, not ancient, but they've been around the block π§
π COPYRIGHT π
Copyright 2008-2020 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>.
and that's the whole page bestie!! π this was version 3.5.9, dated 2026-09-29, and it's the CMS_ADD1_RECIPIENT_CERT(3ossl) manual from the OpenSSL girlies. go forth and add those recipients, you've got this β¨π«ΆπΈ
π¦ 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