smime.1 20 KB

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