Update files for OpenSSL-1.0.0f import.
[dragonfly.git] / secure / usr.bin / openssl / man / smime.1
CommitLineData
e3261593 1.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.19)
8b0cefbb
JR
2.\"
3.\" Standard preamble:
4.\" ========================================================================
8b0cefbb 5.de Sp \" Vertical space (when we can't use .PP)
984263bc
MD
6.if t .sp .5v
7.if n .sp
8..
8b0cefbb 9.de Vb \" Begin verbatim text
984263bc
MD
10.ft CW
11.nf
12.ne \\$1
13..
8b0cefbb 14.de Ve \" End verbatim text
984263bc 15.ft R
984263bc
MD
16.fi
17..
8b0cefbb
JR
18.\" Set up some character translations and predefined strings. \*(-- will
19.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
e257b235
PA
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-
8b0cefbb 25.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
984263bc 26.ie n \{\
8b0cefbb
JR
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' ""
984263bc
MD
35'br\}
36.el\{\
8b0cefbb
JR
37. ds -- \|\(em\|
38. ds PI \(*p
39. ds L" ``
40. ds R" ''
984263bc 41'br\}
8b0cefbb 42.\"
e257b235
PA
43.\" Escape single quotes in literal strings from groff's Unicode transform.
44.ie \n(.g .ds Aq \(aq
45.el .ds Aq '
46.\"
8b0cefbb 47.\" If the F register is turned on, we'll generate index entries on stderr for
01185282 48.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
8b0cefbb
JR
49.\" entries marked with X<> in POD. Of course, you'll have to process the
50.\" output yourself in some meaningful fashion.
e257b235 51.ie \nF \{\
8b0cefbb
JR
52. de IX
53. tm Index:\\$1\t\\n%\t"\\$2"
984263bc 54..
8b0cefbb
JR
55. nr % 0
56. rr F
984263bc 57.\}
e257b235
PA
58.el \{\
59. de IX
60..
61.\}
aac4ff6f 62.\"
8b0cefbb
JR
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
984263bc 66.if n \{\
8b0cefbb
JR
67. ds #H 0
68. ds #V .8m
69. ds #F .3m
70. ds #[ \f1
71. ds #] \fP
984263bc
MD
72.\}
73.if t \{\
8b0cefbb
JR
74. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75. ds #V .6m
76. ds #F 0
77. ds #[ \&
78. ds #] \&
984263bc 79.\}
8b0cefbb 80. \" simple accents for nroff and troff
984263bc 81.if n \{\
8b0cefbb
JR
82. ds ' \&
83. ds ` \&
84. ds ^ \&
85. ds , \&
86. ds ~ ~
87. ds /
984263bc
MD
88.\}
89.if t \{\
8b0cefbb
JR
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'
984263bc 96.\}
8b0cefbb 97. \" troff and (daisy-wheel) nroff accents
984263bc
MD
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
8b0cefbb 107. \" corrections for vroff
984263bc
MD
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'
8b0cefbb 110. \" for low resolution devices (crt and lpr)
984263bc
MD
111.if \n(.H>23 .if \n(.V>19 \
112\{\
8b0cefbb
JR
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
984263bc
MD
122.\}
123.rm #[ #] #H #V #F C
8b0cefbb
JR
124.\" ========================================================================
125.\"
126.IX Title "SMIME 1"
e3261593 127.TH SMIME 1 "2012-01-04" "1.0.0f" "OpenSSL"
e257b235
PA
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
984263bc
MD
132.SH "NAME"
133smime \- S/MIME utility
134.SH "SYNOPSIS"
8b0cefbb
JR
135.IX Header "SYNOPSIS"
136\&\fBopenssl\fR \fBsmime\fR
984263bc
MD
137[\fB\-encrypt\fR]
138[\fB\-decrypt\fR]
139[\fB\-sign\fR]
01185282 140[\fB\-resign\fR]
984263bc
MD
141[\fB\-verify\fR]
142[\fB\-pk7out\fR]
01185282 143[\fB\-[cipher]\fR]
984263bc
MD
144[\fB\-in file\fR]
145[\fB\-certfile file\fR]
146[\fB\-signer file\fR]
147[\fB\-recip file\fR]
148[\fB\-inform SMIME|PEM|DER\fR]
149[\fB\-passin arg\fR]
150[\fB\-inkey file\fR]
151[\fB\-out file\fR]
152[\fB\-outform SMIME|PEM|DER\fR]
153[\fB\-content file\fR]
154[\fB\-to addr\fR]
155[\fB\-from ad\fR]
156[\fB\-subject s\fR]
157[\fB\-text\fR]
01185282
PA
158[\fB\-indef\fR]
159[\fB\-noindef\fR]
160[\fB\-stream\fR]
e3cdf75b 161[\fB\-rand file(s)\fR]
01185282 162[\fB\-md digest\fR]
984263bc
MD
163[cert.pem]...
164.SH "DESCRIPTION"
8b0cefbb 165.IX Header "DESCRIPTION"
984263bc
MD
166The \fBsmime\fR command handles S/MIME mail. It can encrypt, decrypt, sign and
167verify S/MIME messages.
168.SH "COMMAND OPTIONS"
8b0cefbb 169.IX Header "COMMAND OPTIONS"
01185282 170There are six operation options that set the type of operation to be performed.
984263bc 171The meaning of the other options varies according to the operation type.
8b0cefbb
JR
172.IP "\fB\-encrypt\fR" 4
173.IX Item "-encrypt"
984263bc
MD
174encrypt mail for the given recipient certificates. Input file is the message
175to be encrypted. The output file is the encrypted mail in \s-1MIME\s0 format.
8b0cefbb
JR
176.IP "\fB\-decrypt\fR" 4
177.IX Item "-decrypt"
984263bc
MD
178decrypt mail using the supplied certificate and private key. Expects an
179encrypted mail message in \s-1MIME\s0 format for the input file. The decrypted mail
180is written to the output file.
8b0cefbb
JR
181.IP "\fB\-sign\fR" 4
182.IX Item "-sign"
984263bc
MD
183sign mail using the supplied certificate and private key. Input file is
184the message to be signed. The signed message in \s-1MIME\s0 format is written
185to the output file.
8b0cefbb
JR
186.IP "\fB\-verify\fR" 4
187.IX Item "-verify"
984263bc
MD
188verify signed mail. Expects a signed mail message on input and outputs
189the signed data. Both clear text and opaque signing is supported.
8b0cefbb
JR
190.IP "\fB\-pk7out\fR" 4
191.IX Item "-pk7out"
192takes an input message and writes out a \s-1PEM\s0 encoded PKCS#7 structure.
01185282
PA
193.IP "\fB\-resign\fR" 4
194.IX Item "-resign"
195resign a message: take an existing message and one or more new signers.
8b0cefbb
JR
196.IP "\fB\-in filename\fR" 4
197.IX Item "-in filename"
984263bc
MD
198the input message to be encrypted or signed or the \s-1MIME\s0 message to
199be decrypted or verified.
8b0cefbb
JR
200.IP "\fB\-inform SMIME|PEM|DER\fR" 4
201.IX Item "-inform SMIME|PEM|DER"
202this specifies the input format for the PKCS#7 structure. The default
203is \fB\s-1SMIME\s0\fR which reads an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
204format change this to expect \s-1PEM\s0 and \s-1DER\s0 format PKCS#7 structures
205instead. This currently only affects the input format of the PKCS#7
206structure, if no PKCS#7 structure is being input (for example with
207\&\fB\-encrypt\fR or \fB\-sign\fR) this option has no effect.
208.IP "\fB\-out filename\fR" 4
209.IX Item "-out filename"
984263bc
MD
210the message text that has been decrypted or verified or the output \s-1MIME\s0
211format message that has been signed or verified.
8b0cefbb
JR
212.IP "\fB\-outform SMIME|PEM|DER\fR" 4
213.IX Item "-outform SMIME|PEM|DER"
214this specifies the output format for the PKCS#7 structure. The default
215is \fB\s-1SMIME\s0\fR which write an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
216format change this to write \s-1PEM\s0 and \s-1DER\s0 format PKCS#7 structures
217instead. This currently only affects the output format of the PKCS#7
218structure, if no PKCS#7 structure is being output (for example with
219\&\fB\-verify\fR or \fB\-decrypt\fR) this option has no effect.
01185282
PA
220.IP "\fB\-stream \-indef \-noindef\fR" 4
221.IX Item "-stream -indef -noindef"
222the \fB\-stream\fR and \fB\-indef\fR options are equivalent and enable streaming I/O
223for encoding operations. This permits single pass processing of data without
224the need to hold the entire contents in memory, potentially supporting very
225large files. Streaming is automatically set for S/MIME signing with detached
226data if the output format is \fB\s-1SMIME\s0\fR it is currently off by default for all
227other operations.
228.IP "\fB\-noindef\fR" 4
229.IX Item "-noindef"
230disable streaming I/O where it would produce and indefinite length constructed
231encoding. This option currently has no effect. In future streaming will be
232enabled by default on all relevant operations and this option will disable it.
8b0cefbb
JR
233.IP "\fB\-content filename\fR" 4
234.IX Item "-content filename"
984263bc 235This specifies a file containing the detached content, this is only
8b0cefbb 236useful with the \fB\-verify\fR command. This is only usable if the PKCS#7
984263bc
MD
237structure is using the detached signature form where the content is
238not included. This option will override any content if the input format
8b0cefbb
JR
239is S/MIME and it uses the multipart/signed \s-1MIME\s0 content type.
240.IP "\fB\-text\fR" 4
241.IX Item "-text"
984263bc
MD
242this option adds plain text (text/plain) \s-1MIME\s0 headers to the supplied
243message if encrypting or signing. If decrypting or verifying it strips
244off text headers: if the decrypted or verified message is not of \s-1MIME\s0
245type text/plain then an error occurs.
8b0cefbb
JR
246.IP "\fB\-CAfile file\fR" 4
247.IX Item "-CAfile file"
984263bc 248a file containing trusted \s-1CA\s0 certificates, only used with \fB\-verify\fR.
8b0cefbb
JR
249.IP "\fB\-CApath dir\fR" 4
250.IX Item "-CApath dir"
984263bc 251a directory containing trusted \s-1CA\s0 certificates, only used with
8b0cefbb 252\&\fB\-verify\fR. This directory must be a standard certificate directory: that
984263bc
MD
253is a hash of each subject name (using \fBx509 \-hash\fR) should be linked
254to each certificate.
01185282
PA
255.IP "\fB\-md digest\fR" 4
256.IX Item "-md digest"
257digest algorithm to use when signing or resigning. If not present then the
258default digest algorithm for the signing key will be used (usually \s-1SHA1\s0).
259.IP "\fB\-[cipher]\fR" 4
260.IX Item "-[cipher]"
261the encryption algorithm to use. For example \s-1DES\s0 (56 bits) \- \fB\-des\fR,
262triple \s-1DES\s0 (168 bits) \- \fB\-des3\fR,
263\&\fIEVP_get_cipherbyname()\fR function) can also be used preceded by a dash, for
264example \fB\-aes_128_cbc\fR. See \fBenc\fR for list of ciphers
265supported by your version of OpenSSL.
266.Sp
267If not specified 40 bit \s-1RC2\s0 is used. Only used with \fB\-encrypt\fR.
8b0cefbb
JR
268.IP "\fB\-nointern\fR" 4
269.IX Item "-nointern"
984263bc
MD
270when verifying a message normally certificates (if any) included in
271the message are searched for the signing certificate. With this option
272only the certificates specified in the \fB\-certfile\fR option are used.
273The supplied certificates can still be used as untrusted CAs however.
8b0cefbb
JR
274.IP "\fB\-noverify\fR" 4
275.IX Item "-noverify"
984263bc 276do not verify the signers certificate of a signed message.
8b0cefbb
JR
277.IP "\fB\-nochain\fR" 4
278.IX Item "-nochain"
984263bc
MD
279do not do chain verification of signers certificates: that is don't
280use the certificates in the signed message as untrusted CAs.
8b0cefbb
JR
281.IP "\fB\-nosigs\fR" 4
282.IX Item "-nosigs"
984263bc 283don't try to verify the signatures on the message.
8b0cefbb
JR
284.IP "\fB\-nocerts\fR" 4
285.IX Item "-nocerts"
984263bc
MD
286when signing a message the signer's certificate is normally included
287with this option it is excluded. This will reduce the size of the
288signed message but the verifier must have a copy of the signers certificate
289available locally (passed using the \fB\-certfile\fR option for example).
8b0cefbb
JR
290.IP "\fB\-noattr\fR" 4
291.IX Item "-noattr"
984263bc
MD
292normally when a message is signed a set of attributes are included which
293include the signing time and supported symmetric algorithms. With this
294option they are not included.
8b0cefbb
JR
295.IP "\fB\-binary\fR" 4
296.IX Item "-binary"
984263bc 297normally the input message is converted to \*(L"canonical\*(R" format which is
8b0cefbb 298effectively using \s-1CR\s0 and \s-1LF\s0 as end of line: as required by the S/MIME
984263bc
MD
299specification. When this option is present no translation occurs. This
300is useful when handling binary data which may not be in \s-1MIME\s0 format.
8b0cefbb
JR
301.IP "\fB\-nodetach\fR" 4
302.IX Item "-nodetach"
984263bc
MD
303when signing a message use opaque signing: this form is more resistant
304to translation by mail relays but it cannot be read by mail agents that
8b0cefbb 305do not support S/MIME. Without this option cleartext signing with
984263bc 306the \s-1MIME\s0 type multipart/signed is used.
8b0cefbb
JR
307.IP "\fB\-certfile file\fR" 4
308.IX Item "-certfile file"
984263bc
MD
309allows additional certificates to be specified. When signing these will
310be included with the message. When verifying these will be searched for
311the signers certificates. The certificates should be in \s-1PEM\s0 format.
8b0cefbb
JR
312.IP "\fB\-signer file\fR" 4
313.IX Item "-signer file"
01185282
PA
314a signing certificate when signing or resigning a message, this option can be
315used multiple times if more than one signer is required. If a message is being
316verified then the signers certificates will be written to this file if the
317verification was successful.
8b0cefbb
JR
318.IP "\fB\-recip file\fR" 4
319.IX Item "-recip file"
984263bc
MD
320the recipients certificate when decrypting a message. This certificate
321must match one of the recipients of the message or an error occurs.
8b0cefbb
JR
322.IP "\fB\-inkey file\fR" 4
323.IX Item "-inkey file"
984263bc
MD
324the private key to use when signing or decrypting. This must match the
325corresponding certificate. If this option is not specified then the
326private key must be included in the certificate file specified with
01185282
PA
327the \fB\-recip\fR or \fB\-signer\fR file. When signing this option can be used
328multiple times to specify successive keys.
8b0cefbb
JR
329.IP "\fB\-passin arg\fR" 4
330.IX Item "-passin arg"
984263bc 331the private key password source. For more information about the format of \fBarg\fR
8b0cefbb
JR
332see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
333.IP "\fB\-rand file(s)\fR" 4
334.IX Item "-rand file(s)"
984263bc 335a file or files containing random data used to seed the random number
8b0cefbb
JR
336generator, or an \s-1EGD\s0 socket (see \fIRAND_egd\fR\|(3)).
337Multiple files can be specified separated by a OS-dependent character.
e257b235 338The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
984263bc 339all others.
8b0cefbb
JR
340.IP "\fBcert.pem...\fR" 4
341.IX Item "cert.pem..."
984263bc 342one or more certificates of message recipients: used when encrypting
e257b235 343a message.
8b0cefbb
JR
344.IP "\fB\-to, \-from, \-subject\fR" 4
345.IX Item "-to, -from, -subject"
984263bc
MD
346the relevant mail headers. These are included outside the signed
347portion of a message so they may be included manually. If signing
8b0cefbb 348then many S/MIME mail clients check the signers certificate's email
984263bc 349address matches that specified in the From: address.
01185282
PA
350.IP "\fB\-purpose, \-ignore_critical, \-issuer_checks, \-crl_check, \-crl_check_all, \-policy_check, \-extended_crl, \-x509_strict, \-policy \-check_ss_sig\fR" 4
351.IX Item "-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_check_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig"
352Set various options of certificate chain verification. See
353\&\fBverify\fR manual page for details.
984263bc 354.SH "NOTES"
8b0cefbb
JR
355.IX Header "NOTES"
356The \s-1MIME\s0 message must be sent without any blank lines between the
984263bc
MD
357headers and the output. Some mail programs will automatically add
358a blank line. Piping the mail directly to sendmail is one way to
359achieve the correct format.
360.PP
361The supplied message to be signed or encrypted must include the
8b0cefbb 362necessary \s-1MIME\s0 headers or many S/MIME clients wont display it
984263bc
MD
363properly (if at all). You can use the \fB\-text\fR option to automatically
364add plain text headers.
365.PP
366A \*(L"signed and encrypted\*(R" message is one where a signed message is
367then encrypted. This can be produced by encrypting an already signed
368message: see the examples section.
369.PP
370This version of the program only allows one signer per message but it
371will verify multiple signers on received messages. Some S/MIME clients
372choke if a message contains multiple signers. It is possible to sign
373messages \*(L"in parallel\*(R" by signing an already signed message.
374.PP
375The options \fB\-encrypt\fR and \fB\-decrypt\fR reflect common usage in S/MIME
376clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7
377encrypted data is used for other purposes.
01185282
PA
378.PP
379The \fB\-resign\fR option uses an existing message digest when adding a new
380signer. This means that attributes must be present in at least one existing
381signer using the same message digest or this operation will fail.
382.PP
383The \fB\-stream\fR and \fB\-indef\fR options enable experimental streaming I/O support.
384As a result the encoding is \s-1BER\s0 using indefinite length constructed encoding
385and no longer \s-1DER\s0. Streaming is supported for the \fB\-encrypt\fR operation and the
386\&\fB\-sign\fR operation if the content is not detached.
387.PP
388Streaming is always used for the \fB\-sign\fR operation with detached data but
389since the content is no longer part of the PKCS#7 structure the encoding
390remains \s-1DER\s0.
984263bc 391.SH "EXIT CODES"
8b0cefbb
JR
392.IX Header "EXIT CODES"
393.IP "0" 4
984263bc 394the operation was completely successfully.
8b0cefbb
JR
395.IP "1" 4
396.IX Item "1"
984263bc 397an error occurred parsing the command options.
8b0cefbb
JR
398.IP "2" 4
399.IX Item "2"
984263bc 400one of the input files could not be read.
8b0cefbb
JR
401.IP "3" 4
402.IX Item "3"
403an error occurred creating the PKCS#7 file or when reading the \s-1MIME\s0
984263bc 404message.
8b0cefbb
JR
405.IP "4" 4
406.IX Item "4"
984263bc 407an error occurred decrypting or verifying the message.
8b0cefbb
JR
408.IP "5" 4
409.IX Item "5"
984263bc
MD
410the message was verified correctly but an error occurred writing out
411the signers certificates.
412.SH "EXAMPLES"
8b0cefbb 413.IX Header "EXAMPLES"
984263bc
MD
414Create a cleartext signed message:
415.PP
416.Vb 2
e257b235
PA
417\& openssl smime \-sign \-in message.txt \-text \-out mail.msg \e
418\& \-signer mycert.pem
984263bc 419.Ve
8b0cefbb 420.PP
b28f31b7 421Create an opaque signed message:
984263bc
MD
422.PP
423.Vb 2
e257b235
PA
424\& openssl smime \-sign \-in message.txt \-text \-out mail.msg \-nodetach \e
425\& \-signer mycert.pem
984263bc 426.Ve
8b0cefbb 427.PP
984263bc
MD
428Create a signed message, include some additional certificates and
429read the private key from another file:
430.PP
431.Vb 2
e257b235
PA
432\& openssl smime \-sign \-in in.txt \-text \-out mail.msg \e
433\& \-signer mycert.pem \-inkey mykey.pem \-certfile mycerts.pem
984263bc 434.Ve
8b0cefbb 435.PP
01185282
PA
436Create a signed message with two signers:
437.PP
438.Vb 2
439\& openssl smime \-sign \-in message.txt \-text \-out mail.msg \e
440\& \-signer mycert.pem \-signer othercert.pem
441.Ve
442.PP
984263bc
MD
443Send a signed message under Unix directly to sendmail, including headers:
444.PP
445.Vb 3
e257b235
PA
446\& openssl smime \-sign \-in in.txt \-text \-signer mycert.pem \e
447\& \-from steve@openssl.org \-to someone@somewhere \e
448\& \-subject "Signed message" | sendmail someone@somewhere
984263bc 449.Ve
8b0cefbb 450.PP
984263bc
MD
451Verify a message and extract the signer's certificate if successful:
452.PP
453.Vb 1
e257b235 454\& openssl smime \-verify \-in mail.msg \-signer user.pem \-out signedtext.txt
984263bc 455.Ve
8b0cefbb
JR
456.PP
457Send encrypted mail using triple \s-1DES:\s0
984263bc
MD
458.PP
459.Vb 3
e257b235
PA
460\& openssl smime \-encrypt \-in in.txt \-from steve@openssl.org \e
461\& \-to someone@somewhere \-subject "Encrypted message" \e
462\& \-des3 user.pem \-out mail.msg
984263bc 463.Ve
8b0cefbb 464.PP
984263bc
MD
465Sign and encrypt mail:
466.PP
467.Vb 4
e257b235
PA
468\& openssl smime \-sign \-in ml.txt \-signer my.pem \-text \e
469\& | openssl smime \-encrypt \-out mail.msg \e
470\& \-from steve@openssl.org \-to someone@somewhere \e
471\& \-subject "Signed and Encrypted message" \-des3 user.pem
984263bc 472.Ve
8b0cefbb 473.PP
01185282
PA
474Note: the encryption command does not include the \fB\-text\fR option because the
475message being encrypted already has \s-1MIME\s0 headers.
984263bc
MD
476.PP
477Decrypt mail:
478.PP
479.Vb 1
e257b235 480\& openssl smime \-decrypt \-in mail.msg \-recip mycert.pem \-inkey key.pem
984263bc 481.Ve
8b0cefbb 482.PP
984263bc
MD
483The output from Netscape form signing is a PKCS#7 structure with the
484detached signature format. You can use this program to verify the
485signature by line wrapping the base64 encoded structure and surrounding
486it with:
487.PP
488.Vb 2
e257b235
PA
489\& \-\-\-\-\-BEGIN PKCS7\-\-\-\-\-
490\& \-\-\-\-\-END PKCS7\-\-\-\-\-
984263bc 491.Ve
8b0cefbb 492.PP
b28f31b7 493and using the command:
984263bc
MD
494.PP
495.Vb 1
e257b235 496\& openssl smime \-verify \-inform PEM \-in signature.pem \-content content.txt
984263bc 497.Ve
8b0cefbb 498.PP
b28f31b7 499Alternatively you can base64 decode the signature and use:
984263bc
MD
500.PP
501.Vb 1
e257b235 502\& openssl smime \-verify \-inform DER \-in signature.der \-content content.txt
984263bc 503.Ve
c6e28a8e
SS
504.PP
505Create an encrypted message using 128 bit Camellia:
506.PP
507.Vb 1
e257b235 508\& openssl smime \-encrypt \-in plain.txt \-camellia128 \-out mail.msg cert.pem
c6e28a8e 509.Ve
01185282
PA
510.PP
511Add a signer to an existing message:
512.PP
513.Vb 1
514\& openssl smime \-resign \-in mail.msg \-signer newsign.pem \-out mail2.msg
515.Ve
984263bc 516.SH "BUGS"
8b0cefbb 517.IX Header "BUGS"
01185282
PA
518The \s-1MIME\s0 parser isn't very clever: it seems to handle most messages that I've
519thrown at it but it may choke on others.
984263bc 520.PP
01185282
PA
521The code currently will only write out the signer's certificate to a file: if
522the signer has a separate encryption certificate this must be manually
523extracted. There should be some heuristic that determines the correct
524encryption certificate.
984263bc 525.PP
01185282
PA
526Ideally a database should be maintained of a certificates for each email
527address.
984263bc
MD
528.PP
529The code doesn't currently take note of the permitted symmetric encryption
b28f31b7 530algorithms as supplied in the SMIMECapabilities signed attribute. This means the
984263bc
MD
531user has to manually include the correct encryption algorithm. It should store
532the list of permitted ciphers in a database and only use those.
533.PP
534No revocation checking is done on the signer's certificate.
535.PP
536The current code can only handle S/MIME v2 messages, the more complex S/MIME v3
537structures may cause parsing errors.
01185282
PA
538.SH "HISTORY"
539.IX Header "HISTORY"
540The use of multiple \fB\-signer\fR options and the \fB\-resign\fR command were first
541added in OpenSSL 1.0.0