diff options
author | schwarze <> | 2019-08-14 11:54:23 +0000 |
---|---|---|
committer | schwarze <> | 2019-08-14 11:54:23 +0000 |
commit | b84b9ff13dbb36521ab47cfe589e485d1ecd94d3 (patch) | |
tree | 02da4f589a91d905d291985c7a71d789fca4bb47 /src | |
parent | 8ad58c7f842195e4d0a8cacccf8ae561aeed3a62 (diff) | |
download | openbsd-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.3 | 154 |
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 | |||
78 | using message digest | 95 | using message digest |
79 | .Fa md | 96 | .Fa md |
80 | to the | 97 | to the |
81 | .Vt CMS_ContentInfo | 98 | .Fa signerInfos |
82 | SignedData structure | 99 | field of the |
83 | .Fa cms . | 100 | .Vt SignedData |
84 | .Pp | 101 | structure |
85 | The | 102 | .Fa cms , |
86 | .Vt CMS_ContentInfo | 103 | which should have been obtained from an initial call to |
87 | structure should be obtained from an initial call to | ||
88 | .Xr CMS_sign 3 | 104 | .Xr CMS_sign 3 |
89 | with the flag | 105 | with the flag |
90 | .Dv CMS_PARTIAL | 106 | .Dv CMS_PARTIAL |
91 | set or in the case or re-signing a valid | 107 | set, or which can be a valid |
92 | .Vt CMS_ContentInfo | 108 | .Vt SignedData |
93 | SignedData structure. | 109 | structure in the case of re-signing. |
94 | .Pp | 110 | .Pp |
95 | If the | 111 | If |
96 | .Fa md | 112 | .Fa md |
97 | parameter is | 113 | is |
98 | .Dv NULL , | 114 | .Dv NULL , |
99 | then the default digest for the public key algorithm will be used. | 115 | the default digest for the public key algorithm of |
116 | .Fa pkey | ||
117 | is used. | ||
100 | .Pp | 118 | .Pp |
101 | Unless the | 119 | Unless the |
102 | .Dv CMS_REUSE_DIGEST | 120 | .Dv CMS_REUSE_DIGEST |
103 | flag is set, the returned | 121 | flag is set, the |
104 | .Vt CMS_ContentInfo | 122 | .Fa cms |
105 | structure is not complete and must be finalized either by streaming | 123 | structure 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 |
109 | The | ||
110 | .Fn CMS_SignerInfo_sign | ||
111 | function will explicitly sign a | ||
112 | .Vt CMS_SignerInfo | ||
113 | structure. | ||
114 | Its main use is when the | ||
115 | .Dv CMS_REUSE_DIGEST | ||
116 | and | ||
117 | .Dv CMS_PARTIAL | ||
118 | flags are both set. | ||
119 | .Pp | ||
120 | The main purpose of | 127 | The main purpose of |
121 | .Fn CMS_add1_signer | 128 | .Fn CMS_add1_signer |
122 | is to provide finer control over a CMS signed data structure where the | 129 | is to provide finer control over a CMS |
123 | simpler | 130 | .Vt SignedData |
131 | structure where the simpler | ||
124 | .Xr CMS_sign 3 | 132 | .Xr CMS_sign 3 |
125 | function defaults are not appropriate, for example if multiple signers | 133 | function defaults are not appropriate, for example if multiple signers |
126 | or non default digest algorithms are needed. | 134 | or non default digest algorithms are needed. |
@@ -134,39 +142,50 @@ Any of the following flags (OR'ed together) can be passed in the | |||
134 | parameter: | 142 | parameter: |
135 | .Bl -tag -width Ds | 143 | .Bl -tag -width Ds |
136 | .It Dv CMS_REUSE_DIGEST | 144 | .It Dv CMS_REUSE_DIGEST |
137 | Attempt to copy the content digest value from the | 145 | Attempt to copy the content digest value from one of the existing |
138 | .Vt CMS_ContentInfo | 146 | .Vt CMS_SignerInfo |
139 | structure to add a signer to an existing structure. | 147 | structures in |
148 | .Fa cms | ||
149 | while adding another signer. | ||
140 | An error occurs if a matching digest value cannot be found to copy. | 150 | An error occurs if a matching digest value cannot be found to copy. |
141 | The returned | 151 | The |
142 | .Vt CMS_ContentInfo | 152 | .Fa cms |
143 | structure will be valid and finalized when this flag is set. | 153 | structure will be valid and finalized when this flag is set. |
144 | .It Dv CMS_PARTIAL | 154 | .It Dv CMS_PARTIAL |
145 | If this flag is set in addition to | 155 | If this flag is set in addition to |
146 | .Dv CMS_REUSE_DIGEST , | 156 | .Dv CMS_REUSE_DIGEST , |
147 | then the | 157 | the returned |
148 | .Vt CMS_SignerInfo | 158 | .Vt CMS_SignerInfo |
149 | structure will not be finalized so additional attributes can be added. | 159 | structure will not be finalized so additional attributes can be added. |
150 | In this case an explicit call to | 160 | In this case an explicit call to |
151 | .Fn CMS_SignerInfo_sign | 161 | .Fn CMS_SignerInfo_sign |
152 | is needed to finalize it. | 162 | is needed to finalize it. |
153 | .It Dv CMS_NOCERTS | 163 | .It Dv CMS_NOCERTS |
154 | Do not include the signer's certificate in the | 164 | Do not add the signer's certificate to the |
155 | .Vt CMS_ContentInfo | 165 | .Fa certificates |
156 | structure. | 166 | field of |
167 | .Fa cms . | ||
157 | The signer's certificate must still be supplied in the | 168 | The signer's certificate must still be supplied in the |
158 | .Fa signcert | 169 | .Fa signcert |
159 | parameter though. | 170 | parameter though. |
160 | This can reduce the size of the signature if the signer's certificate can | 171 | This flag can reduce the size of the signature if the signer's certificate can |
161 | be obtained by other means, for example from a previously signed message. | 172 | be obtained by other means, for example from a previously signed message. |
162 | .Pp | ||
163 | The SignedData structure includes several CMS signedAttributes including | ||
164 | the signing time, the CMS content type and the supported list of ciphers | ||
165 | in an SMIMECapabilities attribute. | ||
166 | .It Dv CMS_NOATTR | 173 | .It Dv CMS_NOATTR |
167 | Use no signedAttributes. | 174 | Leave the |
175 | .Fa signedAttrs | ||
176 | field of the returned | ||
177 | .Vt CMS_SignedData | ||
178 | structure empty. | ||
179 | By default, several CMS | ||
180 | .Vt SignedAttributes | ||
181 | are added, including the signing time, the CMS content type, | ||
182 | and the supported list of ciphers in an | ||
183 | .Vt SMIMECapabilities | ||
184 | attribute. | ||
168 | .It Dv CMS_NOSMIMECAP | 185 | .It Dv CMS_NOSMIMECAP |
169 | Omit just the SMIMECapabilities. | 186 | Omit just the |
187 | .Vt SMIMECapabilities | ||
188 | attribute. | ||
170 | .It Dv CMS_USE_KEYID | 189 | .It Dv CMS_USE_KEYID |
171 | Use the subject key identifier value to identify signing certificates. | 190 | Use the subject key identifier value to identify signing certificates. |
172 | An error occurs if the signing certificate does not have a subject key | 191 | An error occurs if the signing certificate does not have a subject key |
@@ -174,22 +193,30 @@ identifier extension. | |||
174 | By default, issuer name and serial number are used instead. | 193 | By default, issuer name and serial number are used instead. |
175 | .El | 194 | .El |
176 | .Pp | 195 | .Pp |
177 | If present, the SMIMECapabilities attribute indicates support for the | 196 | If present, the |
197 | .Vt SMIMECapabilities | ||
198 | attribute indicates support for the | ||
178 | following algorithms in preference order: 256 bit AES, Gost R3411-94, | 199 | following algorithms in preference order: 256 bit AES, Gost R3411-94, |
179 | Gost 28147-89, 192 bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit | 200 | Gost 28147-89, 192 bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit |
180 | RC2, DES and 40 bit RC2. | 201 | RC2, DES and 40 bit RC2. |
181 | If any of these algorithms is not available then it will not be | 202 | If any of these algorithms is not available then it will not be |
182 | included: for example the GOST algorithms will not be included if | 203 | included. |
183 | the GOST ENGINE is not loaded. | ||
184 | .Pp | 204 | .Pp |
205 | The | ||
206 | .Fn CMS_SignerInfo_sign | ||
207 | function explicitly signs | ||
208 | .Fa si . | ||
209 | Its main use is when the | ||
210 | .Dv CMS_REUSE_DIGEST | ||
211 | and | ||
212 | .Dv CMS_PARTIAL | ||
213 | flags were both set in the call to | ||
185 | .Fn CMS_add1_signer | 214 | .Fn CMS_add1_signer |
186 | returns an internal pointer to the | 215 | that created |
187 | .Vt CMS_SignerInfo | 216 | .Fa si . |
188 | structure just added. | ||
189 | This 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 |
192 | returns an internal pointer to the | 219 | returns an internal pointer to the new |
193 | .Vt CMS_SignerInfo | 220 | .Vt CMS_SignerInfo |
194 | structure just added or | 221 | structure 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 | ||
229 | RFC 5652: Cryptographic Message Syntax, section 5.1: SignedData Type | ||
230 | .Pp | ||
231 | RFC 8551: Secure/Multipurpose Internet Mail Extensions (S/MIME) | ||
232 | Version\ 4.0 Message Specification | ||
233 | .Bl -dash -compact -offset indent | ||
234 | .It | ||
235 | section 2.5: Attributes and the SignerInfo Type | ||
236 | .It | ||
237 | section 2.5.2: SMIMECapabilities Attribute | ||
238 | .El | ||
201 | .Sh HISTORY | 239 | .Sh HISTORY |
202 | .Fn CMS_add1_signer | 240 | .Fn CMS_add1_signer |
203 | and | 241 | and |