summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2019-08-16 11:30:10 +0000
committerschwarze <>2019-08-16 11:30:10 +0000
commit2689deb74232c3d5105b5de453a3de406492b64e (patch)
tree4a42df9c2c967617bfed9c02c9624b423c03a653 /src
parent4d9367cba4d94dd4f933a1373ac19ff18ae788fb (diff)
downloadopenbsd-2689deb74232c3d5105b5de453a3de406492b64e.tar.gz
openbsd-2689deb74232c3d5105b5de453a3de406492b64e.tar.bz2
openbsd-2689deb74232c3d5105b5de453a3de406492b64e.zip
some cleanup:
* do not jump back and forth among different arguments and flags * add the missing STANDARDS section * mark up ASN.1 type names * and several wording improvements
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/CMS_encrypt.3115
1 files changed, 55 insertions, 60 deletions
diff --git a/src/lib/libcrypto/man/CMS_encrypt.3 b/src/lib/libcrypto/man/CMS_encrypt.3
index a2e6b837ac..884615e06b 100644
--- a/src/lib/libcrypto/man/CMS_encrypt.3
+++ b/src/lib/libcrypto/man/CMS_encrypt.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: CMS_encrypt.3,v 1.4 2019/08/11 12:46:38 schwarze Exp $ 1.\" $OpenBSD: CMS_encrypt.3,v 1.5 2019/08/16 11:30:10 schwarze Exp $
2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100 2.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
@@ -48,46 +48,59 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 50.\"
51.Dd $Mdocdate: August 11 2019 $ 51.Dd $Mdocdate: August 16 2019 $
52.Dt CMS_ENCRYPT 3 52.Dt CMS_ENCRYPT 3
53.Os 53.Os
54.Sh NAME 54.Sh NAME
55.Nm CMS_encrypt 55.Nm CMS_encrypt
56.Nd create a CMS envelopedData structure 56.Nd create a CMS EnvelopedData structure
57.Sh SYNOPSIS 57.Sh SYNOPSIS
58.In openssl/cms.h 58.In openssl/cms.h
59.Ft CMS_ContentInfo * 59.Ft CMS_ContentInfo *
60.Fo CMS_encrypt 60.Fo CMS_encrypt
61.Fa "STACK_OF(X509) *certs" 61.Fa "STACK_OF(X509) *certificates"
62.Fa "BIO *in" 62.Fa "BIO *in"
63.Fa "const EVP_CIPHER *cipher" 63.Fa "const EVP_CIPHER *cipher"
64.Fa "unsigned int flags" 64.Fa "unsigned int flags"
65.Fc 65.Fc
66.Sh DESCRIPTION 66.Sh DESCRIPTION
67.Fn CMS_encrypt 67.Fn CMS_encrypt
68creates and returns a CMS EnvelopedData structure. 68creates a CMS
69.Fa certs 69.Vt EnvelopedData
70is a list of recipient certificates. 70structure, encrypting the content provided by
71.Fa in 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 72.Pp
73The recipient
74.Fa certificates
75are added as
76.Vt KeyTransRecipientInfo
77structures by calling the function
78.Xr CMS_add1_recipient_cert 3
79internally.
78Only certificates carrying RSA, Diffie-Hellman or EC keys are supported 80Only certificates carrying RSA, Diffie-Hellman or EC keys are supported
79by this function. 81by this function.
82The
83.Fa certificates
84argument can be set to
85.Dv NULL
86if the
87.Dv CMS_PARTIAL
88flag is set and recipients are added later using
89.Xr CMS_add1_recipient_cert 3
90or
91.Xr CMS_add0_recipient_key 3 .
80.Pp 92.Pp
93.Fa cipher
94is the symmetric cipher to use.
95It must support ASN.1 encoding of its parameters.
81.Xr EVP_des_ede3_cbc 3 96.Xr EVP_des_ede3_cbc 3
82(triple DES) is the algorithm of choice for S/MIME use because most 97(triple DES) is the algorithm of choice for S/MIME use because most
83clients will support it. 98clients support it.
84.Pp
85The algorithm passed in the
86.Fa cipher
87parameter must support ASN1 encoding of its parameters.
88.Pp 99.Pp
89Many browsers implement a "sign and encrypt" option which is simply an 100Many browsers implement a "sign and encrypt" option which is simply an
90S/MIME envelopedData containing an S/MIME signed message. 101S/MIME
102.Vt EnvelopedData
103containing an S/MIME signed message.
91This can be readily produced by storing the S/MIME signed message in a 104This can be readily produced by storing the S/MIME signed message in a
92memory BIO and passing it to 105memory BIO and passing it to
93.Fn CMS_encrypt . 106.Fn CMS_encrypt .
@@ -118,6 +131,21 @@ Return a partial
118.Vt CMS_ContentInfo 131.Vt CMS_ContentInfo
119structure suitable for streaming I/O: no data is read from the BIO 132structure suitable for streaming I/O: no data is read from the BIO
120.Fa in . 133.Fa in .
134Several functions including
135.Xr SMIME_write_CMS 3 ,
136.Xr i2d_CMS_bio_stream 3 ,
137or
138.Xr PEM_write_bio_CMS_stream 3
139can be used to finalize the structure.
140Alternatively, finalization can be performed by obtaining the streaming
141ASN1
142.Vt BIO
143directly using
144.Xr BIO_new_CMS 3 .
145Outputting the content of the returned
146.Vt CMS_ContentInfo
147structure via a function that does not properly finalize it
148will give unpredictable results.
121.It Dv CMS_PARTIAL 149.It Dv CMS_PARTIAL
122Return a partial 150Return a partial
123.Vt CMS_ContentInfo 151.Vt CMS_ContentInfo
@@ -130,47 +158,6 @@ structure.
130This is rarely used in practice and is not supported by 158This is rarely used in practice and is not supported by
131.Xr SMIME_write_CMS 3 . 159.Xr SMIME_write_CMS 3 .
132.El 160.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 161.Sh RETURN VALUES
175.Fn CMS_encrypt 162.Fn CMS_encrypt
176returns either a 163returns either a
@@ -182,6 +169,14 @@ The error can be obtained from
182.Xr ERR_get_error 3 . 169.Xr ERR_get_error 3 .
183.Sh SEE ALSO 170.Sh SEE ALSO
184.Xr CMS_decrypt 3 171.Xr CMS_decrypt 3
172.Sh STANDARDS
173RFC 5652: Cryptographic Message Syntax (CMS)
174.Bl -dash -compact -offset indent
175.It
176section 6.1: EnvelopedData Type
177.It
178section 6.2.1: KeyTransRecipientInfo Type
179.El
185.Sh HISTORY 180.Sh HISTORY
186.Fn CMS_encrypt 181.Fn CMS_encrypt
187first appeared in OpenSSL 0.9.8h 182first appeared in OpenSSL 0.9.8h