diff options
Diffstat (limited to 'src/lib/libcrypto/man/CMS_get0_RecipientInfos.3')
-rw-r--r-- | src/lib/libcrypto/man/CMS_get0_RecipientInfos.3 | 323 |
1 files changed, 323 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3 b/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3 new file mode 100644 index 0000000000..07c16c5675 --- /dev/null +++ b/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3 | |||
@@ -0,0 +1,323 @@ | |||
1 | .\" $OpenBSD: CMS_get0_RecipientInfos.3,v 1.3 2019/08/10 23:41:22 schwarze Exp $ | ||
2 | .\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 | ||
3 | .\" | ||
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
5 | .\" Copyright (c) 2008, 2013 The OpenSSL Project. All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" | ||
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: August 10 2019 $ | ||
52 | .Dt CMS_GET0_RECIPIENTINFOS 3 | ||
53 | .Os | ||
54 | .Sh NAME | ||
55 | .Nm CMS_get0_RecipientInfos , | ||
56 | .Nm CMS_RecipientInfo_type , | ||
57 | .Nm CMS_RecipientInfo_ktri_get0_signer_id , | ||
58 | .Nm CMS_RecipientInfo_ktri_cert_cmp , | ||
59 | .Nm CMS_RecipientInfo_set0_pkey , | ||
60 | .Nm CMS_RecipientInfo_kekri_get0_id , | ||
61 | .Nm CMS_RecipientInfo_kekri_id_cmp , | ||
62 | .Nm CMS_RecipientInfo_set0_key , | ||
63 | .Nm CMS_RecipientInfo_decrypt , | ||
64 | .Nm CMS_RecipientInfo_encrypt | ||
65 | .Nd CMS envelopedData RecipientInfo routines | ||
66 | .Sh SYNOPSIS | ||
67 | .In openssl/cms.h | ||
68 | .Ft STACK_OF(CMS_RecipientInfo) * | ||
69 | .Fo CMS_get0_RecipientInfos | ||
70 | .Fa "CMS_ContentInfo *cms" | ||
71 | .Fc | ||
72 | .Ft int | ||
73 | .Fo CMS_RecipientInfo_type | ||
74 | .Fa "CMS_RecipientInfo *ri" | ||
75 | .Fc | ||
76 | .Ft int | ||
77 | .Fo CMS_RecipientInfo_ktri_get0_signer_id | ||
78 | .Fa "CMS_RecipientInfo *ri" | ||
79 | .Fa "ASN1_OCTET_STRING **keyid" | ||
80 | .Fa "X509_NAME **issuer" | ||
81 | .Fa "ASN1_INTEGER **sno" | ||
82 | .Fc | ||
83 | .Ft int | ||
84 | .Fo CMS_RecipientInfo_ktri_cert_cmp | ||
85 | .Fa "CMS_RecipientInfo *ri" | ||
86 | .Fa "X509 *cert" | ||
87 | .Fc | ||
88 | .Ft int | ||
89 | .Fo CMS_RecipientInfo_set0_pkey | ||
90 | .Fa "CMS_RecipientInfo *ri" | ||
91 | .Fa "EVP_PKEY *pkey" | ||
92 | .Fc | ||
93 | .Ft int | ||
94 | .Fo CMS_RecipientInfo_kekri_get0_id | ||
95 | .Fa "CMS_RecipientInfo *ri" | ||
96 | .Fa "X509_ALGOR **palg" | ||
97 | .Fa "ASN1_OCTET_STRING **pid" | ||
98 | .Fa "ASN1_GENERALIZEDTIME **pdate" | ||
99 | .Fa "ASN1_OBJECT **potherid" | ||
100 | .Fa "ASN1_TYPE **pothertype" | ||
101 | .Fc | ||
102 | .Ft int | ||
103 | .Fo CMS_RecipientInfo_kekri_id_cmp | ||
104 | .Fa "CMS_RecipientInfo *ri" | ||
105 | .Fa "const unsigned char *id" | ||
106 | .Fa "size_t idlen" | ||
107 | .Fc | ||
108 | .Ft int | ||
109 | .Fo CMS_RecipientInfo_set0_key | ||
110 | .Fa "CMS_RecipientInfo *ri" | ||
111 | .Fa "unsigned char *key" | ||
112 | .Fa "size_t keylen" | ||
113 | .Fc | ||
114 | .Ft int | ||
115 | .Fo CMS_RecipientInfo_decrypt | ||
116 | .Fa "CMS_ContentInfo *cms" | ||
117 | .Fa "CMS_RecipientInfo *ri" | ||
118 | .Fc | ||
119 | .Ft int | ||
120 | .Fo CMS_RecipientInfo_encrypt | ||
121 | .Fa "CMS_ContentInfo *cms" | ||
122 | .Fa "CMS_RecipientInfo *ri" | ||
123 | .Fc | ||
124 | .Sh DESCRIPTION | ||
125 | The function | ||
126 | .Fn CMS_get0_RecipientInfos | ||
127 | returns all the | ||
128 | .Vt CMS_RecipientInfo | ||
129 | structures associated with a CMS EnvelopedData structure. | ||
130 | .Pp | ||
131 | .Fn CMS_RecipientInfo_type | ||
132 | returns the type of the | ||
133 | .Vt CMS_RecipientInfo | ||
134 | structure | ||
135 | .Fa ri . | ||
136 | It will currently return | ||
137 | .Dv CMS_RECIPINFO_TRANS , | ||
138 | .Dv CMS_RECIPINFO_AGREE , | ||
139 | .Dv CMS_RECIPINFO_KEK , | ||
140 | .Dv CMS_RECIPINFO_PASS , | ||
141 | or | ||
142 | .Dv CMS_RECIPINFO_OTHER . | ||
143 | .Pp | ||
144 | .Fn CMS_RecipientInfo_ktri_get0_signer_id | ||
145 | retrieves the certificate recipient identifier associated with a | ||
146 | specific | ||
147 | .Vt CMS_RecipientInfo | ||
148 | structure | ||
149 | .Fa ri , | ||
150 | which must be of type | ||
151 | .Dv CMS_RECIPINFO_TRANS . | ||
152 | Either the keyidentifier will be set in | ||
153 | .Fa keyid | ||
154 | or | ||
155 | .Em both | ||
156 | issuer name and serial number in | ||
157 | .Fa issuer | ||
158 | and | ||
159 | .Fa sno . | ||
160 | .Pp | ||
161 | .Fn CMS_RecipientInfo_ktri_cert_cmp | ||
162 | compares the certificate | ||
163 | .Fa cert | ||
164 | against the | ||
165 | .Vt CMS_RecipientInfo | ||
166 | structure | ||
167 | .Fa ri , | ||
168 | which must be of type | ||
169 | .Dv CMS_RECIPINFO_TRANS . | ||
170 | It returns zero if the comparison is successful or non-zero if not. | ||
171 | .Pp | ||
172 | .Fn CMS_RecipientInfo_set0_pkey | ||
173 | associates the private key | ||
174 | .Fa pkey | ||
175 | with the | ||
176 | .Vt CMS_RecipientInfo | ||
177 | structure | ||
178 | .Fa ri , | ||
179 | which must be of type | ||
180 | .Dv CMS_RECIPINFO_TRANS . | ||
181 | .Pp | ||
182 | .Fn CMS_RecipientInfo_kekri_get0_id | ||
183 | retrieves the key information from the | ||
184 | .Vt CMS_RecipientInfo | ||
185 | structure | ||
186 | .Fa ri | ||
187 | which must be of type | ||
188 | .Dv CMS_RECIPINFO_KEK . | ||
189 | Any of the remaining parameters can be | ||
190 | .Dv NULL | ||
191 | if the application is not interested in the value of a field. | ||
192 | Where a field is optional and absent, | ||
193 | .Dv NULL | ||
194 | will be written to the corresponding parameter. | ||
195 | The keyEncryptionAlgorithm field is written to | ||
196 | .Fa palg , | ||
197 | the keyIdentifier field is written to | ||
198 | .Fa pid , | ||
199 | the | ||
200 | .Sy date | ||
201 | field if present is written to | ||
202 | .Fa pdate . | ||
203 | If the | ||
204 | .Sy other | ||
205 | field is present the components | ||
206 | .Sy keyAttrId | ||
207 | and | ||
208 | .Sy keyAttr | ||
209 | are written to the parameters | ||
210 | .Fa potherid | ||
211 | and | ||
212 | .Fa pothertype . | ||
213 | .Pp | ||
214 | .Fn CMS_RecipientInfo_kekri_id_cmp | ||
215 | compares the ID in the | ||
216 | .Fa id | ||
217 | and | ||
218 | .Fa idlen | ||
219 | parameters against the keyIdentifier | ||
220 | .Vt CMS_RecipientInfo | ||
221 | structure | ||
222 | .Fa ri , | ||
223 | which must be of type | ||
224 | .Dv CMS_RECIPINFO_KEK . | ||
225 | It returns zero if the comparison is successful or non-zero if not. | ||
226 | .Pp | ||
227 | .Fn CMS_RecipientInfo_set0_key | ||
228 | associates the symmetric key | ||
229 | .Fa key | ||
230 | of length | ||
231 | .Fa keylen | ||
232 | with the | ||
233 | .Vt CMS_RecipientInfo | ||
234 | structure | ||
235 | .Fa ri , | ||
236 | which must be of type | ||
237 | .Dv CMS_RECIPINFO_KEK . | ||
238 | .Pp | ||
239 | .Fn CMS_RecipientInfo_decrypt | ||
240 | attempts to decrypt the | ||
241 | .Vt CMS_RecipientInfo | ||
242 | structure | ||
243 | .Fa ri | ||
244 | in structure | ||
245 | .Fa cms . | ||
246 | A key must have been associated with the structure first. | ||
247 | .Pp | ||
248 | .Fn CMS_RecipientInfo_encrypt | ||
249 | attempts to encrypt the | ||
250 | .Vt CMS_RecipientInfo | ||
251 | structure | ||
252 | .Fa ri | ||
253 | in structure | ||
254 | .Fa cms . | ||
255 | A key must have been associated with the structure first and the content | ||
256 | encryption key must be available: for example by a previous call to | ||
257 | .Fn CMS_RecipientInfo_decrypt . | ||
258 | .Pp | ||
259 | The main purpose of these functions is to enable an application to | ||
260 | lookup recipient keys using any appropriate technique when the simpler | ||
261 | method of | ||
262 | .Xr CMS_decrypt 3 | ||
263 | is not appropriate. | ||
264 | .Pp | ||
265 | In typical usage, an application will retrieve all | ||
266 | .Vt CMS_RecipientInfo | ||
267 | structures using | ||
268 | .Fn CMS_get0_RecipientInfos | ||
269 | and check the type of each using | ||
270 | .Fn CMS_RecipientInfo_type . | ||
271 | Depending on the type, the | ||
272 | .Vt CMS_RecipientInfo | ||
273 | structure can be ignored or its key identifier data retrieved using | ||
274 | an appropriate function. | ||
275 | If the corresponding secret or private key can be obtained by any | ||
276 | appropriate means it can then be associated with the structure and | ||
277 | .Fn CMS_RecipientInfo_decrypt | ||
278 | called. | ||
279 | If successful, | ||
280 | .Xr CMS_decrypt 3 | ||
281 | can be called with a | ||
282 | .Dv NULL | ||
283 | key to decrypt the enveloped content. | ||
284 | .Pp | ||
285 | The function | ||
286 | .Fn CMS_RecipientInfo_encrypt | ||
287 | can be used to add a new recipient to an existing enveloped data | ||
288 | structure. | ||
289 | Typically an application will first decrypt an appropriate | ||
290 | .Vt CMS_RecipientInfo | ||
291 | structure to make the content encrypt key available. | ||
292 | Ot will then add a new recipient using a function such as | ||
293 | .Xr CMS_add1_recipient_cert 3 | ||
294 | and finally encrypt the content encryption key using | ||
295 | .Fn CMS_RecipientInfo_encrypt . | ||
296 | .Sh RETURN VALUES | ||
297 | .Fn CMS_get0_RecipientInfos | ||
298 | returns all | ||
299 | .Vt CMS_RecipientInfo | ||
300 | structures, or | ||
301 | .Dv NULL | ||
302 | if an error occurs. | ||
303 | .Pp | ||
304 | .Fn CMS_RecipientInfo_ktri_get0_signer_id , | ||
305 | .Fn CMS_RecipientInfo_set0_pkey , | ||
306 | .Fn CMS_RecipientInfo_kekri_get0_id , | ||
307 | .Fn CMS_RecipientInfo_set0_key , | ||
308 | .Fn CMS_RecipientInfo_decrypt , | ||
309 | and | ||
310 | .Fn CMS_RecipientInfo_encrypt | ||
311 | return 1 for success or 0 if an error occurs. | ||
312 | .Pp | ||
313 | .Fn CMS_RecipientInfo_ktri_cert_cmp | ||
314 | and | ||
315 | .Fn CMS_RecipientInfo_kekri_id_cmp | ||
316 | return 0 for a successful comparison or non-zero otherwise. | ||
317 | .Pp | ||
318 | Any error can be obtained from | ||
319 | .Xr ERR_get_error 3 . | ||
320 | .Sh SEE ALSO | ||
321 | .Xr CMS_decrypt 3 | ||
322 | .Sh HISTORY | ||
323 | These functions were first was added to OpenSSL 0.9.8. | ||