]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/usr.bin/openssl/man/cms.1
MFC: r359486
[FreeBSD/FreeBSD.git] / secure / usr.bin / openssl / man / cms.1
1 .\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.40)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{\
60 .    if \nF \{\
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{\
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "CMS 1"
136 .TH CMS 1 "2020-03-31" "1.1.1f" "OpenSSL"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 openssl\-cms, cms \- CMS utility
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 \&\fBopenssl\fR \fBcms\fR
146 [\fB\-help\fR]
147 [\fB\-encrypt\fR]
148 [\fB\-decrypt\fR]
149 [\fB\-sign\fR]
150 [\fB\-verify\fR]
151 [\fB\-cmsout\fR]
152 [\fB\-resign\fR]
153 [\fB\-data_create\fR]
154 [\fB\-data_out\fR]
155 [\fB\-digest_create\fR]
156 [\fB\-digest_verify\fR]
157 [\fB\-compress\fR]
158 [\fB\-uncompress\fR]
159 [\fB\-EncryptedData_encrypt\fR]
160 [\fB\-sign_receipt\fR]
161 [\fB\-verify_receipt receipt\fR]
162 [\fB\-in filename\fR]
163 [\fB\-inform SMIME|PEM|DER\fR]
164 [\fB\-rctform SMIME|PEM|DER\fR]
165 [\fB\-out filename\fR]
166 [\fB\-outform SMIME|PEM|DER\fR]
167 [\fB\-stream \-indef \-noindef\fR]
168 [\fB\-noindef\fR]
169 [\fB\-content filename\fR]
170 [\fB\-text\fR]
171 [\fB\-noout\fR]
172 [\fB\-print\fR]
173 [\fB\-CAfile file\fR]
174 [\fB\-CApath dir\fR]
175 [\fB\-no\-CAfile\fR]
176 [\fB\-no\-CApath\fR]
177 [\fB\-attime timestamp\fR]
178 [\fB\-check_ss_sig\fR]
179 [\fB\-crl_check\fR]
180 [\fB\-crl_check_all\fR]
181 [\fB\-explicit_policy\fR]
182 [\fB\-extended_crl\fR]
183 [\fB\-ignore_critical\fR]
184 [\fB\-inhibit_any\fR]
185 [\fB\-inhibit_map\fR]
186 [\fB\-no_check_time\fR]
187 [\fB\-partial_chain\fR]
188 [\fB\-policy arg\fR]
189 [\fB\-policy_check\fR]
190 [\fB\-policy_print\fR]
191 [\fB\-purpose purpose\fR]
192 [\fB\-suiteB_128\fR]
193 [\fB\-suiteB_128_only\fR]
194 [\fB\-suiteB_192\fR]
195 [\fB\-trusted_first\fR]
196 [\fB\-no_alt_chains\fR]
197 [\fB\-use_deltas\fR]
198 [\fB\-auth_level num\fR]
199 [\fB\-verify_depth num\fR]
200 [\fB\-verify_email email\fR]
201 [\fB\-verify_hostname hostname\fR]
202 [\fB\-verify_ip ip\fR]
203 [\fB\-verify_name name\fR]
204 [\fB\-x509_strict\fR]
205 [\fB\-md digest\fR]
206 [\fB\-\f(BIcipher\fB\fR]
207 [\fB\-nointern\fR]
208 [\fB\-noverify\fR]
209 [\fB\-nocerts\fR]
210 [\fB\-noattr\fR]
211 [\fB\-nosmimecap\fR]
212 [\fB\-binary\fR]
213 [\fB\-crlfeol\fR]
214 [\fB\-asciicrlf\fR]
215 [\fB\-nodetach\fR]
216 [\fB\-certfile file\fR]
217 [\fB\-certsout file\fR]
218 [\fB\-signer file\fR]
219 [\fB\-recip file\fR]
220 [\fB\-keyid\fR]
221 [\fB\-receipt_request_all\fR]
222 [\fB\-receipt_request_first\fR]
223 [\fB\-receipt_request_from emailaddress\fR]
224 [\fB\-receipt_request_to emailaddress\fR]
225 [\fB\-receipt_request_print\fR]
226 [\fB\-secretkey key\fR]
227 [\fB\-secretkeyid id\fR]
228 [\fB\-econtent_type type\fR]
229 [\fB\-inkey file\fR]
230 [\fB\-keyopt name:parameter\fR]
231 [\fB\-passin arg\fR]
232 [\fB\-rand file...\fR]
233 [\fB\-writerand file\fR]
234 [\fBcert.pem...\fR]
235 [\fB\-to addr\fR]
236 [\fB\-from addr\fR]
237 [\fB\-subject subj\fR]
238 [cert.pem]...
239 .SH "DESCRIPTION"
240 .IX Header "DESCRIPTION"
241 The \fBcms\fR command handles S/MIME v3.1 mail. It can encrypt, decrypt, sign and
242 verify, compress and uncompress S/MIME messages.
243 .SH "OPTIONS"
244 .IX Header "OPTIONS"
245 There are fourteen operation options that set the type of operation to be
246 performed. The meaning of the other options varies according to the operation
247 type.
248 .IP "\fB\-help\fR" 4
249 .IX Item "-help"
250 Print out a usage message.
251 .IP "\fB\-encrypt\fR" 4
252 .IX Item "-encrypt"
253 Encrypt mail for the given recipient certificates. Input file is the message
254 to be encrypted. The output file is the encrypted mail in \s-1MIME\s0 format. The
255 actual \s-1CMS\s0 type is <B>EnvelopedData<B>.
256 .Sp
257 Note that no revocation check is done for the recipient cert, so if that
258 key has been compromised, others may be able to decrypt the text.
259 .IP "\fB\-decrypt\fR" 4
260 .IX Item "-decrypt"
261 Decrypt mail using the supplied certificate and private key. Expects an
262 encrypted mail message in \s-1MIME\s0 format for the input file. The decrypted mail
263 is written to the output file.
264 .IP "\fB\-debug_decrypt\fR" 4
265 .IX Item "-debug_decrypt"
266 This option sets the \fB\s-1CMS_DEBUG_DECRYPT\s0\fR flag. This option should be used
267 with caution: see the notes section below.
268 .IP "\fB\-sign\fR" 4
269 .IX Item "-sign"
270 Sign mail using the supplied certificate and private key. Input file is
271 the message to be signed. The signed message in \s-1MIME\s0 format is written
272 to the output file.
273 .IP "\fB\-verify\fR" 4
274 .IX Item "-verify"
275 Verify signed mail. Expects a signed mail message on input and outputs
276 the signed data. Both clear text and opaque signing is supported.
277 .IP "\fB\-cmsout\fR" 4
278 .IX Item "-cmsout"
279 Takes an input message and writes out a \s-1PEM\s0 encoded \s-1CMS\s0 structure.
280 .IP "\fB\-resign\fR" 4
281 .IX Item "-resign"
282 Resign a message: take an existing message and one or more new signers.
283 .IP "\fB\-data_create\fR" 4
284 .IX Item "-data_create"
285 Create a \s-1CMS\s0 \fBData\fR type.
286 .IP "\fB\-data_out\fR" 4
287 .IX Item "-data_out"
288 \&\fBData\fR type and output the content.
289 .IP "\fB\-digest_create\fR" 4
290 .IX Item "-digest_create"
291 Create a \s-1CMS\s0 \fBDigestedData\fR type.
292 .IP "\fB\-digest_verify\fR" 4
293 .IX Item "-digest_verify"
294 Verify a \s-1CMS\s0 \fBDigestedData\fR type and output the content.
295 .IP "\fB\-compress\fR" 4
296 .IX Item "-compress"
297 Create a \s-1CMS\s0 \fBCompressedData\fR type. OpenSSL must be compiled with \fBzlib\fR
298 support for this option to work, otherwise it will output an error.
299 .IP "\fB\-uncompress\fR" 4
300 .IX Item "-uncompress"
301 Uncompress a \s-1CMS\s0 \fBCompressedData\fR type and output the content. OpenSSL must be
302 compiled with \fBzlib\fR support for this option to work, otherwise it will
303 output an error.
304 .IP "\fB\-EncryptedData_encrypt\fR" 4
305 .IX Item "-EncryptedData_encrypt"
306 Encrypt content using supplied symmetric key and algorithm using a \s-1CMS\s0
307 \&\fBEncryptedData\fR type and output the content.
308 .IP "\fB\-sign_receipt\fR" 4
309 .IX Item "-sign_receipt"
310 Generate and output a signed receipt for the supplied message. The input
311 message \fBmust\fR contain a signed receipt request. Functionality is otherwise
312 similar to the \fB\-sign\fR operation.
313 .IP "\fB\-verify_receipt receipt\fR" 4
314 .IX Item "-verify_receipt receipt"
315 Verify a signed receipt in filename \fBreceipt\fR. The input message \fBmust\fR
316 contain the original receipt request. Functionality is otherwise similar
317 to the \fB\-verify\fR operation.
318 .IP "\fB\-in filename\fR" 4
319 .IX Item "-in filename"
320 The input message to be encrypted or signed or the message to be decrypted
321 or verified.
322 .IP "\fB\-inform SMIME|PEM|DER\fR" 4
323 .IX Item "-inform SMIME|PEM|DER"
324 This specifies the input format for the \s-1CMS\s0 structure. The default
325 is \fB\s-1SMIME\s0\fR which reads an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
326 format change this to expect \s-1PEM\s0 and \s-1DER\s0 format \s-1CMS\s0 structures
327 instead. This currently only affects the input format of the \s-1CMS\s0
328 structure, if no \s-1CMS\s0 structure is being input (for example with
329 \&\fB\-encrypt\fR or \fB\-sign\fR) this option has no effect.
330 .IP "\fB\-rctform SMIME|PEM|DER\fR" 4
331 .IX Item "-rctform SMIME|PEM|DER"
332 Specify the format for a signed receipt for use with the \fB\-receipt_verify\fR
333 operation.
334 .IP "\fB\-out filename\fR" 4
335 .IX Item "-out filename"
336 The message text that has been decrypted or verified or the output \s-1MIME\s0
337 format message that has been signed or verified.
338 .IP "\fB\-outform SMIME|PEM|DER\fR" 4
339 .IX Item "-outform SMIME|PEM|DER"
340 This specifies the output format for the \s-1CMS\s0 structure. The default
341 is \fB\s-1SMIME\s0\fR which writes an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
342 format change this to write \s-1PEM\s0 and \s-1DER\s0 format \s-1CMS\s0 structures
343 instead. This currently only affects the output format of the \s-1CMS\s0
344 structure, if no \s-1CMS\s0 structure is being output (for example with
345 \&\fB\-verify\fR or \fB\-decrypt\fR) this option has no effect.
346 .IP "\fB\-stream \-indef \-noindef\fR" 4
347 .IX Item "-stream -indef -noindef"
348 The \fB\-stream\fR and \fB\-indef\fR options are equivalent and enable streaming I/O
349 for encoding operations. This permits single pass processing of data without
350 the need to hold the entire contents in memory, potentially supporting very
351 large files. Streaming is automatically set for S/MIME signing with detached
352 data if the output format is \fB\s-1SMIME\s0\fR it is currently off by default for all
353 other operations.
354 .IP "\fB\-noindef\fR" 4
355 .IX Item "-noindef"
356 Disable streaming I/O where it would produce and indefinite length constructed
357 encoding. This option currently has no effect. In future streaming will be
358 enabled by default on all relevant operations and this option will disable it.
359 .IP "\fB\-content filename\fR" 4
360 .IX Item "-content filename"
361 This specifies a file containing the detached content, this is only
362 useful with the \fB\-verify\fR command. This is only usable if the \s-1CMS\s0
363 structure is using the detached signature form where the content is
364 not included. This option will override any content if the input format
365 is S/MIME and it uses the multipart/signed \s-1MIME\s0 content type.
366 .IP "\fB\-text\fR" 4
367 .IX Item "-text"
368 This option adds plain text (text/plain) \s-1MIME\s0 headers to the supplied
369 message if encrypting or signing. If decrypting or verifying it strips
370 off text headers: if the decrypted or verified message is not of \s-1MIME\s0
371 type text/plain then an error occurs.
372 .IP "\fB\-noout\fR" 4
373 .IX Item "-noout"
374 For the \fB\-cmsout\fR operation do not output the parsed \s-1CMS\s0 structure. This
375 is useful when combined with the \fB\-print\fR option or if the syntax of the \s-1CMS\s0
376 structure is being checked.
377 .IP "\fB\-print\fR" 4
378 .IX Item "-print"
379 For the \fB\-cmsout\fR operation print out all fields of the \s-1CMS\s0 structure. This
380 is mainly useful for testing purposes.
381 .IP "\fB\-CAfile file\fR" 4
382 .IX Item "-CAfile file"
383 A file containing trusted \s-1CA\s0 certificates, only used with \fB\-verify\fR.
384 .IP "\fB\-CApath dir\fR" 4
385 .IX Item "-CApath dir"
386 A directory containing trusted \s-1CA\s0 certificates, only used with
387 \&\fB\-verify\fR. This directory must be a standard certificate directory: that
388 is a hash of each subject name (using \fBx509 \-hash\fR) should be linked
389 to each certificate.
390 .IP "\fB\-no\-CAfile\fR" 4
391 .IX Item "-no-CAfile"
392 Do not load the trusted \s-1CA\s0 certificates from the default file location
393 .IP "\fB\-no\-CApath\fR" 4
394 .IX Item "-no-CApath"
395 Do not load the trusted \s-1CA\s0 certificates from the default directory location
396 .IP "\fB\-md digest\fR" 4
397 .IX Item "-md digest"
398 Digest algorithm to use when signing or resigning. If not present then the
399 default digest algorithm for the signing key will be used (usually \s-1SHA1\s0).
400 .IP "\fB\-\f(BIcipher\fB\fR" 4
401 .IX Item "-cipher"
402 The encryption algorithm to use. For example triple \s-1DES\s0 (168 bits) \- \fB\-des3\fR
403 or 256 bit \s-1AES\s0 \- \fB\-aes256\fR. Any standard algorithm name (as used by the
404 \&\fBEVP_get_cipherbyname()\fR function) can also be used preceded by a dash, for
405 example \fB\-aes\-128\-cbc\fR. See \fBenc\fR\|(1) for a list of ciphers
406 supported by your version of OpenSSL.
407 .Sp
408 If not specified triple \s-1DES\s0 is used. Only used with \fB\-encrypt\fR and
409 \&\fB\-EncryptedData_create\fR commands.
410 .IP "\fB\-nointern\fR" 4
411 .IX Item "-nointern"
412 When verifying a message normally certificates (if any) included in
413 the message are searched for the signing certificate. With this option
414 only the certificates specified in the \fB\-certfile\fR option are used.
415 The supplied certificates can still be used as untrusted CAs however.
416 .IP "\fB\-noverify\fR" 4
417 .IX Item "-noverify"
418 Do not verify the signers certificate of a signed message.
419 .IP "\fB\-nocerts\fR" 4
420 .IX Item "-nocerts"
421 When signing a message the signer's certificate is normally included
422 with this option it is excluded. This will reduce the size of the
423 signed message but the verifier must have a copy of the signers certificate
424 available locally (passed using the \fB\-certfile\fR option for example).
425 .IP "\fB\-noattr\fR" 4
426 .IX Item "-noattr"
427 Normally when a message is signed a set of attributes are included which
428 include the signing time and supported symmetric algorithms. With this
429 option they are not included.
430 .IP "\fB\-nosmimecap\fR" 4
431 .IX Item "-nosmimecap"
432 Exclude the list of supported algorithms from signed attributes, other options
433 such as signing time and content type are still included.
434 .IP "\fB\-binary\fR" 4
435 .IX Item "-binary"
436 Normally the input message is converted to \*(L"canonical\*(R" format which is
437 effectively using \s-1CR\s0 and \s-1LF\s0 as end of line: as required by the S/MIME
438 specification. When this option is present no translation occurs. This
439 is useful when handling binary data which may not be in \s-1MIME\s0 format.
440 .IP "\fB\-crlfeol\fR" 4
441 .IX Item "-crlfeol"
442 Normally the output file uses a single \fB\s-1LF\s0\fR as end of line. When this
443 option is present \fB\s-1CRLF\s0\fR is used instead.
444 .IP "\fB\-asciicrlf\fR" 4
445 .IX Item "-asciicrlf"
446 When signing use \s-1ASCII CRLF\s0 format canonicalisation. This strips trailing
447 whitespace from all lines, deletes trailing blank lines at \s-1EOF\s0 and sets
448 the encapsulated content type. This option is normally used with detached
449 content and an output signature format of \s-1DER.\s0 This option is not normally
450 needed when verifying as it is enabled automatically if the encapsulated
451 content format is detected.
452 .IP "\fB\-nodetach\fR" 4
453 .IX Item "-nodetach"
454 When signing a message use opaque signing: this form is more resistant
455 to translation by mail relays but it cannot be read by mail agents that
456 do not support S/MIME.  Without this option cleartext signing with
457 the \s-1MIME\s0 type multipart/signed is used.
458 .IP "\fB\-certfile file\fR" 4
459 .IX Item "-certfile file"
460 Allows additional certificates to be specified. When signing these will
461 be included with the message. When verifying these will be searched for
462 the signers certificates. The certificates should be in \s-1PEM\s0 format.
463 .IP "\fB\-certsout file\fR" 4
464 .IX Item "-certsout file"
465 Any certificates contained in the message are written to \fBfile\fR.
466 .IP "\fB\-signer file\fR" 4
467 .IX Item "-signer file"
468 A signing certificate when signing or resigning a message, this option can be
469 used multiple times if more than one signer is required. If a message is being
470 verified then the signers certificates will be written to this file if the
471 verification was successful.
472 .IP "\fB\-recip file\fR" 4
473 .IX Item "-recip file"
474 When decrypting a message this specifies the recipients certificate. The
475 certificate must match one of the recipients of the message or an error
476 occurs.
477 .Sp
478 When encrypting a message this option may be used multiple times to specify
479 each recipient. This form \fBmust\fR be used if customised parameters are
480 required (for example to specify RSA-OAEP).
481 .Sp
482 Only certificates carrying \s-1RSA,\s0 Diffie-Hellman or \s-1EC\s0 keys are supported by this
483 option.
484 .IP "\fB\-keyid\fR" 4
485 .IX Item "-keyid"
486 Use subject key identifier to identify certificates instead of issuer name and
487 serial number. The supplied certificate \fBmust\fR include a subject key
488 identifier extension. Supported by \fB\-sign\fR and \fB\-encrypt\fR options.
489 .IP "\fB\-receipt_request_all\fR, \fB\-receipt_request_first\fR" 4
490 .IX Item "-receipt_request_all, -receipt_request_first"
491 For \fB\-sign\fR option include a signed receipt request. Indicate requests should
492 be provided by all recipient or first tier recipients (those mailed directly
493 and not from a mailing list). Ignored it \fB\-receipt_request_from\fR is included.
494 .IP "\fB\-receipt_request_from emailaddress\fR" 4
495 .IX Item "-receipt_request_from emailaddress"
496 For \fB\-sign\fR option include a signed receipt request. Add an explicit email
497 address where receipts should be supplied.
498 .IP "\fB\-receipt_request_to emailaddress\fR" 4
499 .IX Item "-receipt_request_to emailaddress"
500 Add an explicit email address where signed receipts should be sent to. This
501 option \fBmust\fR but supplied if a signed receipt it requested.
502 .IP "\fB\-receipt_request_print\fR" 4
503 .IX Item "-receipt_request_print"
504 For the \fB\-verify\fR operation print out the contents of any signed receipt
505 requests.
506 .IP "\fB\-secretkey key\fR" 4
507 .IX Item "-secretkey key"
508 Specify symmetric key to use. The key must be supplied in hex format and be
509 consistent with the algorithm used. Supported by the \fB\-EncryptedData_encrypt\fR
510 \&\fB\-EncryptedData_decrypt\fR, \fB\-encrypt\fR and \fB\-decrypt\fR options. When used
511 with \fB\-encrypt\fR or \fB\-decrypt\fR the supplied key is used to wrap or unwrap the
512 content encryption key using an \s-1AES\s0 key in the \fBKEKRecipientInfo\fR type.
513 .IP "\fB\-secretkeyid id\fR" 4
514 .IX Item "-secretkeyid id"
515 The key identifier for the supplied symmetric key for \fBKEKRecipientInfo\fR type.
516 This option \fBmust\fR be present if the \fB\-secretkey\fR option is used with
517 \&\fB\-encrypt\fR. With \fB\-decrypt\fR operations the \fBid\fR is used to locate the
518 relevant key if it is not supplied then an attempt is used to decrypt any
519 \&\fBKEKRecipientInfo\fR structures.
520 .IP "\fB\-econtent_type type\fR" 4
521 .IX Item "-econtent_type type"
522 Set the encapsulated content type to \fBtype\fR if not supplied the \fBData\fR type
523 is used. The \fBtype\fR argument can be any valid \s-1OID\s0 name in either text or
524 numerical format.
525 .IP "\fB\-inkey file\fR" 4
526 .IX Item "-inkey file"
527 The private key to use when signing or decrypting. This must match the
528 corresponding certificate. If this option is not specified then the
529 private key must be included in the certificate file specified with
530 the \fB\-recip\fR or \fB\-signer\fR file. When signing this option can be used
531 multiple times to specify successive keys.
532 .IP "\fB\-keyopt name:opt\fR" 4
533 .IX Item "-keyopt name:opt"
534 For signing and encryption this option can be used multiple times to
535 set customised parameters for the preceding key or certificate. It can
536 currently be used to set RSA-PSS for signing, RSA-OAEP for encryption
537 or to modify default parameters for \s-1ECDH.\s0
538 .IP "\fB\-passin arg\fR" 4
539 .IX Item "-passin arg"
540 The private key password source. For more information about the format of \fBarg\fR
541 see the \fB\s-1PASS PHRASE ARGUMENTS\s0\fR section in \fBopenssl\fR\|(1).
542 .IP "\fB\-rand file...\fR" 4
543 .IX Item "-rand file..."
544 A file or files containing random data used to seed the random number
545 generator.
546 Multiple files can be specified separated by an OS-dependent character.
547 The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
548 all others.
549 .IP "[\fB\-writerand file\fR]" 4
550 .IX Item "[-writerand file]"
551 Writes random data to the specified \fIfile\fR upon exit.
552 This can be used with a subsequent \fB\-rand\fR flag.
553 .IP "\fBcert.pem...\fR" 4
554 .IX Item "cert.pem..."
555 One or more certificates of message recipients: used when encrypting
556 a message.
557 .IP "\fB\-to, \-from, \-subject\fR" 4
558 .IX Item "-to, -from, -subject"
559 The relevant mail headers. These are included outside the signed
560 portion of a message so they may be included manually. If signing
561 then many S/MIME mail clients check the signers certificate's email
562 address matches that specified in the From: address.
563 .IP "\fB\-attime\fR, \fB\-check_ss_sig\fR, \fB\-crl_check\fR, \fB\-crl_check_all\fR, \fB\-explicit_policy\fR, \fB\-extended_crl\fR, \fB\-ignore_critical\fR, \fB\-inhibit_any\fR, \fB\-inhibit_map\fR, \fB\-no_alt_chains\fR, \fB\-no_check_time\fR, \fB\-partial_chain\fR, \fB\-policy\fR, \fB\-policy_check\fR, \fB\-policy_print\fR, \fB\-purpose\fR, \fB\-suiteB_128\fR, \fB\-suiteB_128_only\fR, \fB\-suiteB_192\fR, \fB\-trusted_first\fR, \fB\-use_deltas\fR, \fB\-auth_level\fR, \fB\-verify_depth\fR, \fB\-verify_email\fR, \fB\-verify_hostname\fR, \fB\-verify_ip\fR, \fB\-verify_name\fR, \fB\-x509_strict\fR" 4
564 .IX Item "-attime, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -no_check_time, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict"
565 Set various certificate chain validation options. See the
566 \&\fBverify\fR\|(1) manual page for details.
567 .SH "NOTES"
568 .IX Header "NOTES"
569 The \s-1MIME\s0 message must be sent without any blank lines between the
570 headers and the output. Some mail programs will automatically add
571 a blank line. Piping the mail directly to sendmail is one way to
572 achieve the correct format.
573 .PP
574 The supplied message to be signed or encrypted must include the
575 necessary \s-1MIME\s0 headers or many S/MIME clients won't display it
576 properly (if at all). You can use the \fB\-text\fR option to automatically
577 add plain text headers.
578 .PP
579 A \*(L"signed and encrypted\*(R" message is one where a signed message is
580 then encrypted. This can be produced by encrypting an already signed
581 message: see the examples section.
582 .PP
583 This version of the program only allows one signer per message but it
584 will verify multiple signers on received messages. Some S/MIME clients
585 choke if a message contains multiple signers. It is possible to sign
586 messages \*(L"in parallel\*(R" by signing an already signed message.
587 .PP
588 The options \fB\-encrypt\fR and \fB\-decrypt\fR reflect common usage in S/MIME
589 clients. Strictly speaking these process \s-1CMS\s0 enveloped data: \s-1CMS\s0
590 encrypted data is used for other purposes.
591 .PP
592 The \fB\-resign\fR option uses an existing message digest when adding a new
593 signer. This means that attributes must be present in at least one existing
594 signer using the same message digest or this operation will fail.
595 .PP
596 The \fB\-stream\fR and \fB\-indef\fR options enable streaming I/O support.
597 As a result the encoding is \s-1BER\s0 using indefinite length constructed encoding
598 and no longer \s-1DER.\s0 Streaming is supported for the \fB\-encrypt\fR operation and the
599 \&\fB\-sign\fR operation if the content is not detached.
600 .PP
601 Streaming is always used for the \fB\-sign\fR operation with detached data but
602 since the content is no longer part of the \s-1CMS\s0 structure the encoding
603 remains \s-1DER.\s0
604 .PP
605 If the \fB\-decrypt\fR option is used without a recipient certificate then an
606 attempt is made to locate the recipient by trying each potential recipient
607 in turn using the supplied private key. To thwart the \s-1MMA\s0 attack
608 (Bleichenbacher's attack on \s-1PKCS\s0 #1 v1.5 \s-1RSA\s0 padding) all recipients are
609 tried whether they succeed or not and if no recipients match the message
610 is \*(L"decrypted\*(R" using a random key which will typically output garbage.
611 The \fB\-debug_decrypt\fR option can be used to disable the \s-1MMA\s0 attack protection
612 and return an error if no recipient can be found: this option should be used
613 with caution. For a fuller description see \fBCMS_decrypt\fR\|(3)).
614 .SH "EXIT CODES"
615 .IX Header "EXIT CODES"
616 .IP "0" 4
617 The operation was completely successfully.
618 .IP "1" 4
619 .IX Item "1"
620 An error occurred parsing the command options.
621 .IP "2" 4
622 .IX Item "2"
623 One of the input files could not be read.
624 .IP "3" 4
625 .IX Item "3"
626 An error occurred creating the \s-1CMS\s0 file or when reading the \s-1MIME\s0
627 message.
628 .IP "4" 4
629 .IX Item "4"
630 An error occurred decrypting or verifying the message.
631 .IP "5" 4
632 .IX Item "5"
633 The message was verified correctly but an error occurred writing out
634 the signers certificates.
635 .SH "COMPATIBILITY WITH PKCS#7 format."
636 .IX Header "COMPATIBILITY WITH PKCS#7 format."
637 The \fBsmime\fR utility can only process the older \fBPKCS#7\fR format. The \fBcms\fR
638 utility supports Cryptographic Message Syntax format. Use of some features
639 will result in messages which cannot be processed by applications which only
640 support the older format. These are detailed below.
641 .PP
642 The use of the \fB\-keyid\fR option with \fB\-sign\fR or \fB\-encrypt\fR.
643 .PP
644 The \fB\-outform \s-1PEM\s0\fR option uses different headers.
645 .PP
646 The \fB\-compress\fR option.
647 .PP
648 The \fB\-secretkey\fR option when used with \fB\-encrypt\fR.
649 .PP
650 The use of \s-1PSS\s0 with \fB\-sign\fR.
651 .PP
652 The use of \s-1OAEP\s0 or non-RSA keys with \fB\-encrypt\fR.
653 .PP
654 Additionally the \fB\-EncryptedData_create\fR and \fB\-data_create\fR type cannot
655 be processed by the older \fBsmime\fR command.
656 .SH "EXAMPLES"
657 .IX Header "EXAMPLES"
658 Create a cleartext signed message:
659 .PP
660 .Vb 2
661 \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
662 \&        \-signer mycert.pem
663 .Ve
664 .PP
665 Create an opaque signed message
666 .PP
667 .Vb 2
668 \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \-nodetach \e
669 \&        \-signer mycert.pem
670 .Ve
671 .PP
672 Create a signed message, include some additional certificates and
673 read the private key from another file:
674 .PP
675 .Vb 2
676 \& openssl cms \-sign \-in in.txt \-text \-out mail.msg \e
677 \&        \-signer mycert.pem \-inkey mykey.pem \-certfile mycerts.pem
678 .Ve
679 .PP
680 Create a signed message with two signers, use key identifier:
681 .PP
682 .Vb 2
683 \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
684 \&        \-signer mycert.pem \-signer othercert.pem \-keyid
685 .Ve
686 .PP
687 Send a signed message under Unix directly to sendmail, including headers:
688 .PP
689 .Vb 3
690 \& openssl cms \-sign \-in in.txt \-text \-signer mycert.pem \e
691 \&        \-from steve@openssl.org \-to someone@somewhere \e
692 \&        \-subject "Signed message" | sendmail someone@somewhere
693 .Ve
694 .PP
695 Verify a message and extract the signer's certificate if successful:
696 .PP
697 .Vb 1
698 \& openssl cms \-verify \-in mail.msg \-signer user.pem \-out signedtext.txt
699 .Ve
700 .PP
701 Send encrypted mail using triple \s-1DES:\s0
702 .PP
703 .Vb 3
704 \& openssl cms \-encrypt \-in in.txt \-from steve@openssl.org \e
705 \&        \-to someone@somewhere \-subject "Encrypted message" \e
706 \&        \-des3 user.pem \-out mail.msg
707 .Ve
708 .PP
709 Sign and encrypt mail:
710 .PP
711 .Vb 4
712 \& openssl cms \-sign \-in ml.txt \-signer my.pem \-text \e
713 \&        | openssl cms \-encrypt \-out mail.msg \e
714 \&        \-from steve@openssl.org \-to someone@somewhere \e
715 \&        \-subject "Signed and Encrypted message" \-des3 user.pem
716 .Ve
717 .PP
718 Note: the encryption command does not include the \fB\-text\fR option because the
719 message being encrypted already has \s-1MIME\s0 headers.
720 .PP
721 Decrypt mail:
722 .PP
723 .Vb 1
724 \& openssl cms \-decrypt \-in mail.msg \-recip mycert.pem \-inkey key.pem
725 .Ve
726 .PP
727 The output from Netscape form signing is a PKCS#7 structure with the
728 detached signature format. You can use this program to verify the
729 signature by line wrapping the base64 encoded structure and surrounding
730 it with:
731 .PP
732 .Vb 2
733 \& \-\-\-\-\-BEGIN PKCS7\-\-\-\-\-
734 \& \-\-\-\-\-END PKCS7\-\-\-\-\-
735 .Ve
736 .PP
737 and using the command,
738 .PP
739 .Vb 1
740 \& openssl cms \-verify \-inform PEM \-in signature.pem \-content content.txt
741 .Ve
742 .PP
743 alternatively you can base64 decode the signature and use
744 .PP
745 .Vb 1
746 \& openssl cms \-verify \-inform DER \-in signature.der \-content content.txt
747 .Ve
748 .PP
749 Create an encrypted message using 128 bit Camellia:
750 .PP
751 .Vb 1
752 \& openssl cms \-encrypt \-in plain.txt \-camellia128 \-out mail.msg cert.pem
753 .Ve
754 .PP
755 Add a signer to an existing message:
756 .PP
757 .Vb 1
758 \& openssl cms \-resign \-in mail.msg \-signer newsign.pem \-out mail2.msg
759 .Ve
760 .PP
761 Sign mail using RSA-PSS:
762 .PP
763 .Vb 2
764 \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
765 \&        \-signer mycert.pem \-keyopt rsa_padding_mode:pss
766 .Ve
767 .PP
768 Create encrypted mail using RSA-OAEP:
769 .PP
770 .Vb 2
771 \& openssl cms \-encrypt \-in plain.txt \-out mail.msg \e
772 \&        \-recip cert.pem \-keyopt rsa_padding_mode:oaep
773 .Ve
774 .PP
775 Use \s-1SHA256 KDF\s0 with an \s-1ECDH\s0 certificate:
776 .PP
777 .Vb 2
778 \& openssl cms \-encrypt \-in plain.txt \-out mail.msg \e
779 \&        \-recip ecdhcert.pem \-keyopt ecdh_kdf_md:sha256
780 .Ve
781 .SH "BUGS"
782 .IX Header "BUGS"
783 The \s-1MIME\s0 parser isn't very clever: it seems to handle most messages that I've
784 thrown at it but it may choke on others.
785 .PP
786 The code currently will only write out the signer's certificate to a file: if
787 the signer has a separate encryption certificate this must be manually
788 extracted. There should be some heuristic that determines the correct
789 encryption certificate.
790 .PP
791 Ideally a database should be maintained of a certificates for each email
792 address.
793 .PP
794 The code doesn't currently take note of the permitted symmetric encryption
795 algorithms as supplied in the SMIMECapabilities signed attribute. this means the
796 user has to manually include the correct encryption algorithm. It should store
797 the list of permitted ciphers in a database and only use those.
798 .PP
799 No revocation checking is done on the signer's certificate.
800 .SH "HISTORY"
801 .IX Header "HISTORY"
802 The use of multiple \fB\-signer\fR options and the \fB\-resign\fR command were first
803 added in OpenSSL 1.0.0.
804 .PP
805 The \fBkeyopt\fR option was added in OpenSSL 1.0.2.
806 .PP
807 Support for RSA-OAEP and RSA-PSS was added in OpenSSL 1.0.2.
808 .PP
809 The use of non-RSA keys with \fB\-encrypt\fR and \fB\-decrypt\fR
810 was added in OpenSSL 1.0.2.
811 .PP
812 The \-no_alt_chains option was added in OpenSSL 1.0.2b.
813 .SH "COPYRIGHT"
814 .IX Header "COPYRIGHT"
815 Copyright 2008\-2018 The OpenSSL Project Authors. All Rights Reserved.
816 .PP
817 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
818 this file except in compliance with the License.  You can obtain a copy
819 in the file \s-1LICENSE\s0 in the source distribution or at
820 <https://www.openssl.org/source/license.html>.