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