summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/CMS_encrypt.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_encrypt.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_encrypt.3')
-rw-r--r--src/lib/libcrypto/man/CMS_encrypt.3190
1 files changed, 190 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/CMS_encrypt.3 b/src/lib/libcrypto/man/CMS_encrypt.3
new file mode 100644
index 0000000000..8550de2c9f
--- /dev/null
+++ b/src/lib/libcrypto/man/CMS_encrypt.3
@@ -0,0 +1,190 @@
1.\" $OpenBSD: CMS_encrypt.3,v 1.3 2019/08/10 23:41:22 schwarze Exp $
2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2008 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_ENCRYPT 3
53.Os
54.Sh NAME
55.Nm CMS_encrypt
56.Nd create a CMS envelopedData structure
57.Sh SYNOPSIS
58.In openssl/cms.h
59.Ft CMS_ContentInfo *
60.Fo CMS_encrypt
61.Fa "STACK_OF(X509) *certs"
62.Fa "BIO *in"
63.Fa "const EVP_CIPHER *cipher"
64.Fa "unsigned int flags"
65.Fc
66.Sh DESCRIPTION
67.Fn CMS_encrypt
68creates and returns a CMS EnvelopedData structure.
69.Fa certs
70is a list of recipient certificates.
71.Fa in
72is the content to be encrypted.
73.Fa cipher
74is the symmetric cipher to use.
75.Fa flags
76is an optional set of flags.
77.Pp
78Only certificates carrying RSA, Diffie-Hellman or EC keys are supported
79by this function.
80.Pp
81.Xr EVP_des_ede3_cbc 3
82(triple DES) is the algorithm of choice for S/MIME use because most
83clients will support it.
84.Pp
85The algorithm passed in the
86.Fa cipher
87parameter must support ASN1 encoding of its parameters.
88.Pp
89Many browsers implement a "sign and encrypt" option which is simply an
90S/MIME envelopedData containing an S/MIME signed message.
91This can be readily produced by storing the S/MIME signed message in a
92memory BIO and passing it to
93.Fn CMS_encrypt .
94.Pp
95The following flags can be passed in the
96.Fa flags
97parameter:
98.Bl -tag -width Ds
99.It Dv CMS_TEXT
100MIME headers for type text/plain are prepended to the data.
101.It Dv CMS_BINARY
102Do not translate the supplied content into MIME canonical format
103even though that is required by the S/MIME specifications.
104This option should be used if the supplied data is in binary format.
105Otherwise, the translation will corrupt it.
106If
107.Dv CMS_BINARY
108is set, then
109.Dv CMS_TEXT
110is ignored.
111.It Dv CMS_USE_KEYID
112Use the subject key identifier value to identify recipient certificates.
113An error occurs if all recipient certificates do not have a subject key
114identifier extension.
115By default, issuer name and serial number are used instead.
116.It Dv CMS_STREAM
117Return a partial
118.Vt CMS_ContentInfo
119structure suitable for streaming I/O: no data is read from the BIO
120.Fa in .
121.It Dv CMS_PARTIAL
122Return a partial
123.Vt CMS_ContentInfo
124structure to which additional recipients and attributes can
125be added before finalization.
126.It Dv CMS_DETACHED
127Omit the data being encrypted from the
128.Vt CMS_ContentInfo
129structure.
130This is rarely used in practice and is not supported by
131.Xr SMIME_write_CMS 3 .
132.El
133.Pp
134If the flag
135.Dv CMS_STREAM
136is set, the returned
137.Vt CMS_ContentInfo
138structure is
139.Em not
140complete and outputting its contents via a function that does not
141properly finalize the
142.Vt CMS_ContentInfo
143structure will give unpredictable results.
144.Pp
145Several functions including
146.Xr SMIME_write_CMS 3 ,
147.Xr i2d_CMS_bio_stream 3 ,
148.Xr PEM_write_bio_CMS_stream 3
149finalize the structure.
150Alternatively finalization can be performed by obtaining the streaming
151ASN1
152.Vt BIO
153directly using
154.Xr BIO_new_CMS 3 .
155.Pp
156The recipients specified in
157.Fa certs
158use a CMS KeyTransRecipientInfo info structure.
159KEKRecipientInfo is also supported using the flag
160.Dv CMS_PARTIAL
161and
162.Xr CMS_add0_recipient_key 3 .
163.Pp
164The parameter
165.Fa certs
166may be
167.Dv NULL
168if
169.Dv CMS_PARTIAL
170is set and recipients are added later using
171.Xr CMS_add1_recipient_cert 3
172or
173.Xr CMS_add0_recipient_key 3 .
174.Sh RETURN VALUES
175.Fn CMS_encrypt
176returns either a
177.Vt CMS_ContentInfo
178structure or
179.Dv NULL
180if an error occurred.
181The error can be obtained from
182.Xr ERR_get_error 3 .
183.Sh SEE ALSO
184.Xr CMS_decrypt 3
185.Sh HISTORY
186.Fn CMS_encrypt
187was added to OpenSSL 0.9.8.
188The
189.Sy CMS_STREAM
190flag was first supported in OpenSSL 1.0.0.