summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2019-08-14 11:54:23 +0000
committerschwarze <>2019-08-14 11:54:23 +0000
commitb84b9ff13dbb36521ab47cfe589e485d1ecd94d3 (patch)
tree02da4f589a91d905d291985c7a71d789fca4bb47 /src
parent8ad58c7f842195e4d0a8cacccf8ae561aeed3a62 (diff)
downloadopenbsd-b84b9ff13dbb36521ab47cfe589e485d1ecd94d3.tar.gz
openbsd-b84b9ff13dbb36521ab47cfe589e485d1ecd94d3.tar.bz2
openbsd-b84b9ff13dbb36521ab47cfe589e485d1ecd94d3.zip
some cleanup:
* avoid repetitions and jumping back and forth between the functions * more precision regarding which ASN.1 types and fields are involved * mark up the ASN.1 type and field names * explain CMS_REUSE_DIGEST more precisely * move the discussion of attributes to CMS_NOATTR where it belongs * GOST does not need an ENGINE in LibreSSL, so don't use it as an example * add the missing STANDARDS section * and minor wording improvements
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/CMS_add1_signer.3154
1 files changed, 96 insertions, 58 deletions
diff --git a/src/lib/libcrypto/man/CMS_add1_signer.3 b/src/lib/libcrypto/man/CMS_add1_signer.3
index 8f08dac6d6..ea7d0a6dc3 100644
--- a/src/lib/libcrypto/man/CMS_add1_signer.3
+++ b/src/lib/libcrypto/man/CMS_add1_signer.3
@@ -1,7 +1,24 @@
1.\" $OpenBSD: CMS_add1_signer.3,v 1.4 2019/08/11 12:46:38 schwarze Exp $ 1.\" $OpenBSD: CMS_add1_signer.3,v 1.5 2019/08/14 11:54:23 schwarze Exp $
2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100 2.\" full merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
8.\"
9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
21.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2008 The OpenSSL Project. All rights reserved. 22.\" Copyright (c) 2008 The OpenSSL Project. All rights reserved.
6.\" 23.\"
7.\" Redistribution and use in source and binary forms, with or without 24.\" Redistribution and use in source and binary forms, with or without
@@ -48,13 +65,13 @@
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 67.\"
51.Dd $Mdocdate: August 11 2019 $ 68.Dd $Mdocdate: August 14 2019 $
52.Dt CMS_ADD1_SIGNER 3 69.Dt CMS_ADD1_SIGNER 3
53.Os 70.Os
54.Sh NAME 71.Sh NAME
55.Nm CMS_add1_signer , 72.Nm CMS_add1_signer ,
56.Nm CMS_SignerInfo_sign 73.Nm CMS_SignerInfo_sign
57.Nd add a signer to a CMS_ContentInfo signed data structure 74.Nd add a signer to a CMS SignedData structure
58.Sh SYNOPSIS 75.Sh SYNOPSIS
59.In openssl/cms.h 76.In openssl/cms.h
60.Ft CMS_SignerInfo * 77.Ft CMS_SignerInfo *
@@ -78,49 +95,40 @@ and private key
78using message digest 95using message digest
79.Fa md 96.Fa md
80to the 97to the
81.Vt CMS_ContentInfo 98.Fa signerInfos
82SignedData structure 99field of the
83.Fa cms . 100.Vt SignedData
84.Pp 101structure
85The 102.Fa cms ,
86.Vt CMS_ContentInfo 103which should have been obtained from an initial call to
87structure should be obtained from an initial call to
88.Xr CMS_sign 3 104.Xr CMS_sign 3
89with the flag 105with the flag
90.Dv CMS_PARTIAL 106.Dv CMS_PARTIAL
91set or in the case or re-signing a valid 107set, or which can be a valid
92.Vt CMS_ContentInfo 108.Vt SignedData
93SignedData structure. 109structure in the case of re-signing.
94.Pp 110.Pp
95If the 111If
96.Fa md 112.Fa md
97parameter is 113is
98.Dv NULL , 114.Dv NULL ,
99then the default digest for the public key algorithm will be used. 115the default digest for the public key algorithm of
116.Fa pkey
117is used.
100.Pp 118.Pp
101Unless the 119Unless the
102.Dv CMS_REUSE_DIGEST 120.Dv CMS_REUSE_DIGEST
103flag is set, the returned 121flag is set, the
104.Vt CMS_ContentInfo 122.Fa cms
105structure is not complete and must be finalized either by streaming 123structure remains incomplete and must be finalized either by streaming
106(if applicable) or a call to 124(if applicable) or by a call to
107.Xr CMS_final 3 . 125.Xr CMS_final 3 .
108.Pp 126.Pp
109The
110.Fn CMS_SignerInfo_sign
111function will explicitly sign a
112.Vt CMS_SignerInfo
113structure.
114Its main use is when the
115.Dv CMS_REUSE_DIGEST
116and
117.Dv CMS_PARTIAL
118flags are both set.
119.Pp
120The main purpose of 127The main purpose of
121.Fn CMS_add1_signer 128.Fn CMS_add1_signer
122is to provide finer control over a CMS signed data structure where the 129is to provide finer control over a CMS
123simpler 130.Vt SignedData
131structure where the simpler
124.Xr CMS_sign 3 132.Xr CMS_sign 3
125function defaults are not appropriate, for example if multiple signers 133function defaults are not appropriate, for example if multiple signers
126or non default digest algorithms are needed. 134or non default digest algorithms are needed.
@@ -134,39 +142,50 @@ Any of the following flags (OR'ed together) can be passed in the
134parameter: 142parameter:
135.Bl -tag -width Ds 143.Bl -tag -width Ds
136.It Dv CMS_REUSE_DIGEST 144.It Dv CMS_REUSE_DIGEST
137Attempt to copy the content digest value from the 145Attempt to copy the content digest value from one of the existing
138.Vt CMS_ContentInfo 146.Vt CMS_SignerInfo
139structure to add a signer to an existing structure. 147structures in
148.Fa cms
149while adding another signer.
140An error occurs if a matching digest value cannot be found to copy. 150An error occurs if a matching digest value cannot be found to copy.
141The returned 151The
142.Vt CMS_ContentInfo 152.Fa cms
143structure will be valid and finalized when this flag is set. 153structure will be valid and finalized when this flag is set.
144.It Dv CMS_PARTIAL 154.It Dv CMS_PARTIAL
145If this flag is set in addition to 155If this flag is set in addition to
146.Dv CMS_REUSE_DIGEST , 156.Dv CMS_REUSE_DIGEST ,
147then the 157the returned
148.Vt CMS_SignerInfo 158.Vt CMS_SignerInfo
149structure will not be finalized so additional attributes can be added. 159structure will not be finalized so additional attributes can be added.
150In this case an explicit call to 160In this case an explicit call to
151.Fn CMS_SignerInfo_sign 161.Fn CMS_SignerInfo_sign
152is needed to finalize it. 162is needed to finalize it.
153.It Dv CMS_NOCERTS 163.It Dv CMS_NOCERTS
154Do not include the signer's certificate in the 164Do not add the signer's certificate to the
155.Vt CMS_ContentInfo 165.Fa certificates
156structure. 166field of
167.Fa cms .
157The signer's certificate must still be supplied in the 168The signer's certificate must still be supplied in the
158.Fa signcert 169.Fa signcert
159parameter though. 170parameter though.
160This can reduce the size of the signature if the signer's certificate can 171This flag can reduce the size of the signature if the signer's certificate can
161be obtained by other means, for example from a previously signed message. 172be obtained by other means, for example from a previously signed message.
162.Pp
163The SignedData structure includes several CMS signedAttributes including
164the signing time, the CMS content type and the supported list of ciphers
165in an SMIMECapabilities attribute.
166.It Dv CMS_NOATTR 173.It Dv CMS_NOATTR
167Use no signedAttributes. 174Leave the
175.Fa signedAttrs
176field of the returned
177.Vt CMS_SignedData
178structure empty.
179By default, several CMS
180.Vt SignedAttributes
181are added, including the signing time, the CMS content type,
182and the supported list of ciphers in an
183.Vt SMIMECapabilities
184attribute.
168.It Dv CMS_NOSMIMECAP 185.It Dv CMS_NOSMIMECAP
169Omit just the SMIMECapabilities. 186Omit just the
187.Vt SMIMECapabilities
188attribute.
170.It Dv CMS_USE_KEYID 189.It Dv CMS_USE_KEYID
171Use the subject key identifier value to identify signing certificates. 190Use the subject key identifier value to identify signing certificates.
172An error occurs if the signing certificate does not have a subject key 191An error occurs if the signing certificate does not have a subject key
@@ -174,22 +193,30 @@ identifier extension.
174By default, issuer name and serial number are used instead. 193By default, issuer name and serial number are used instead.
175.El 194.El
176.Pp 195.Pp
177If present, the SMIMECapabilities attribute indicates support for the 196If present, the
197.Vt SMIMECapabilities
198attribute indicates support for the
178following algorithms in preference order: 256 bit AES, Gost R3411-94, 199following algorithms in preference order: 256 bit AES, Gost R3411-94,
179Gost 28147-89, 192 bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit 200Gost 28147-89, 192 bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit
180RC2, DES and 40 bit RC2. 201RC2, DES and 40 bit RC2.
181If any of these algorithms is not available then it will not be 202If any of these algorithms is not available then it will not be
182included: for example the GOST algorithms will not be included if 203included.
183the GOST ENGINE is not loaded.
184.Pp 204.Pp
205The
206.Fn CMS_SignerInfo_sign
207function explicitly signs
208.Fa si .
209Its main use is when the
210.Dv CMS_REUSE_DIGEST
211and
212.Dv CMS_PARTIAL
213flags were both set in the call to
185.Fn CMS_add1_signer 214.Fn CMS_add1_signer
186returns an internal pointer to the 215that created
187.Vt CMS_SignerInfo 216.Fa si .
188structure just added.
189This can be used to set additional attributes before it is finalized.
190.Sh RETURN VALUES 217.Sh RETURN VALUES
191.Fn CMS_add1_signer 218.Fn CMS_add1_signer
192returns an internal pointer to the 219returns an internal pointer to the new
193.Vt CMS_SignerInfo 220.Vt CMS_SignerInfo
194structure just added or 221structure just added or
195.Dv NULL 222.Dv NULL
@@ -198,6 +225,17 @@ if an error occurs.
198.Xr CMS_final 3 , 225.Xr CMS_final 3 ,
199.Xr CMS_sign 3 , 226.Xr CMS_sign 3 ,
200.Xr ERR_get_error 3 227.Xr ERR_get_error 3
228.Sh STANDARDS
229RFC 5652: Cryptographic Message Syntax, section 5.1: SignedData Type
230.Pp
231RFC 8551: Secure/Multipurpose Internet Mail Extensions (S/MIME)
232Version\ 4.0 Message Specification
233.Bl -dash -compact -offset indent
234.It
235section 2.5: Attributes and the SignerInfo Type
236.It
237section 2.5.2: SMIMECapabilities Attribute
238.El
201.Sh HISTORY 239.Sh HISTORY
202.Fn CMS_add1_signer 240.Fn CMS_add1_signer
203and 241and