]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/usr.bin/openssl/man/smime.1
Regen manual pages.
[FreeBSD/FreeBSD.git] / secure / usr.bin / openssl / man / smime.1
1 .\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
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 .if !\nF .nr F 0
58 .if \nF>0 \{\
59 .    de IX
60 .    tm Index:\\$1\t\\n%\t"\\$2"
61 ..
62 .    if !\nF==2 \{\
63 .        nr % 0
64 .        nr F 2
65 .    \}
66 .\}
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "SMIME 1"
132 .TH SMIME 1 "2018-09-11" "1.1.1" "OpenSSL"
133 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
134 .\" way too many mistakes in technical documents.
135 .if n .ad l
136 .nh
137 .SH "NAME"
138 openssl\-smime, smime \- S/MIME utility
139 .SH "SYNOPSIS"
140 .IX Header "SYNOPSIS"
141 \&\fBopenssl\fR \fBsmime\fR
142 [\fB\-help\fR]
143 [\fB\-encrypt\fR]
144 [\fB\-decrypt\fR]
145 [\fB\-sign\fR]
146 [\fB\-resign\fR]
147 [\fB\-verify\fR]
148 [\fB\-pk7out\fR]
149 [\fB\-binary\fR]
150 [\fB\-crlfeol\fR]
151 [\fB\-\f(BIcipher\fB\fR]
152 [\fB\-in file\fR]
153 [\fB\-CAfile file\fR]
154 [\fB\-CApath dir\fR]
155 [\fB\-no\-CAfile\fR]
156 [\fB\-no\-CApath\fR]
157 [\fB\-attime timestamp\fR]
158 [\fB\-check_ss_sig\fR]
159 [\fB\-crl_check\fR]
160 [\fB\-crl_check_all\fR]
161 [\fB\-explicit_policy\fR]
162 [\fB\-extended_crl\fR]
163 [\fB\-ignore_critical\fR]
164 [\fB\-inhibit_any\fR]
165 [\fB\-inhibit_map\fR]
166 [\fB\-partial_chain\fR]
167 [\fB\-policy arg\fR]
168 [\fB\-policy_check\fR]
169 [\fB\-policy_print\fR]
170 [\fB\-purpose purpose\fR]
171 [\fB\-suiteB_128\fR]
172 [\fB\-suiteB_128_only\fR]
173 [\fB\-suiteB_192\fR]
174 [\fB\-trusted_first\fR]
175 [\fB\-no_alt_chains\fR]
176 [\fB\-use_deltas\fR]
177 [\fB\-auth_level num\fR]
178 [\fB\-verify_depth num\fR]
179 [\fB\-verify_email email\fR]
180 [\fB\-verify_hostname hostname\fR]
181 [\fB\-verify_ip ip\fR]
182 [\fB\-verify_name name\fR]
183 [\fB\-x509_strict\fR]
184 [\fB\-certfile file\fR]
185 [\fB\-signer file\fR]
186 [\fB\-recip  file\fR]
187 [\fB\-inform SMIME|PEM|DER\fR]
188 [\fB\-passin arg\fR]
189 [\fB\-inkey file_or_id\fR]
190 [\fB\-out file\fR]
191 [\fB\-outform SMIME|PEM|DER\fR]
192 [\fB\-content file\fR]
193 [\fB\-to addr\fR]
194 [\fB\-from ad\fR]
195 [\fB\-subject s\fR]
196 [\fB\-text\fR]
197 [\fB\-indef\fR]
198 [\fB\-noindef\fR]
199 [\fB\-stream\fR]
200 [\fB\-rand file...\fR]
201 [\fB\-writerand file\fR]
202 [\fB\-md digest\fR]
203 [cert.pem]...
204 .SH "DESCRIPTION"
205 .IX Header "DESCRIPTION"
206 The \fBsmime\fR command handles S/MIME mail. It can encrypt, decrypt, sign and
207 verify S/MIME messages.
208 .SH "OPTIONS"
209 .IX Header "OPTIONS"
210 There are six operation options that set the type of operation to be performed.
211 The meaning of the other options varies according to the operation type.
212 .IP "\fB\-help\fR" 4
213 .IX Item "-help"
214 Print out a usage message.
215 .IP "\fB\-encrypt\fR" 4
216 .IX Item "-encrypt"
217 Encrypt mail for the given recipient certificates. Input file is the message
218 to be encrypted. The output file is the encrypted mail in \s-1MIME\s0 format.
219 .Sp
220 Note that no revocation check is done for the recipient cert, so if that
221 key has been compromised, others may be able to decrypt the text.
222 .IP "\fB\-decrypt\fR" 4
223 .IX Item "-decrypt"
224 Decrypt mail using the supplied certificate and private key. Expects an
225 encrypted mail message in \s-1MIME\s0 format for the input file. The decrypted mail
226 is written to the output file.
227 .IP "\fB\-sign\fR" 4
228 .IX Item "-sign"
229 Sign mail using the supplied certificate and private key. Input file is
230 the message to be signed. The signed message in \s-1MIME\s0 format is written
231 to the output file.
232 .IP "\fB\-verify\fR" 4
233 .IX Item "-verify"
234 Verify signed mail. Expects a signed mail message on input and outputs
235 the signed data. Both clear text and opaque signing is supported.
236 .IP "\fB\-pk7out\fR" 4
237 .IX Item "-pk7out"
238 Takes an input message and writes out a \s-1PEM\s0 encoded PKCS#7 structure.
239 .IP "\fB\-resign\fR" 4
240 .IX Item "-resign"
241 Resign a message: take an existing message and one or more new signers.
242 .IP "\fB\-in filename\fR" 4
243 .IX Item "-in filename"
244 The input message to be encrypted or signed or the \s-1MIME\s0 message to
245 be decrypted or verified.
246 .IP "\fB\-inform SMIME|PEM|DER\fR" 4
247 .IX Item "-inform SMIME|PEM|DER"
248 This specifies the input format for the PKCS#7 structure. The default
249 is \fB\s-1SMIME\s0\fR which reads an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
250 format change this to expect \s-1PEM\s0 and \s-1DER\s0 format PKCS#7 structures
251 instead. This currently only affects the input format of the PKCS#7
252 structure, if no PKCS#7 structure is being input (for example with
253 \&\fB\-encrypt\fR or \fB\-sign\fR) this option has no effect.
254 .IP "\fB\-out filename\fR" 4
255 .IX Item "-out filename"
256 The message text that has been decrypted or verified or the output \s-1MIME\s0
257 format message that has been signed or verified.
258 .IP "\fB\-outform SMIME|PEM|DER\fR" 4
259 .IX Item "-outform SMIME|PEM|DER"
260 This specifies the output format for the PKCS#7 structure. The default
261 is \fB\s-1SMIME\s0\fR which write an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
262 format change this to write \s-1PEM\s0 and \s-1DER\s0 format PKCS#7 structures
263 instead. This currently only affects the output format of the PKCS#7
264 structure, if no PKCS#7 structure is being output (for example with
265 \&\fB\-verify\fR or \fB\-decrypt\fR) this option has no effect.
266 .IP "\fB\-stream \-indef \-noindef\fR" 4
267 .IX Item "-stream -indef -noindef"
268 The \fB\-stream\fR and \fB\-indef\fR options are equivalent and enable streaming I/O
269 for encoding operations. This permits single pass processing of data without
270 the need to hold the entire contents in memory, potentially supporting very
271 large files. Streaming is automatically set for S/MIME signing with detached
272 data if the output format is \fB\s-1SMIME\s0\fR it is currently off by default for all
273 other operations.
274 .IP "\fB\-noindef\fR" 4
275 .IX Item "-noindef"
276 Disable streaming I/O where it would produce and indefinite length constructed
277 encoding. This option currently has no effect. In future streaming will be
278 enabled by default on all relevant operations and this option will disable it.
279 .IP "\fB\-content filename\fR" 4
280 .IX Item "-content filename"
281 This specifies a file containing the detached content, this is only
282 useful with the \fB\-verify\fR command. This is only usable if the PKCS#7
283 structure is using the detached signature form where the content is
284 not included. This option will override any content if the input format
285 is S/MIME and it uses the multipart/signed \s-1MIME\s0 content type.
286 .IP "\fB\-text\fR" 4
287 .IX Item "-text"
288 This option adds plain text (text/plain) \s-1MIME\s0 headers to the supplied
289 message if encrypting or signing. If decrypting or verifying it strips
290 off text headers: if the decrypted or verified message is not of \s-1MIME\s0
291 type text/plain then an error occurs.
292 .IP "\fB\-CAfile file\fR" 4
293 .IX Item "-CAfile file"
294 A file containing trusted \s-1CA\s0 certificates, only used with \fB\-verify\fR.
295 .IP "\fB\-CApath dir\fR" 4
296 .IX Item "-CApath dir"
297 A directory containing trusted \s-1CA\s0 certificates, only used with
298 \&\fB\-verify\fR. This directory must be a standard certificate directory: that
299 is a hash of each subject name (using \fBx509 \-hash\fR) should be linked
300 to each certificate.
301 .IP "\fB\-no\-CAfile\fR" 4
302 .IX Item "-no-CAfile"
303 Do not load the trusted \s-1CA\s0 certificates from the default file location.
304 .IP "\fB\-no\-CApath\fR" 4
305 .IX Item "-no-CApath"
306 Do not load the trusted \s-1CA\s0 certificates from the default directory location.
307 .IP "\fB\-md digest\fR" 4
308 .IX Item "-md digest"
309 Digest algorithm to use when signing or resigning. If not present then the
310 default digest algorithm for the signing key will be used (usually \s-1SHA1\s0).
311 .IP "\fB\-\f(BIcipher\fB\fR" 4
312 .IX Item "-cipher"
313 The encryption algorithm to use. For example \s-1DES\s0  (56 bits) \- \fB\-des\fR,
314 triple \s-1DES\s0 (168 bits) \- \fB\-des3\fR,
315 \&\fIEVP_get_cipherbyname()\fR function) can also be used preceded by a dash, for
316 example \fB\-aes\-128\-cbc\fR. See \fBenc\fR for list of ciphers
317 supported by your version of OpenSSL.
318 .Sp
319 If not specified triple \s-1DES\s0 is used. Only used with \fB\-encrypt\fR.
320 .IP "\fB\-nointern\fR" 4
321 .IX Item "-nointern"
322 When verifying a message normally certificates (if any) included in
323 the message are searched for the signing certificate. With this option
324 only the certificates specified in the \fB\-certfile\fR option are used.
325 The supplied certificates can still be used as untrusted CAs however.
326 .IP "\fB\-noverify\fR" 4
327 .IX Item "-noverify"
328 Do not verify the signers certificate of a signed message.
329 .IP "\fB\-nochain\fR" 4
330 .IX Item "-nochain"
331 Do not do chain verification of signers certificates: that is don't
332 use the certificates in the signed message as untrusted CAs.
333 .IP "\fB\-nosigs\fR" 4
334 .IX Item "-nosigs"
335 Don't try to verify the signatures on the message.
336 .IP "\fB\-nocerts\fR" 4
337 .IX Item "-nocerts"
338 When signing a message the signer's certificate is normally included
339 with this option it is excluded. This will reduce the size of the
340 signed message but the verifier must have a copy of the signers certificate
341 available locally (passed using the \fB\-certfile\fR option for example).
342 .IP "\fB\-noattr\fR" 4
343 .IX Item "-noattr"
344 Normally when a message is signed a set of attributes are included which
345 include the signing time and supported symmetric algorithms. With this
346 option they are not included.
347 .IP "\fB\-binary\fR" 4
348 .IX Item "-binary"
349 Normally the input message is converted to \*(L"canonical\*(R" format which is
350 effectively using \s-1CR\s0 and \s-1LF\s0 as end of line: as required by the S/MIME
351 specification. When this option is present no translation occurs. This
352 is useful when handling binary data which may not be in \s-1MIME\s0 format.
353 .IP "\fB\-crlfeol\fR" 4
354 .IX Item "-crlfeol"
355 Normally the output file uses a single \fB\s-1LF\s0\fR as end of line. When this
356 option is present \fB\s-1CRLF\s0\fR is used instead.
357 .IP "\fB\-nodetach\fR" 4
358 .IX Item "-nodetach"
359 When signing a message use opaque signing: this form is more resistant
360 to translation by mail relays but it cannot be read by mail agents that
361 do not support S/MIME.  Without this option cleartext signing with
362 the \s-1MIME\s0 type multipart/signed is used.
363 .IP "\fB\-certfile file\fR" 4
364 .IX Item "-certfile file"
365 Allows additional certificates to be specified. When signing these will
366 be included with the message. When verifying these will be searched for
367 the signers certificates. The certificates should be in \s-1PEM\s0 format.
368 .IP "\fB\-signer file\fR" 4
369 .IX Item "-signer file"
370 A signing certificate when signing or resigning a message, this option can be
371 used multiple times if more than one signer is required. If a message is being
372 verified then the signers certificates will be written to this file if the
373 verification was successful.
374 .IP "\fB\-recip file\fR" 4
375 .IX Item "-recip file"
376 The recipients certificate when decrypting a message. This certificate
377 must match one of the recipients of the message or an error occurs.
378 .IP "\fB\-inkey file_or_id\fR" 4
379 .IX Item "-inkey file_or_id"
380 The private key to use when signing or decrypting. This must match the
381 corresponding certificate. If this option is not specified then the
382 private key must be included in the certificate file specified with
383 the \fB\-recip\fR or \fB\-signer\fR file. When signing this option can be used
384 multiple times to specify successive keys.
385 If no engine is used, the argument is taken as a file; if an engine is
386 specified, the argument is given to the engine as a key identifier.
387 .IP "\fB\-passin arg\fR" 4
388 .IX Item "-passin arg"
389 The private key password source. For more information about the format of \fBarg\fR
390 see the \fB\s-1PASS PHRASE ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
391 .IP "\fB\-rand file...\fR" 4
392 .IX Item "-rand file..."
393 A file or files containing random data used to seed the random number
394 generator.
395 Multiple files can be specified separated by an OS-dependent character.
396 The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
397 all others.
398 .IP "[\fB\-writerand file\fR]" 4
399 .IX Item "[-writerand file]"
400 Writes random data to the specified \fIfile\fR upon exit.
401 This can be used with a subsequent \fB\-rand\fR flag.
402 .IP "\fBcert.pem...\fR" 4
403 .IX Item "cert.pem..."
404 One or more certificates of message recipients: used when encrypting
405 a message.
406 .IP "\fB\-to, \-from, \-subject\fR" 4
407 .IX Item "-to, -from, -subject"
408 The relevant mail headers. These are included outside the signed
409 portion of a message so they may be included manually. If signing
410 then many S/MIME mail clients check the signers certificate's email
411 address matches that specified in the From: address.
412 .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\-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
413 .IX Item "-attime, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -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"
414 Set various options of certificate chain verification. See
415 \&\fIverify\fR\|(1) manual page for details.
416 .SH "NOTES"
417 .IX Header "NOTES"
418 The \s-1MIME\s0 message must be sent without any blank lines between the
419 headers and the output. Some mail programs will automatically add
420 a blank line. Piping the mail directly to sendmail is one way to
421 achieve the correct format.
422 .PP
423 The supplied message to be signed or encrypted must include the
424 necessary \s-1MIME\s0 headers or many S/MIME clients won't display it
425 properly (if at all). You can use the \fB\-text\fR option to automatically
426 add plain text headers.
427 .PP
428 A \*(L"signed and encrypted\*(R" message is one where a signed message is
429 then encrypted. This can be produced by encrypting an already signed
430 message: see the examples section.
431 .PP
432 This version of the program only allows one signer per message but it
433 will verify multiple signers on received messages. Some S/MIME clients
434 choke if a message contains multiple signers. It is possible to sign
435 messages \*(L"in parallel\*(R" by signing an already signed message.
436 .PP
437 The options \fB\-encrypt\fR and \fB\-decrypt\fR reflect common usage in S/MIME
438 clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7
439 encrypted data is used for other purposes.
440 .PP
441 The \fB\-resign\fR option uses an existing message digest when adding a new
442 signer. This means that attributes must be present in at least one existing
443 signer using the same message digest or this operation will fail.
444 .PP
445 The \fB\-stream\fR and \fB\-indef\fR options enable streaming I/O support.
446 As a result the encoding is \s-1BER\s0 using indefinite length constructed encoding
447 and no longer \s-1DER.\s0 Streaming is supported for the \fB\-encrypt\fR operation and the
448 \&\fB\-sign\fR operation if the content is not detached.
449 .PP
450 Streaming is always used for the \fB\-sign\fR operation with detached data but
451 since the content is no longer part of the PKCS#7 structure the encoding
452 remains \s-1DER.\s0
453 .SH "EXIT CODES"
454 .IX Header "EXIT CODES"
455 .IP "0" 4
456 The operation was completely successfully.
457 .IP "1" 4
458 .IX Item "1"
459 An error occurred parsing the command options.
460 .IP "2" 4
461 .IX Item "2"
462 One of the input files could not be read.
463 .IP "3" 4
464 .IX Item "3"
465 An error occurred creating the PKCS#7 file or when reading the \s-1MIME\s0
466 message.
467 .IP "4" 4
468 .IX Item "4"
469 An error occurred decrypting or verifying the message.
470 .IP "5" 4
471 .IX Item "5"
472 The message was verified correctly but an error occurred writing out
473 the signers certificates.
474 .SH "EXAMPLES"
475 .IX Header "EXAMPLES"
476 Create a cleartext signed message:
477 .PP
478 .Vb 2
479 \& openssl smime \-sign \-in message.txt \-text \-out mail.msg \e
480 \&        \-signer mycert.pem
481 .Ve
482 .PP
483 Create an opaque signed message:
484 .PP
485 .Vb 2
486 \& openssl smime \-sign \-in message.txt \-text \-out mail.msg \-nodetach \e
487 \&        \-signer mycert.pem
488 .Ve
489 .PP
490 Create a signed message, include some additional certificates and
491 read the private key from another file:
492 .PP
493 .Vb 2
494 \& openssl smime \-sign \-in in.txt \-text \-out mail.msg \e
495 \&        \-signer mycert.pem \-inkey mykey.pem \-certfile mycerts.pem
496 .Ve
497 .PP
498 Create a signed message with two signers:
499 .PP
500 .Vb 2
501 \& openssl smime \-sign \-in message.txt \-text \-out mail.msg \e
502 \&        \-signer mycert.pem \-signer othercert.pem
503 .Ve
504 .PP
505 Send a signed message under Unix directly to sendmail, including headers:
506 .PP
507 .Vb 3
508 \& openssl smime \-sign \-in in.txt \-text \-signer mycert.pem \e
509 \&        \-from steve@openssl.org \-to someone@somewhere \e
510 \&        \-subject "Signed message" | sendmail someone@somewhere
511 .Ve
512 .PP
513 Verify a message and extract the signer's certificate if successful:
514 .PP
515 .Vb 1
516 \& openssl smime \-verify \-in mail.msg \-signer user.pem \-out signedtext.txt
517 .Ve
518 .PP
519 Send encrypted mail using triple \s-1DES:\s0
520 .PP
521 .Vb 3
522 \& openssl smime \-encrypt \-in in.txt \-from steve@openssl.org \e
523 \&        \-to someone@somewhere \-subject "Encrypted message" \e
524 \&        \-des3 user.pem \-out mail.msg
525 .Ve
526 .PP
527 Sign and encrypt mail:
528 .PP
529 .Vb 4
530 \& openssl smime \-sign \-in ml.txt \-signer my.pem \-text \e
531 \&        | openssl smime \-encrypt \-out mail.msg \e
532 \&        \-from steve@openssl.org \-to someone@somewhere \e
533 \&        \-subject "Signed and Encrypted message" \-des3 user.pem
534 .Ve
535 .PP
536 Note: the encryption command does not include the \fB\-text\fR option because the
537 message being encrypted already has \s-1MIME\s0 headers.
538 .PP
539 Decrypt mail:
540 .PP
541 .Vb 1
542 \& openssl smime \-decrypt \-in mail.msg \-recip mycert.pem \-inkey key.pem
543 .Ve
544 .PP
545 The output from Netscape form signing is a PKCS#7 structure with the
546 detached signature format. You can use this program to verify the
547 signature by line wrapping the base64 encoded structure and surrounding
548 it with:
549 .PP
550 .Vb 2
551 \& \-\-\-\-\-BEGIN PKCS7\-\-\-\-\-
552 \& \-\-\-\-\-END PKCS7\-\-\-\-\-
553 .Ve
554 .PP
555 and using the command:
556 .PP
557 .Vb 1
558 \& openssl smime \-verify \-inform PEM \-in signature.pem \-content content.txt
559 .Ve
560 .PP
561 Alternatively you can base64 decode the signature and use:
562 .PP
563 .Vb 1
564 \& openssl smime \-verify \-inform DER \-in signature.der \-content content.txt
565 .Ve
566 .PP
567 Create an encrypted message using 128 bit Camellia:
568 .PP
569 .Vb 1
570 \& openssl smime \-encrypt \-in plain.txt \-camellia128 \-out mail.msg cert.pem
571 .Ve
572 .PP
573 Add a signer to an existing message:
574 .PP
575 .Vb 1
576 \& openssl smime \-resign \-in mail.msg \-signer newsign.pem \-out mail2.msg
577 .Ve
578 .SH "BUGS"
579 .IX Header "BUGS"
580 The \s-1MIME\s0 parser isn't very clever: it seems to handle most messages that I've
581 thrown at it but it may choke on others.
582 .PP
583 The code currently will only write out the signer's certificate to a file: if
584 the signer has a separate encryption certificate this must be manually
585 extracted. There should be some heuristic that determines the correct
586 encryption certificate.
587 .PP
588 Ideally a database should be maintained of a certificates for each email
589 address.
590 .PP
591 The code doesn't currently take note of the permitted symmetric encryption
592 algorithms as supplied in the SMIMECapabilities signed attribute. This means the
593 user has to manually include the correct encryption algorithm. It should store
594 the list of permitted ciphers in a database and only use those.
595 .PP
596 No revocation checking is done on the signer's certificate.
597 .PP
598 The current code can only handle S/MIME v2 messages, the more complex S/MIME v3
599 structures may cause parsing errors.
600 .SH "HISTORY"
601 .IX Header "HISTORY"
602 The use of multiple \fB\-signer\fR options and the \fB\-resign\fR command were first
603 added in OpenSSL 1.0.0
604 .PP
605 The \-no_alt_chains options was first added to OpenSSL 1.1.0.
606 .SH "COPYRIGHT"
607 .IX Header "COPYRIGHT"
608 Copyright 2000\-2017 The OpenSSL Project Authors. All Rights Reserved.
609 .PP
610 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
611 this file except in compliance with the License.  You can obtain a copy
612 in the file \s-1LICENSE\s0 in the source distribution or at
613 <https://www.openssl.org/source/license.html>.