5 CMS_add1_recipient_cert, CMS_add0_recipient_key - add recipients to a CMS enveloped data structure
9 #include <openssl/cms.h>
11 CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip, unsigned int flags);
13 CMS_RecipientInfo *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);
17 CMS_add1_recipient_cert() adds a recipient certificate B<recip>
18 CMS_ContentInfo enveloped data structure B<cms> as a KeyTransRecipientInfo
21 CMS_add0_recipient_key() adds symmetric key B<key> of length B<keylen> using
22 wrapping algorithm B<nid>, identifier B<id> or length B<idlen> and optional
23 values B<date>, B<otherTypeId> and B<otherType> to CMS_ContentInfo enveloped
24 data structure B<cms> as a KEKRecipientInfo structure.
26 The CMS_ContentInfo structure should be obtained from an initial call to
27 CMS_encrypt() with the flag B<CMS_PARTIAL> set.
31 The main purpose of this function is to provide finer control over a CMS
32 enveloped data structure where the simpler CMS_encrypt() function defaults are
33 not appropriate. For example if one or more KEKRecipientInfo structures
34 need to be added. New attributes can also be added using the returned
35 CMS_RecipientInfo structure and the CMS attribute utility functions.
37 OpenSSL will by default identify recipient certificates using issuer name
38 and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
39 identifier value instead. An error occurs if all recipient certificates do not
40 have a subject key identifier extension.
42 Currently only AES based key wrapping algorithms are supported for B<nid>,
43 specifically: NID_id_aes128_wrap, NID_id_aes192_wrap and NID_id_aes256_wrap.
44 If B<nid> is set to B<NID_undef> then an AES wrap algorithm will be used
45 consistent with B<keylen>.
49 CMS_add1_recipient_cert() and CMS_add0_recipient_key() return an internal
50 pointer to the CMS_RecipientInfo structure just added or NULL if an error
55 L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)>,
56 L<CMS_final(3)|CMS_final(3)>,
60 CMS_add1_recipient_cert() and CMS_add0_recipient_key() were added to OpenSSL