summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/CMS_get0_RecipientInfos.3
diff options
context:
space:
mode:
authorschwarze <>2019-08-10 23:41:22 +0000
committerschwarze <>2019-08-10 23:41:22 +0000
commitcc47a3abfdbd325bb89055dfd451213698f0850e (patch)
tree3f70859fec97a5fc0a89365840d52dc9deee7bf9 /src/lib/libcrypto/man/CMS_get0_RecipientInfos.3
parenta7f0a908e25ca54df61944e40d7165ba5d79d244 (diff)
downloadopenbsd-cc47a3abfdbd325bb89055dfd451213698f0850e.tar.gz
openbsd-cc47a3abfdbd325bb89055dfd451213698f0850e.tar.bz2
openbsd-cc47a3abfdbd325bb89055dfd451213698f0850e.zip
Re-convert and re-import the CMS manual pages from OpenSSL 1.1.1
(which are still under a free license) with pod2mdoc(1) now that jsing@ has begun work to provide these APIs. Some formatting was improved and some typos were fixed, but apart from that, little was changed, so there is still much to polish.
Diffstat (limited to 'src/lib/libcrypto/man/CMS_get0_RecipientInfos.3')
-rw-r--r--src/lib/libcrypto/man/CMS_get0_RecipientInfos.3323
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
125The function
126.Fn CMS_get0_RecipientInfos
127returns all the
128.Vt CMS_RecipientInfo
129structures associated with a CMS EnvelopedData structure.
130.Pp
131.Fn CMS_RecipientInfo_type
132returns the type of the
133.Vt CMS_RecipientInfo
134structure
135.Fa ri .
136It will currently return
137.Dv CMS_RECIPINFO_TRANS ,
138.Dv CMS_RECIPINFO_AGREE ,
139.Dv CMS_RECIPINFO_KEK ,
140.Dv CMS_RECIPINFO_PASS ,
141or
142.Dv CMS_RECIPINFO_OTHER .
143.Pp
144.Fn CMS_RecipientInfo_ktri_get0_signer_id
145retrieves the certificate recipient identifier associated with a
146specific
147.Vt CMS_RecipientInfo
148structure
149.Fa ri ,
150which must be of type
151.Dv CMS_RECIPINFO_TRANS .
152Either the keyidentifier will be set in
153.Fa keyid
154or
155.Em both
156issuer name and serial number in
157.Fa issuer
158and
159.Fa sno .
160.Pp
161.Fn CMS_RecipientInfo_ktri_cert_cmp
162compares the certificate
163.Fa cert
164against the
165.Vt CMS_RecipientInfo
166structure
167.Fa ri ,
168which must be of type
169.Dv CMS_RECIPINFO_TRANS .
170It returns zero if the comparison is successful or non-zero if not.
171.Pp
172.Fn CMS_RecipientInfo_set0_pkey
173associates the private key
174.Fa pkey
175with the
176.Vt CMS_RecipientInfo
177structure
178.Fa ri ,
179which must be of type
180.Dv CMS_RECIPINFO_TRANS .
181.Pp
182.Fn CMS_RecipientInfo_kekri_get0_id
183retrieves the key information from the
184.Vt CMS_RecipientInfo
185structure
186.Fa ri
187which must be of type
188.Dv CMS_RECIPINFO_KEK .
189Any of the remaining parameters can be
190.Dv NULL
191if the application is not interested in the value of a field.
192Where a field is optional and absent,
193.Dv NULL
194will be written to the corresponding parameter.
195The keyEncryptionAlgorithm field is written to
196.Fa palg ,
197the keyIdentifier field is written to
198.Fa pid ,
199the
200.Sy date
201field if present is written to
202.Fa pdate .
203If the
204.Sy other
205field is present the components
206.Sy keyAttrId
207and
208.Sy keyAttr
209are written to the parameters
210.Fa potherid
211and
212.Fa pothertype .
213.Pp
214.Fn CMS_RecipientInfo_kekri_id_cmp
215compares the ID in the
216.Fa id
217and
218.Fa idlen
219parameters against the keyIdentifier
220.Vt CMS_RecipientInfo
221structure
222.Fa ri ,
223which must be of type
224.Dv CMS_RECIPINFO_KEK .
225It returns zero if the comparison is successful or non-zero if not.
226.Pp
227.Fn CMS_RecipientInfo_set0_key
228associates the symmetric key
229.Fa key
230of length
231.Fa keylen
232with the
233.Vt CMS_RecipientInfo
234structure
235.Fa ri ,
236which must be of type
237.Dv CMS_RECIPINFO_KEK .
238.Pp
239.Fn CMS_RecipientInfo_decrypt
240attempts to decrypt the
241.Vt CMS_RecipientInfo
242structure
243.Fa ri
244in structure
245.Fa cms .
246A key must have been associated with the structure first.
247.Pp
248.Fn CMS_RecipientInfo_encrypt
249attempts to encrypt the
250.Vt CMS_RecipientInfo
251structure
252.Fa ri
253in structure
254.Fa cms .
255A key must have been associated with the structure first and the content
256encryption key must be available: for example by a previous call to
257.Fn CMS_RecipientInfo_decrypt .
258.Pp
259The main purpose of these functions is to enable an application to
260lookup recipient keys using any appropriate technique when the simpler
261method of
262.Xr CMS_decrypt 3
263is not appropriate.
264.Pp
265In typical usage, an application will retrieve all
266.Vt CMS_RecipientInfo
267structures using
268.Fn CMS_get0_RecipientInfos
269and check the type of each using
270.Fn CMS_RecipientInfo_type .
271Depending on the type, the
272.Vt CMS_RecipientInfo
273structure can be ignored or its key identifier data retrieved using
274an appropriate function.
275If the corresponding secret or private key can be obtained by any
276appropriate means it can then be associated with the structure and
277.Fn CMS_RecipientInfo_decrypt
278called.
279If successful,
280.Xr CMS_decrypt 3
281can be called with a
282.Dv NULL
283key to decrypt the enveloped content.
284.Pp
285The function
286.Fn CMS_RecipientInfo_encrypt
287can be used to add a new recipient to an existing enveloped data
288structure.
289Typically an application will first decrypt an appropriate
290.Vt CMS_RecipientInfo
291structure to make the content encrypt key available.
292Ot will then add a new recipient using a function such as
293.Xr CMS_add1_recipient_cert 3
294and finally encrypt the content encryption key using
295.Fn CMS_RecipientInfo_encrypt .
296.Sh RETURN VALUES
297.Fn CMS_get0_RecipientInfos
298returns all
299.Vt CMS_RecipientInfo
300structures, or
301.Dv NULL
302if 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 ,
309and
310.Fn CMS_RecipientInfo_encrypt
311return 1 for success or 0 if an error occurs.
312.Pp
313.Fn CMS_RecipientInfo_ktri_cert_cmp
314and
315.Fn CMS_RecipientInfo_kekri_id_cmp
316return 0 for a successful comparison or non-zero otherwise.
317.Pp
318Any error can be obtained from
319.Xr ERR_get_error 3 .
320.Sh SEE ALSO
321.Xr CMS_decrypt 3
322.Sh HISTORY
323These functions were first was added to OpenSSL 0.9.8.