Regenerate the manual pages after the OpenSSL update to 0.9.7e.
[dragonfly.git] / secure / usr.bin / openssl / man / smime.1
1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
25 ..
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  | will give a
29 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
32 .tr \(*W-|\(bv\*(Tr
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD.  Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
55 .if \nF \{\
56 .    de IX
57 .    tm Index:\\$1\t\\n%\t"\\$2"
58 ..
59 .    nr % 0
60 .    rr F
61 .\}
62 .\"
63 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
65 .hy 0
66 .if n .na
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 "2004-12-18" "0.9.7e" "OpenSSL"
133 .SH "NAME"
134 smime \- S/MIME utility
135 .SH "SYNOPSIS"
136 .IX Header "SYNOPSIS"
137 \&\fBopenssl\fR \fBsmime\fR
138 [\fB\-encrypt\fR]
139 [\fB\-decrypt\fR]
140 [\fB\-sign\fR]
141 [\fB\-verify\fR]
142 [\fB\-pk7out\fR]
143 [\fB\-des\fR]
144 [\fB\-des3\fR]
145 [\fB\-rc2\-40\fR]
146 [\fB\-rc2\-64\fR]
147 [\fB\-rc2\-128\fR]
148 [\fB\-aes128\fR]
149 [\fB\-aes192\fR]
150 [\fB\-aes256\fR]
151 [\fB\-in file\fR]
152 [\fB\-certfile file\fR]
153 [\fB\-signer file\fR]
154 [\fB\-recip  file\fR]
155 [\fB\-inform SMIME|PEM|DER\fR]
156 [\fB\-passin arg\fR]
157 [\fB\-inkey file\fR]
158 [\fB\-out file\fR]
159 [\fB\-outform SMIME|PEM|DER\fR]
160 [\fB\-content file\fR]
161 [\fB\-to addr\fR]
162 [\fB\-from ad\fR]
163 [\fB\-subject s\fR]
164 [\fB\-text\fR]
165 [\fB\-rand file(s)\fR]
166 [cert.pem]...
167 .SH "DESCRIPTION"
168 .IX Header "DESCRIPTION"
169 The \fBsmime\fR command handles S/MIME mail. It can encrypt, decrypt, sign and
170 verify S/MIME messages.
171 .SH "COMMAND OPTIONS"
172 .IX Header "COMMAND OPTIONS"
173 There are five operation options that set the type of operation to be performed.
174 The meaning of the other options varies according to the operation type.
175 .IP "\fB\-encrypt\fR" 4
176 .IX Item "-encrypt"
177 encrypt mail for the given recipient certificates. Input file is the message
178 to be encrypted. The output file is the encrypted mail in \s-1MIME\s0 format.
179 .IP "\fB\-decrypt\fR" 4
180 .IX Item "-decrypt"
181 decrypt mail using the supplied certificate and private key. Expects an
182 encrypted mail message in \s-1MIME\s0 format for the input file. The decrypted mail
183 is written to the output file.
184 .IP "\fB\-sign\fR" 4
185 .IX Item "-sign"
186 sign mail using the supplied certificate and private key. Input file is
187 the message to be signed. The signed message in \s-1MIME\s0 format is written
188 to the output file.
189 .IP "\fB\-verify\fR" 4
190 .IX Item "-verify"
191 verify signed mail. Expects a signed mail message on input and outputs
192 the signed data. Both clear text and opaque signing is supported.
193 .IP "\fB\-pk7out\fR" 4
194 .IX Item "-pk7out"
195 takes an input message and writes out a \s-1PEM\s0 encoded PKCS#7 structure.
196 .IP "\fB\-in filename\fR" 4
197 .IX Item "-in filename"
198 the input message to be encrypted or signed or the \s-1MIME\s0 message to
199 be decrypted or verified.
200 .IP "\fB\-inform SMIME|PEM|DER\fR" 4
201 .IX Item "-inform SMIME|PEM|DER"
202 this specifies the input format for the PKCS#7 structure. The default
203 is \fB\s-1SMIME\s0\fR which reads an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
204 format change this to expect \s-1PEM\s0 and \s-1DER\s0 format PKCS#7 structures
205 instead. This currently only affects the input format of the PKCS#7
206 structure, 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"
210 the message text that has been decrypted or verified or the output \s-1MIME\s0
211 format message that has been signed or verified.
212 .IP "\fB\-outform SMIME|PEM|DER\fR" 4
213 .IX Item "-outform SMIME|PEM|DER"
214 this specifies the output format for the PKCS#7 structure. The default
215 is \fB\s-1SMIME\s0\fR which write an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
216 format change this to write \s-1PEM\s0 and \s-1DER\s0 format PKCS#7 structures
217 instead. This currently only affects the output format of the PKCS#7
218 structure, if no PKCS#7 structure is being output (for example with
219 \&\fB\-verify\fR or \fB\-decrypt\fR) this option has no effect.
220 .IP "\fB\-content filename\fR" 4
221 .IX Item "-content filename"
222 This specifies a file containing the detached content, this is only
223 useful with the \fB\-verify\fR command. This is only usable if the PKCS#7
224 structure is using the detached signature form where the content is
225 not included. This option will override any content if the input format
226 is S/MIME and it uses the multipart/signed \s-1MIME\s0 content type.
227 .IP "\fB\-text\fR" 4
228 .IX Item "-text"
229 this option adds plain text (text/plain) \s-1MIME\s0 headers to the supplied
230 message if encrypting or signing. If decrypting or verifying it strips
231 off text headers: if the decrypted or verified message is not of \s-1MIME\s0 
232 type text/plain then an error occurs.
233 .IP "\fB\-CAfile file\fR" 4
234 .IX Item "-CAfile file"
235 a file containing trusted \s-1CA\s0 certificates, only used with \fB\-verify\fR.
236 .IP "\fB\-CApath dir\fR" 4
237 .IX Item "-CApath dir"
238 a directory containing trusted \s-1CA\s0 certificates, only used with
239 \&\fB\-verify\fR. This directory must be a standard certificate directory: that
240 is a hash of each subject name (using \fBx509 \-hash\fR) should be linked
241 to each certificate.
242 .IP "\fB\-des \-des3 \-rc2\-40 \-rc2\-64 \-rc2\-128 \-aes128 \-aes192 \-aes256\fR" 4
243 .IX Item "-des -des3 -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256"
244 the encryption algorithm to use. \s-1DES\s0 (56 bits), triple \s-1DES\s0 (168 bits),
245 40, 64 or 128 bit \s-1RC2\s0 or 128, 192 or 256 bit \s-1AES\s0 respectively.  If not
246 specified 40 bit \s-1RC2\s0 is used. Only used with \fB\-encrypt\fR.
247 .IP "\fB\-nointern\fR" 4
248 .IX Item "-nointern"
249 when verifying a message normally certificates (if any) included in
250 the message are searched for the signing certificate. With this option
251 only the certificates specified in the \fB\-certfile\fR option are used.
252 The supplied certificates can still be used as untrusted CAs however.
253 .IP "\fB\-noverify\fR" 4
254 .IX Item "-noverify"
255 do not verify the signers certificate of a signed message.
256 .IP "\fB\-nochain\fR" 4
257 .IX Item "-nochain"
258 do not do chain verification of signers certificates: that is don't
259 use the certificates in the signed message as untrusted CAs.
260 .IP "\fB\-nosigs\fR" 4
261 .IX Item "-nosigs"
262 don't try to verify the signatures on the message.
263 .IP "\fB\-nocerts\fR" 4
264 .IX Item "-nocerts"
265 when signing a message the signer's certificate is normally included
266 with this option it is excluded. This will reduce the size of the
267 signed message but the verifier must have a copy of the signers certificate
268 available locally (passed using the \fB\-certfile\fR option for example).
269 .IP "\fB\-noattr\fR" 4
270 .IX Item "-noattr"
271 normally when a message is signed a set of attributes are included which
272 include the signing time and supported symmetric algorithms. With this
273 option they are not included.
274 .IP "\fB\-binary\fR" 4
275 .IX Item "-binary"
276 normally the input message is converted to \*(L"canonical\*(R" format which is
277 effectively using \s-1CR\s0 and \s-1LF\s0 as end of line: as required by the S/MIME
278 specification. When this option is present no translation occurs. This
279 is useful when handling binary data which may not be in \s-1MIME\s0 format.
280 .IP "\fB\-nodetach\fR" 4
281 .IX Item "-nodetach"
282 when signing a message use opaque signing: this form is more resistant
283 to translation by mail relays but it cannot be read by mail agents that
284 do not support S/MIME.  Without this option cleartext signing with
285 the \s-1MIME\s0 type multipart/signed is used.
286 .IP "\fB\-certfile file\fR" 4
287 .IX Item "-certfile file"
288 allows additional certificates to be specified. When signing these will
289 be included with the message. When verifying these will be searched for
290 the signers certificates. The certificates should be in \s-1PEM\s0 format.
291 .IP "\fB\-signer file\fR" 4
292 .IX Item "-signer file"
293 the signers certificate when signing a message. If a message is
294 being verified then the signers certificates will be written to this
295 file if the verification was successful.
296 .IP "\fB\-recip file\fR" 4
297 .IX Item "-recip file"
298 the recipients certificate when decrypting a message. This certificate
299 must match one of the recipients of the message or an error occurs.
300 .IP "\fB\-inkey file\fR" 4
301 .IX Item "-inkey file"
302 the private key to use when signing or decrypting. This must match the
303 corresponding certificate. If this option is not specified then the
304 private key must be included in the certificate file specified with
305 the \fB\-recip\fR or \fB\-signer\fR file.
306 .IP "\fB\-passin arg\fR" 4
307 .IX Item "-passin arg"
308 the private key password source. For more information about the format of \fBarg\fR
309 see the \fB\s-1PASS\s0 \s-1PHRASE\s0 \s-1ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
310 .IP "\fB\-rand file(s)\fR" 4
311 .IX Item "-rand file(s)"
312 a file or files containing random data used to seed the random number
313 generator, or an \s-1EGD\s0 socket (see \fIRAND_egd\fR\|(3)).
314 Multiple files can be specified separated by a OS-dependent character.
315 The separator is \fB;\fR for MS\-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
316 all others.
317 .IP "\fBcert.pem...\fR" 4
318 .IX Item "cert.pem..."
319 one or more certificates of message recipients: used when encrypting
320 a message. 
321 .IP "\fB\-to, \-from, \-subject\fR" 4
322 .IX Item "-to, -from, -subject"
323 the relevant mail headers. These are included outside the signed
324 portion of a message so they may be included manually. If signing
325 then many S/MIME mail clients check the signers certificate's email
326 address matches that specified in the From: address.
327 .SH "NOTES"
328 .IX Header "NOTES"
329 The \s-1MIME\s0 message must be sent without any blank lines between the
330 headers and the output. Some mail programs will automatically add
331 a blank line. Piping the mail directly to sendmail is one way to
332 achieve the correct format.
333 .PP
334 The supplied message to be signed or encrypted must include the
335 necessary \s-1MIME\s0 headers or many S/MIME clients wont display it
336 properly (if at all). You can use the \fB\-text\fR option to automatically
337 add plain text headers.
338 .PP
339 A \*(L"signed and encrypted\*(R" message is one where a signed message is
340 then encrypted. This can be produced by encrypting an already signed
341 message: see the examples section.
342 .PP
343 This version of the program only allows one signer per message but it
344 will verify multiple signers on received messages. Some S/MIME clients
345 choke if a message contains multiple signers. It is possible to sign
346 messages \*(L"in parallel\*(R" by signing an already signed message.
347 .PP
348 The options \fB\-encrypt\fR and \fB\-decrypt\fR reflect common usage in S/MIME
349 clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7
350 encrypted data is used for other purposes.
351 .SH "EXIT CODES"
352 .IX Header "EXIT CODES"
353 .IP "0" 4
354 the operation was completely successfully.
355 .IP "1" 4
356 .IX Item "1"
357 an error occurred parsing the command options.
358 .IP "2" 4
359 .IX Item "2"
360 one of the input files could not be read.
361 .IP "3" 4
362 .IX Item "3"
363 an error occurred creating the PKCS#7 file or when reading the \s-1MIME\s0
364 message.
365 .IP "4" 4
366 .IX Item "4"
367 an error occurred decrypting or verifying the message.
368 .IP "5" 4
369 .IX Item "5"
370 the message was verified correctly but an error occurred writing out
371 the signers certificates.
372 .SH "EXAMPLES"
373 .IX Header "EXAMPLES"
374 Create a cleartext signed message:
375 .PP
376 .Vb 2
377 \& openssl smime -sign -in message.txt -text -out mail.msg \e
378 \&        -signer mycert.pem
379 .Ve
380 .PP
381 Create and opaque signed message
382 .PP
383 .Vb 2
384 \& openssl smime -sign -in message.txt -text -out mail.msg -nodetach \e
385 \&        -signer mycert.pem
386 .Ve
387 .PP
388 Create a signed message, include some additional certificates and
389 read the private key from another file:
390 .PP
391 .Vb 2
392 \& openssl smime -sign -in in.txt -text -out mail.msg \e
393 \&        -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem
394 .Ve
395 .PP
396 Send a signed message under Unix directly to sendmail, including headers:
397 .PP
398 .Vb 3
399 \& openssl smime -sign -in in.txt -text -signer mycert.pem \e
400 \&        -from steve@openssl.org -to someone@somewhere \e
401 \&        -subject "Signed message" | sendmail someone@somewhere
402 .Ve
403 .PP
404 Verify a message and extract the signer's certificate if successful:
405 .PP
406 .Vb 1
407 \& openssl smime -verify -in mail.msg -signer user.pem -out signedtext.txt
408 .Ve
409 .PP
410 Send encrypted mail using triple \s-1DES:\s0
411 .PP
412 .Vb 3
413 \& openssl smime -encrypt -in in.txt -from steve@openssl.org \e
414 \&        -to someone@somewhere -subject "Encrypted message" \e
415 \&        -des3 user.pem -out mail.msg
416 .Ve
417 .PP
418 Sign and encrypt mail:
419 .PP
420 .Vb 4
421 \& openssl smime -sign -in ml.txt -signer my.pem -text \e
422 \&        | openssl smime -encrypt -out mail.msg \e
423 \&        -from steve@openssl.org -to someone@somewhere \e
424 \&        -subject "Signed and Encrypted message" -des3 user.pem
425 .Ve
426 .PP
427 Note: the encryption command does not include the \fB\-text\fR option because the message
428 being encrypted already has \s-1MIME\s0 headers.
429 .PP
430 Decrypt mail:
431 .PP
432 .Vb 1
433 \& openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem
434 .Ve
435 .PP
436 The output from Netscape form signing is a PKCS#7 structure with the
437 detached signature format. You can use this program to verify the
438 signature by line wrapping the base64 encoded structure and surrounding
439 it with:
440 .PP
441 .Vb 2
442 \& -----BEGIN PKCS7-----
443 \& -----END PKCS7-----
444 .Ve
445 .PP
446 and using the command, 
447 .PP
448 .Vb 1
449 \& openssl smime -verify -inform PEM -in signature.pem -content content.txt
450 .Ve
451 .PP
452 alternatively you can base64 decode the signature and use
453 .PP
454 .Vb 1
455 \& openssl smime -verify -inform DER -in signature.der -content content.txt
456 .Ve
457 .SH "BUGS"
458 .IX Header "BUGS"
459 The \s-1MIME\s0 parser isn't very clever: it seems to handle most messages that I've thrown
460 at it but it may choke on others.
461 .PP
462 The code currently will only write out the signer's certificate to a file: if the
463 signer has a separate encryption certificate this must be manually extracted. There
464 should be some heuristic that determines the correct encryption certificate.
465 .PP
466 Ideally a database should be maintained of a certificates for each email address.
467 .PP
468 The code doesn't currently take note of the permitted symmetric encryption
469 algorithms as supplied in the SMIMECapabilities signed attribute. this means the
470 user has to manually include the correct encryption algorithm. It should store
471 the list of permitted ciphers in a database and only use those.
472 .PP
473 No revocation checking is done on the signer's certificate.
474 .PP
475 The current code can only handle S/MIME v2 messages, the more complex S/MIME v3
476 structures may cause parsing errors.