1CMS_get0_RecipientInfos(3) OpenSSL CMS_get0_RecipientInfos(3)
2
3
4
6 CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri_get0_signer_id,CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pkey, CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kekri_id_cmp, CMS_RecipientInfo_set0_key, CMS_RecipientInfo_decrypt - CMS envelopedData RecipientInfo routines
7
9 #include <openssl/cms.h>
10
11 STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
12 int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
13
14 int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno);
15 int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
16 int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
17
18 int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg, ASN1_OCTET_STRING **pid, ASN1_GENERALIZEDTIME **pdate, ASN1_OBJECT **potherid, ASN1_TYPE **pothertype);
19 int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, const unsigned char *id, size_t idlen);
20 int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *key, size_t keylen);
21
22 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
23
25 The function CMS_get0_RecipientInfos() returns all the
26 CMS_RecipientInfo structures associated with a CMS EnvelopedData
27 structure.
28
29 CMS_RecipientInfo_type() returns the type of CMS_RecipientInfo
30 structure ri. It will currently return CMS_RECIPINFO_TRANS,
31 CMS_RECIPINFO_AGREE, CMS_RECIPINFO_KEK, CMS_RECIPINFO_PASS, or
32 CMS_RECIPINFO_OTHER.
33
34 CMS_RecipientInfo_ktri_get0_signer_id() retrieves the certificate
35 recipient identifier associated with a specific CMS_RecipientInfo
36 structure ri, which must be of type CMS_RECIPINFO_TRANS. Either the
37 keyidentifier will be set in keyid or both issuer name and serial
38 number in issuer and sno.
39
40 CMS_RecipientInfo_ktri_cert_cmp() compares the certificate cert against
41 the CMS_RecipientInfo structure ri, which must be of type
42 CMS_RECIPINFO_TRANS. It returns zero if the comparison is successful
43 and non zero if not.
44
45 CMS_RecipientInfo_set0_pkey() associates the private key pkey with the
46 CMS_RecipientInfo structure ri, which must be of type
47 CMS_RECIPINFO_TRANS.
48
49 CMS_RecipientInfo_kekri_get0_id() retrieves the key information from
50 the CMS_RecipientInfo structure ri which must be of type
51 CMS_RECIPINFO_KEK. Any of the remaining parameters can be NULL if the
52 application is not interested in the value of a field. Where a field is
53 optional and absent NULL will be written to the corresponding
54 parameter. The keyEncryptionAlgorithm field is written to palg, the
55 keyIdentifier field is written to pid, the date field if present is
56 written to pdate, if the other field is present the components
57 keyAttrId and keyAttr are written to parameters potherid and
58 pothertype.
59
60 CMS_RecipientInfo_kekri_id_cmp() compares the ID in the id and idlen
61 parameters against the keyIdentifier CMS_RecipientInfo structure ri,
62 which must be of type CMS_RECIPINFO_KEK. It returns zero if the
63 comparison is successful and non zero if not.
64
65 CMS_RecipientInfo_set0_key() associates the symmetric key key of length
66 keylen with the CMS_RecipientInfo structure ri, which must be of type
67 CMS_RECIPINFO_KEK.
68
69 CMS_RecipientInfo_decrypt() attempts to decrypt CMS_RecipientInfo
70 structure ri in structure cms. A key must have been associated with the
71 structure first.
72
74 The main purpose of these functions is to enable an application to
75 lookup recipient keys using any appropriate technique when the simpler
76 method of CMS_decrypt() is not appropriate.
77
78 In typical usage and application will retrieve all CMS_RecipientInfo
79 structures using CMS_get0_RecipientInfos() and check the type of each
80 using CMS_RecpientInfo_type(). Depending on the type the
81 CMS_RecipientInfo structure can be ignored or its key identifier data
82 retrieved using an appropriate function. Then if the corresponding
83 secret or private key can be obtained by any appropriate means it can
84 then associated with the structure and CMS_RecpientInfo_decrypt()
85 called. If successful CMS_decrypt() can be called with a NULL key to
86 decrypt the enveloped content.
87
89 CMS_get0_RecipientInfos() returns all CMS_RecipientInfo structures, or
90 NULL if an error occurs.
91
92 CMS_RecipientInfo_ktri_get0_signer_id(), CMS_RecipientInfo_set0_pkey(),
93 CMS_RecipientInfo_kekri_get0_id(), CMS_RecipientInfo_set0_key() and
94 CMS_RecipientInfo_decrypt() return 1 for success or 0 if an error
95 occurs.
96
97 CMS_RecipientInfo_ktri_cert_cmp() and CMS_RecipientInfo_kekri_cmp()
98 return 0 for a successful comparison and non zero otherwise.
99
100 Any error can be obtained from ERR_get_error(3).
101
103 ERR_get_error(3), CMS_decrypt(3)
104
106 These functions were first was added to OpenSSL 0.9.8
107
108
109
1101.0.1e 2013-02-11 CMS_get0_RecipientInfos(3)