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