Debian Codegraph @

upstream/debian-trixie/man3/CMS_get0_RecipientInfos.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "CMS_GET0_RECIPIENTINFOS 3SSL"
58 .TH CMS_GET0_RECIPIENTINFOS 3SSL 2026-04-07 3.5.6 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 CMS_get0_RecipientInfos, CMS_RecipientInfo_type,
65 CMS_RecipientInfo_ktri_get0_signer_id, CMS_RecipientInfo_ktri_cert_cmp,
66 CMS_RecipientInfo_set0_pkey, CMS_RecipientInfo_kekri_get0_id,
67 CMS_RecipientInfo_kari_set0_pkey_and_peer,
68 CMS_RecipientInfo_kari_set0_pkey,
69 CMS_RecipientInfo_kekri_id_cmp, CMS_RecipientInfo_set0_key,
70 CMS_RecipientInfo_decrypt, CMS_RecipientInfo_encrypt
71 \&\- CMS envelopedData RecipientInfo routines
72 .SH SYNOPSIS
73 .IX Header "SYNOPSIS"
74 .Vb 1
75 \& #include <openssl/cms.h>
76 \&
77 \& STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
78 \& int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
79 \&
80 \& int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
81 \& ASN1_OCTET_STRING **keyid,
82 \& X509_NAME **issuer,
83 \& ASN1_INTEGER **sno);
84 \& int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
85 \& int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
86 \& int CMS_RecipientInfo_kari_set0_pkey_and_peer(CMS_RecipientInfo *ri,
87 \& EVP_PKEY *pk, X509 *peer);
88 \& int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
89 \& int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg,
90 \& ASN1_OCTET_STRING **pid,
91 \& ASN1_GENERALIZEDTIME **pdate,
92 \& ASN1_OBJECT **potherid,
93 \& ASN1_TYPE **pothertype);
94 \& int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
95 \& const unsigned char *id, size_t idlen);
96 \& int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,
97 \& unsigned char *key, size_t keylen);
98 \&
99 \& int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
100 \& int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
101 .Ve
102 .SH DESCRIPTION
103 .IX Header "DESCRIPTION"
104 The function \fBCMS_get0_RecipientInfos()\fR returns all the CMS_RecipientInfo
105 structures associated with a CMS EnvelopedData structure.
106 .PP
107 \&\fBCMS_RecipientInfo_type()\fR returns the type of CMS_RecipientInfo structure \fBri\fR.
108 It will currently return CMS_RECIPINFO_TRANS, CMS_RECIPINFO_AGREE,
109 CMS_RECIPINFO_KEK, CMS_RECIPINFO_PASS, or CMS_RECIPINFO_OTHER.
110 .PP
111 \&\fBCMS_RecipientInfo_ktri_get0_signer_id()\fR retrieves the certificate recipient
112 identifier associated with a specific CMS_RecipientInfo structure \fBri\fR, which
113 must be of type CMS_RECIPINFO_TRANS. Either the keyidentifier will be set in
114 \&\fBkeyid\fR or \fBboth\fR issuer name and serial number in \fBissuer\fR and \fBsno\fR.
115 .PP
116 \&\fBCMS_RecipientInfo_ktri_cert_cmp()\fR compares the certificate \fBcert\fR against the
117 CMS_RecipientInfo structure \fBri\fR, which must be of type CMS_RECIPINFO_TRANS.
118 It returns zero if the comparison is successful and non zero if not.
119 .PP
120 \&\fBCMS_RecipientInfo_set0_pkey()\fR associates the private key \fBpkey\fR with
121 the CMS_RecipientInfo structure \fBri\fR, which must be of type
122 CMS_RECIPINFO_TRANS.
123 .PP
124 \&\fBCMS_RecipientInfo_kari_set0_pkey_and_peer()\fR associates the private key \fBpkey\fR
125 and peer certificate \fBpeer\fR with the CMS_RecipientInfo structure \fBri\fR, which
126 must be of type CMS_RECIPINFO_AGREE.
127 .PP
128 \&\fBCMS_RecipientInfo_kari_set0_pkey()\fR associates the private key \fBpkey\fR with the
129 CMS_RecipientInfo structure \fBri\fR, which must be of type CMS_RECIPINFO_AGREE.
130 .PP
131 \&\fBCMS_RecipientInfo_kekri_get0_id()\fR retrieves the key information from the
132 CMS_RecipientInfo structure \fBri\fR which must be of type CMS_RECIPINFO_KEK. Any
133 of the remaining parameters can be NULL if the application is not interested in
134 the value of a field. Where a field is optional and absent NULL will be written
135 to the corresponding parameter. The keyEncryptionAlgorithm field is written to
136 \&\fBpalg\fR, the \fBkeyIdentifier\fR field is written to \fBpid\fR, the \fBdate\fR field if
137 present is written to \fBpdate\fR, if the \fBother\fR field is present the components
138 \&\fBkeyAttrId\fR and \fBkeyAttr\fR are written to parameters \fBpotherid\fR and
139 \&\fBpothertype\fR.
140 .PP
141 \&\fBCMS_RecipientInfo_kekri_id_cmp()\fR compares the ID in the \fBid\fR and \fBidlen\fR
142 parameters against the \fBkeyIdentifier\fR CMS_RecipientInfo structure \fBri\fR,
143 which must be of type CMS_RECIPINFO_KEK. It returns zero if the comparison is
144 successful and non zero if not.
145 .PP
146 \&\fBCMS_RecipientInfo_set0_key()\fR associates the symmetric key \fBkey\fR of length
147 \&\fBkeylen\fR with the CMS_RecipientInfo structure \fBri\fR, which must be of type
148 CMS_RECIPINFO_KEK.
149 .PP
150 \&\fBCMS_RecipientInfo_decrypt()\fR attempts to decrypt CMS_RecipientInfo structure
151 \&\fBri\fR in structure \fBcms\fR. A key must have been associated with the structure
152 first.
153 .PP
154 \&\fBCMS_RecipientInfo_encrypt()\fR attempts to encrypt CMS_RecipientInfo structure
155 \&\fBri\fR in structure \fBcms\fR. A key must have been associated with the structure
156 first and the content encryption key must be available: for example by a
157 previous call to \fBCMS_RecipientInfo_decrypt()\fR.
158 .SH NOTES
159 .IX Header "NOTES"
160 The main purpose of these functions is to enable an application to lookup
161 recipient keys using any appropriate technique when the simpler method
162 of \fBCMS_decrypt()\fR is not appropriate.
163 .PP
164 In typical usage and application will retrieve all CMS_RecipientInfo structures
165 using \fBCMS_get0_RecipientInfos()\fR and check the type of each using
166 \&\fBCMS_RecipientInfo_type()\fR. Depending on the type the CMS_RecipientInfo structure
167 can be ignored or its key identifier data retrieved using an appropriate
168 function. Then if the corresponding secret or private key can be obtained by
169 any appropriate means it can then associated with the structure and
170 \&\fBCMS_RecipientInfo_decrypt()\fR called. If successful \fBCMS_decrypt()\fR can be called
171 with a NULL key to decrypt the enveloped content.
172 .PP
173 The \fBCMS_RecipientInfo_encrypt()\fR can be used to add a new recipient to an
174 existing enveloped data structure. Typically an application will first decrypt
175 an appropriate CMS_RecipientInfo structure to make the content encrypt key
176 available, it will then add a new recipient using a function such as
177 \&\fBCMS_add1_recipient_cert()\fR and finally encrypt the content encryption key
178 using \fBCMS_RecipientInfo_encrypt()\fR.
179 .SH "RETURN VALUES"
180 .IX Header "RETURN VALUES"
181 \&\fBCMS_get0_RecipientInfos()\fR returns all CMS_RecipientInfo structures, or NULL if
182 an error occurs.
183 .PP
184 \&\fBCMS_RecipientInfo_ktri_get0_signer_id()\fR, \fBCMS_RecipientInfo_set0_pkey()\fR,
185 \&\fBCMS_RecipientInfo_kekri_get0_id()\fR, \fBCMS_RecipientInfo_set0_key()\fR and
186 \&\fBCMS_RecipientInfo_decrypt()\fR return 1 for success or 0 if an error occurs.
187 \&\fBCMS_RecipientInfo_encrypt()\fR return 1 for success or 0 if an error occurs.
188 .PP
189 \&\fBCMS_RecipientInfo_ktri_cert_cmp()\fR and \fBCMS_RecipientInfo_kekri_cmp()\fR return 0
190 for a successful comparison and non zero otherwise.
191 .PP
192 Any error can be obtained from \fBERR_get_error\fR\|(3).
193 .SH "SEE ALSO"
194 .IX Header "SEE ALSO"
195 \&\fBERR_get_error\fR\|(3), \fBCMS_decrypt\fR\|(3)
196 .SH HISTORY
197 .IX Header "HISTORY"
198 \&\fBCMS_RecipientInfo_kari_set0_pkey_and_peer\fR and \fBCMS_RecipientInfo_kari_set0_pkey\fR
199 were added in OpenSSL 3.0.
200 .SH COPYRIGHT
201 .IX Header "COPYRIGHT"
202 Copyright 2008\-2020 The OpenSSL Project Authors. All Rights Reserved.
203 .PP
204 Licensed under the Apache License 2.0 (the "License"). You may not use
205 this file except in compliance with the License. You can obtain a copy
206 in the file LICENSE in the source distribution or at
207 <https://www.openssl.org/source/license.html>.