openssl-smime.1ossl 24 KB

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