cms.1 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  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 "CMS 1"
  132. .TH CMS 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. cms \- CMS utility
  139. .SH "SYNOPSIS"
  140. .IX Header "SYNOPSIS"
  141. \&\fBopenssl\fR \fBcms\fR
  142. [\fB\-encrypt\fR]
  143. [\fB\-decrypt\fR]
  144. [\fB\-sign\fR]
  145. [\fB\-verify\fR]
  146. [\fB\-cmsout\fR]
  147. [\fB\-resign\fR]
  148. [\fB\-data_create\fR]
  149. [\fB\-data_out\fR]
  150. [\fB\-digest_create\fR]
  151. [\fB\-digest_verify\fR]
  152. [\fB\-compress\fR]
  153. [\fB\-uncompress\fR]
  154. [\fB\-EncryptedData_encrypt\fR]
  155. [\fB\-sign_receipt\fR]
  156. [\fB\-verify_receipt receipt\fR]
  157. [\fB\-in filename\fR]
  158. [\fB\-inform SMIME|PEM|DER\fR]
  159. [\fB\-rctform SMIME|PEM|DER\fR]
  160. [\fB\-out filename\fR]
  161. [\fB\-outform SMIME|PEM|DER\fR]
  162. [\fB\-stream \-indef \-noindef\fR]
  163. [\fB\-noindef\fR]
  164. [\fB\-content filename\fR]
  165. [\fB\-text\fR]
  166. [\fB\-noout\fR]
  167. [\fB\-print\fR]
  168. [\fB\-CAfile file\fR]
  169. [\fB\-CApath dir\fR]
  170. [\fB\-no_alt_chains\fR]
  171. [\fB\-md digest\fR]
  172. [\fB\-[cipher]\fR]
  173. [\fB\-nointern\fR]
  174. [\fB\-no_signer_cert_verify\fR]
  175. [\fB\-nocerts\fR]
  176. [\fB\-noattr\fR]
  177. [\fB\-nosmimecap\fR]
  178. [\fB\-binary\fR]
  179. [\fB\-nodetach\fR]
  180. [\fB\-certfile file\fR]
  181. [\fB\-certsout file\fR]
  182. [\fB\-signer file\fR]
  183. [\fB\-recip file\fR]
  184. [\fB\-keyid\fR]
  185. [\fB\-receipt_request_all \-receipt_request_first\fR]
  186. [\fB\-receipt_request_from emailaddress\fR]
  187. [\fB\-receipt_request_to emailaddress\fR]
  188. [\fB\-receipt_request_print\fR]
  189. [\fB\-secretkey key\fR]
  190. [\fB\-secretkeyid id\fR]
  191. [\fB\-econtent_type type\fR]
  192. [\fB\-inkey file\fR]
  193. [\fB\-keyopt name:parameter\fR]
  194. [\fB\-passin arg\fR]
  195. [\fB\-rand file(s)\fR]
  196. [\fBcert.pem...\fR]
  197. [\fB\-to addr\fR]
  198. [\fB\-from addr\fR]
  199. [\fB\-subject subj\fR]
  200. [cert.pem]...
  201. .SH "DESCRIPTION"
  202. .IX Header "DESCRIPTION"
  203. The \fBcms\fR command handles S/MIME v3.1 mail. It can encrypt, decrypt, sign and
  204. verify, compress and uncompress S/MIME messages.
  205. .SH "COMMAND OPTIONS"
  206. .IX Header "COMMAND OPTIONS"
  207. There are fourteen operation options that set the type of operation to be
  208. performed. The meaning of the other options varies according to the operation
  209. type.
  210. .IP "\fB\-encrypt\fR" 4
  211. .IX Item "-encrypt"
  212. encrypt mail for the given recipient certificates. Input file is the message
  213. to be encrypted. The output file is the encrypted mail in \s-1MIME\s0 format. The
  214. actual \s-1CMS\s0 type is <B>EnvelopedData<B>.
  215. .IP "\fB\-decrypt\fR" 4
  216. .IX Item "-decrypt"
  217. decrypt mail using the supplied certificate and private key. Expects an
  218. encrypted mail message in \s-1MIME\s0 format for the input file. The decrypted mail
  219. is written to the output file.
  220. .IP "\fB\-debug_decrypt\fR" 4
  221. .IX Item "-debug_decrypt"
  222. this option sets the \fB\s-1CMS_DEBUG_DECRYPT\s0\fR flag. This option should be used
  223. with caution: see the notes section below.
  224. .IP "\fB\-sign\fR" 4
  225. .IX Item "-sign"
  226. sign mail using the supplied certificate and private key. Input file is
  227. the message to be signed. The signed message in \s-1MIME\s0 format is written
  228. to the output file.
  229. .IP "\fB\-verify\fR" 4
  230. .IX Item "-verify"
  231. verify signed mail. Expects a signed mail message on input and outputs
  232. the signed data. Both clear text and opaque signing is supported.
  233. .IP "\fB\-cmsout\fR" 4
  234. .IX Item "-cmsout"
  235. takes an input message and writes out a \s-1PEM\s0 encoded \s-1CMS\s0 structure.
  236. .IP "\fB\-resign\fR" 4
  237. .IX Item "-resign"
  238. resign a message: take an existing message and one or more new signers.
  239. .IP "\fB\-data_create\fR" 4
  240. .IX Item "-data_create"
  241. Create a \s-1CMS\s0 \fBData\fR type.
  242. .IP "\fB\-data_out\fR" 4
  243. .IX Item "-data_out"
  244. \&\fBData\fR type and output the content.
  245. .IP "\fB\-digest_create\fR" 4
  246. .IX Item "-digest_create"
  247. Create a \s-1CMS\s0 \fBDigestedData\fR type.
  248. .IP "\fB\-digest_verify\fR" 4
  249. .IX Item "-digest_verify"
  250. Verify a \s-1CMS\s0 \fBDigestedData\fR type and output the content.
  251. .IP "\fB\-compress\fR" 4
  252. .IX Item "-compress"
  253. Create a \s-1CMS\s0 \fBCompressedData\fR type. OpenSSL must be compiled with \fBzlib\fR
  254. support for this option to work, otherwise it will output an error.
  255. .IP "\fB\-uncompress\fR" 4
  256. .IX Item "-uncompress"
  257. Uncompress a \s-1CMS\s0 \fBCompressedData\fR type and output the content. OpenSSL must be
  258. compiled with \fBzlib\fR support for this option to work, otherwise it will
  259. output an error.
  260. .IP "\fB\-EncryptedData_encrypt\fR" 4
  261. .IX Item "-EncryptedData_encrypt"
  262. Encrypt content using supplied symmetric key and algorithm using a \s-1CMS\s0
  263. \&\fBEncrytedData\fR type and output the content.
  264. .IP "\fB\-sign_receipt\fR" 4
  265. .IX Item "-sign_receipt"
  266. Generate and output a signed receipt for the supplied message. The input
  267. message \fBmust\fR contain a signed receipt request. Functionality is otherwise
  268. similar to the \fB\-sign\fR operation.
  269. .IP "\fB\-verify_receipt receipt\fR" 4
  270. .IX Item "-verify_receipt receipt"
  271. Verify a signed receipt in filename \fBreceipt\fR. The input message \fBmust\fR
  272. contain the original receipt request. Functionality is otherwise similar
  273. to the \fB\-verify\fR operation.
  274. .IP "\fB\-in filename\fR" 4
  275. .IX Item "-in filename"
  276. the input message to be encrypted or signed or the message to be decrypted
  277. or verified.
  278. .IP "\fB\-inform SMIME|PEM|DER\fR" 4
  279. .IX Item "-inform SMIME|PEM|DER"
  280. this specifies the input format for the \s-1CMS\s0 structure. The default
  281. is \fB\s-1SMIME\s0\fR which reads an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
  282. format change this to expect \s-1PEM\s0 and \s-1DER\s0 format \s-1CMS\s0 structures
  283. instead. This currently only affects the input format of the \s-1CMS\s0
  284. structure, if no \s-1CMS\s0 structure is being input (for example with
  285. \&\fB\-encrypt\fR or \fB\-sign\fR) this option has no effect.
  286. .IP "\fB\-rctform SMIME|PEM|DER\fR" 4
  287. .IX Item "-rctform SMIME|PEM|DER"
  288. specify the format for a signed receipt for use with the \fB\-receipt_verify\fR
  289. operation.
  290. .IP "\fB\-out filename\fR" 4
  291. .IX Item "-out filename"
  292. the message text that has been decrypted or verified or the output \s-1MIME\s0
  293. format message that has been signed or verified.
  294. .IP "\fB\-outform SMIME|PEM|DER\fR" 4
  295. .IX Item "-outform SMIME|PEM|DER"
  296. this specifies the output format for the \s-1CMS\s0 structure. The default
  297. is \fB\s-1SMIME\s0\fR which writes an S/MIME format message. \fB\s-1PEM\s0\fR and \fB\s-1DER\s0\fR
  298. format change this to write \s-1PEM\s0 and \s-1DER\s0 format \s-1CMS\s0 structures
  299. instead. This currently only affects the output format of the \s-1CMS\s0
  300. structure, if no \s-1CMS\s0 structure is being output (for example with
  301. \&\fB\-verify\fR or \fB\-decrypt\fR) this option has no effect.
  302. .IP "\fB\-stream \-indef \-noindef\fR" 4
  303. .IX Item "-stream -indef -noindef"
  304. the \fB\-stream\fR and \fB\-indef\fR options are equivalent and enable streaming I/O
  305. for encoding operations. This permits single pass processing of data without
  306. the need to hold the entire contents in memory, potentially supporting very
  307. large files. Streaming is automatically set for S/MIME signing with detached
  308. data if the output format is \fB\s-1SMIME\s0\fR it is currently off by default for all
  309. other operations.
  310. .IP "\fB\-noindef\fR" 4
  311. .IX Item "-noindef"
  312. disable streaming I/O where it would produce and indefinite length constructed
  313. encoding. This option currently has no effect. In future streaming will be
  314. enabled by default on all relevant operations and this option will disable it.
  315. .IP "\fB\-content filename\fR" 4
  316. .IX Item "-content filename"
  317. This specifies a file containing the detached content, this is only
  318. useful with the \fB\-verify\fR command. This is only usable if the \s-1CMS\s0
  319. structure is using the detached signature form where the content is
  320. not included. This option will override any content if the input format
  321. is S/MIME and it uses the multipart/signed \s-1MIME\s0 content type.
  322. .IP "\fB\-text\fR" 4
  323. .IX Item "-text"
  324. this option adds plain text (text/plain) \s-1MIME\s0 headers to the supplied
  325. message if encrypting or signing. If decrypting or verifying it strips
  326. off text headers: if the decrypted or verified message is not of \s-1MIME\s0
  327. type text/plain then an error occurs.
  328. .IP "\fB\-noout\fR" 4
  329. .IX Item "-noout"
  330. for the \fB\-cmsout\fR operation do not output the parsed \s-1CMS\s0 structure. This
  331. is useful when combined with the \fB\-print\fR option or if the syntax of the \s-1CMS\s0
  332. structure is being checked.
  333. .IP "\fB\-print\fR" 4
  334. .IX Item "-print"
  335. for the \fB\-cmsout\fR operation print out all fields of the \s-1CMS\s0 structure. This
  336. is mainly useful for testing purposes.
  337. .IP "\fB\-CAfile file\fR" 4
  338. .IX Item "-CAfile file"
  339. a file containing trusted \s-1CA\s0 certificates, only used with \fB\-verify\fR.
  340. .IP "\fB\-CApath dir\fR" 4
  341. .IX Item "-CApath dir"
  342. a directory containing trusted \s-1CA\s0 certificates, only used with
  343. \&\fB\-verify\fR. This directory must be a standard certificate directory: that
  344. is a hash of each subject name (using \fBx509 \-hash\fR) should be linked
  345. to each certificate.
  346. .IP "\fB\-md digest\fR" 4
  347. .IX Item "-md digest"
  348. digest algorithm to use when signing or resigning. If not present then the
  349. default digest algorithm for the signing key will be used (usually \s-1SHA1\s0).
  350. .IP "\fB\-[cipher]\fR" 4
  351. .IX Item "-[cipher]"
  352. the encryption algorithm to use. For example triple \s-1DES\s0 (168 bits) \- \fB\-des3\fR
  353. or 256 bit \s-1AES\s0 \- \fB\-aes256\fR. Any standard algorithm name (as used by the
  354. \&\fIEVP_get_cipherbyname()\fR function) can also be used preceded by a dash, for
  355. example \fB\-aes_128_cbc\fR. See \fBenc\fR for a list of ciphers
  356. supported by your version of OpenSSL.
  357. .Sp
  358. If not specified triple \s-1DES\s0 is used. Only used with \fB\-encrypt\fR and
  359. \&\fB\-EncryptedData_create\fR commands.
  360. .IP "\fB\-nointern\fR" 4
  361. .IX Item "-nointern"
  362. when verifying a message normally certificates (if any) included in
  363. the message are searched for the signing certificate. With this option
  364. only the certificates specified in the \fB\-certfile\fR option are used.
  365. The supplied certificates can still be used as untrusted CAs however.
  366. .IP "\fB\-no_signer_cert_verify\fR" 4
  367. .IX Item "-no_signer_cert_verify"
  368. do not verify the signers certificate of a signed message.
  369. .IP "\fB\-nocerts\fR" 4
  370. .IX Item "-nocerts"
  371. when signing a message the signer's certificate is normally included
  372. with this option it is excluded. This will reduce the size of the
  373. signed message but the verifier must have a copy of the signers certificate
  374. available locally (passed using the \fB\-certfile\fR option for example).
  375. .IP "\fB\-noattr\fR" 4
  376. .IX Item "-noattr"
  377. normally when a message is signed a set of attributes are included which
  378. include the signing time and supported symmetric algorithms. With this
  379. option they are not included.
  380. .IP "\fB\-nosmimecap\fR" 4
  381. .IX Item "-nosmimecap"
  382. exclude the list of supported algorithms from signed attributes, other options
  383. such as signing time and content type are still included.
  384. .IP "\fB\-binary\fR" 4
  385. .IX Item "-binary"
  386. normally the input message is converted to \*(L"canonical\*(R" format which is
  387. effectively using \s-1CR\s0 and \s-1LF\s0 as end of line: as required by the S/MIME
  388. specification. When this option is present no translation occurs. This
  389. is useful when handling binary data which may not be in \s-1MIME\s0 format.
  390. .IP "\fB\-nodetach\fR" 4
  391. .IX Item "-nodetach"
  392. when signing a message use opaque signing: this form is more resistant
  393. to translation by mail relays but it cannot be read by mail agents that
  394. do not support S/MIME. Without this option cleartext signing with
  395. the \s-1MIME\s0 type multipart/signed is used.
  396. .IP "\fB\-certfile file\fR" 4
  397. .IX Item "-certfile file"
  398. allows additional certificates to be specified. When signing these will
  399. be included with the message. When verifying these will be searched for
  400. the signers certificates. The certificates should be in \s-1PEM\s0 format.
  401. .IP "\fB\-certsout file\fR" 4
  402. .IX Item "-certsout file"
  403. any certificates contained in the message are written to \fBfile\fR.
  404. .IP "\fB\-signer file\fR" 4
  405. .IX Item "-signer file"
  406. a signing certificate when signing or resigning a message, this option can be
  407. used multiple times if more than one signer is required. If a message is being
  408. verified then the signers certificates will be written to this file if the
  409. verification was successful.
  410. .IP "\fB\-recip file\fR" 4
  411. .IX Item "-recip file"
  412. when decrypting a message this specifies the recipients certificate. The
  413. certificate must match one of the recipients of the message or an error
  414. occurs.
  415. .Sp
  416. When encrypting a message this option may be used multiple times to specify
  417. each recipient. This form \fBmust\fR be used if customised parameters are
  418. required (for example to specify RSA-OAEP).
  419. .IP "\fB\-keyid\fR" 4
  420. .IX Item "-keyid"
  421. use subject key identifier to identify certificates instead of issuer name and
  422. serial number. The supplied certificate \fBmust\fR include a subject key
  423. identifier extension. Supported by \fB\-sign\fR and \fB\-encrypt\fR options.
  424. .IP "\fB\-receipt_request_all \-receipt_request_first\fR" 4
  425. .IX Item "-receipt_request_all -receipt_request_first"
  426. for \fB\-sign\fR option include a signed receipt request. Indicate requests should
  427. be provided by all receipient or first tier recipients (those mailed directly
  428. and not from a mailing list). Ignored it \fB\-receipt_request_from\fR is included.
  429. .IP "\fB\-receipt_request_from emailaddress\fR" 4
  430. .IX Item "-receipt_request_from emailaddress"
  431. for \fB\-sign\fR option include a signed receipt request. Add an explicit email
  432. address where receipts should be supplied.
  433. .IP "\fB\-receipt_request_to emailaddress\fR" 4
  434. .IX Item "-receipt_request_to emailaddress"
  435. Add an explicit email address where signed receipts should be sent to. This
  436. option \fBmust\fR but supplied if a signed receipt it requested.
  437. .IP "\fB\-receipt_request_print\fR" 4
  438. .IX Item "-receipt_request_print"
  439. For the \fB\-verify\fR operation print out the contents of any signed receipt
  440. requests.
  441. .IP "\fB\-secretkey key\fR" 4
  442. .IX Item "-secretkey key"
  443. specify symmetric key to use. The key must be supplied in hex format and be
  444. consistent with the algorithm used. Supported by the \fB\-EncryptedData_encrypt\fR
  445. \&\fB\-EncrryptedData_decrypt\fR, \fB\-encrypt\fR and \fB\-decrypt\fR options. When used
  446. with \fB\-encrypt\fR or \fB\-decrypt\fR the supplied key is used to wrap or unwrap the
  447. content encryption key using an \s-1AES\s0 key in the \fBKEKRecipientInfo\fR type.
  448. .IP "\fB\-secretkeyid id\fR" 4
  449. .IX Item "-secretkeyid id"
  450. the key identifier for the supplied symmetric key for \fBKEKRecipientInfo\fR type.
  451. This option \fBmust\fR be present if the \fB\-secretkey\fR option is used with
  452. \&\fB\-encrypt\fR. With \fB\-decrypt\fR operations the \fBid\fR is used to locate the
  453. relevant key if it is not supplied then an attempt is used to decrypt any
  454. \&\fBKEKRecipientInfo\fR structures.
  455. .IP "\fB\-econtent_type type\fR" 4
  456. .IX Item "-econtent_type type"
  457. set the encapsulated content type to \fBtype\fR if not supplied the \fBData\fR type
  458. is used. The \fBtype\fR argument can be any valid \s-1OID\s0 name in either text or
  459. numerical format.
  460. .IP "\fB\-inkey file\fR" 4
  461. .IX Item "-inkey file"
  462. the private key to use when signing or decrypting. This must match the
  463. corresponding certificate. If this option is not specified then the
  464. private key must be included in the certificate file specified with
  465. the \fB\-recip\fR or \fB\-signer\fR file. When signing this option can be used
  466. multiple times to specify successive keys.
  467. .IP "\fB\-keyopt name:opt\fR" 4
  468. .IX Item "-keyopt name:opt"
  469. for signing and encryption this option can be used multiple times to
  470. set customised parameters for the preceding key or certificate. It can
  471. currently be used to set RSA-PSS for signing, RSA-OAEP for encryption
  472. or to modify default parameters for \s-1ECDH.\s0
  473. .IP "\fB\-passin arg\fR" 4
  474. .IX Item "-passin arg"
  475. the private key password source. For more information about the format of \fBarg\fR
  476. see the \fB\s-1PASS PHRASE ARGUMENTS\s0\fR section in \fIopenssl\fR\|(1).
  477. .IP "\fB\-rand file(s)\fR" 4
  478. .IX Item "-rand file(s)"
  479. a file or files containing random data used to seed the random number
  480. generator, or an \s-1EGD\s0 socket (see \fIRAND_egd\fR\|(3)).
  481. Multiple files can be specified separated by a OS-dependent character.
  482. The separator is \fB;\fR for MS-Windows, \fB,\fR for OpenVMS, and \fB:\fR for
  483. all others.
  484. .IP "\fBcert.pem...\fR" 4
  485. .IX Item "cert.pem..."
  486. one or more certificates of message recipients: used when encrypting
  487. a message.
  488. .IP "\fB\-to, \-from, \-subject\fR" 4
  489. .IX Item "-to, -from, -subject"
  490. the relevant mail headers. These are included outside the signed
  491. portion of a message so they may be included manually. If signing
  492. then many S/MIME mail clients check the signers certificate's email
  493. address matches that specified in the From: address.
  494. .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
  495. .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"
  496. Set various certificate chain valiadition option. See the
  497. \&\fBverify\fR manual page for details.
  498. .SH "NOTES"
  499. .IX Header "NOTES"
  500. The \s-1MIME\s0 message must be sent without any blank lines between the
  501. headers and the output. Some mail programs will automatically add
  502. a blank line. Piping the mail directly to sendmail is one way to
  503. achieve the correct format.
  504. .PP
  505. The supplied message to be signed or encrypted must include the
  506. necessary \s-1MIME\s0 headers or many S/MIME clients wont display it
  507. properly (if at all). You can use the \fB\-text\fR option to automatically
  508. add plain text headers.
  509. .PP
  510. A \*(L"signed and encrypted\*(R" message is one where a signed message is
  511. then encrypted. This can be produced by encrypting an already signed
  512. message: see the examples section.
  513. .PP
  514. This version of the program only allows one signer per message but it
  515. will verify multiple signers on received messages. Some S/MIME clients
  516. choke if a message contains multiple signers. It is possible to sign
  517. messages \*(L"in parallel\*(R" by signing an already signed message.
  518. .PP
  519. The options \fB\-encrypt\fR and \fB\-decrypt\fR reflect common usage in S/MIME
  520. clients. Strictly speaking these process \s-1CMS\s0 enveloped data: \s-1CMS\s0
  521. encrypted data is used for other purposes.
  522. .PP
  523. The \fB\-resign\fR option uses an existing message digest when adding a new
  524. signer. This means that attributes must be present in at least one existing
  525. signer using the same message digest or this operation will fail.
  526. .PP
  527. The \fB\-stream\fR and \fB\-indef\fR options enable experimental streaming I/O support.
  528. As a result the encoding is \s-1BER\s0 using indefinite length constructed encoding
  529. and no longer \s-1DER.\s0 Streaming is supported for the \fB\-encrypt\fR operation and the
  530. \&\fB\-sign\fR operation if the content is not detached.
  531. .PP
  532. Streaming is always used for the \fB\-sign\fR operation with detached data but
  533. since the content is no longer part of the \s-1CMS\s0 structure the encoding
  534. remains \s-1DER.\s0
  535. .PP
  536. If the \fB\-decrypt\fR option is used without a recipient certificate then an
  537. attempt is made to locate the recipient by trying each potential recipient
  538. in turn using the supplied private key. To thwart the \s-1MMA\s0 attack
  539. (Bleichenbacher's attack on \s-1PKCS\s0 #1 v1.5 \s-1RSA\s0 padding) all recipients are
  540. tried whether they succeed or not and if no recipients match the message
  541. is \*(L"decrypted\*(R" using a random key which will typically output garbage.
  542. The \fB\-debug_decrypt\fR option can be used to disable the \s-1MMA\s0 attack protection
  543. and return an error if no recipient can be found: this option should be used
  544. with caution. For a fuller description see \fICMS_decrypt\fR\|(3)).
  545. .SH "EXIT CODES"
  546. .IX Header "EXIT CODES"
  547. .IP "0" 4
  548. the operation was completely successfully.
  549. .IP "1" 4
  550. .IX Item "1"
  551. an error occurred parsing the command options.
  552. .IP "2" 4
  553. .IX Item "2"
  554. one of the input files could not be read.
  555. .IP "3" 4
  556. .IX Item "3"
  557. an error occurred creating the \s-1CMS\s0 file or when reading the \s-1MIME\s0
  558. message.
  559. .IP "4" 4
  560. .IX Item "4"
  561. an error occurred decrypting or verifying the message.
  562. .IP "5" 4
  563. .IX Item "5"
  564. the message was verified correctly but an error occurred writing out
  565. the signers certificates.
  566. .SH "COMPATIBILITY WITH PKCS#7 format."
  567. .IX Header "COMPATIBILITY WITH PKCS#7 format."
  568. The \fBsmime\fR utility can only process the older \fBPKCS#7\fR format. The \fBcms\fR
  569. utility supports Cryptographic Message Syntax format. Use of some features
  570. will result in messages which cannot be processed by applications which only
  571. support the older format. These are detailed below.
  572. .PP
  573. The use of the \fB\-keyid\fR option with \fB\-sign\fR or \fB\-encrypt\fR.
  574. .PP
  575. The \fB\-outform \s-1PEM\s0\fR option uses different headers.
  576. .PP
  577. The \fB\-compress\fR option.
  578. .PP
  579. The \fB\-secretkey\fR option when used with \fB\-encrypt\fR.
  580. .PP
  581. The use of \s-1PSS\s0 with \fB\-sign\fR.
  582. .PP
  583. The use of \s-1OAEP\s0 or non-RSA keys with \fB\-encrypt\fR.
  584. .PP
  585. Additionally the \fB\-EncryptedData_create\fR and \fB\-data_create\fR type cannot
  586. be processed by the older \fBsmime\fR command.
  587. .SH "EXAMPLES"
  588. .IX Header "EXAMPLES"
  589. Create a cleartext signed message:
  590. .PP
  591. .Vb 2
  592. \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
  593. \& \-signer mycert.pem
  594. .Ve
  595. .PP
  596. Create an opaque signed message
  597. .PP
  598. .Vb 2
  599. \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \-nodetach \e
  600. \& \-signer mycert.pem
  601. .Ve
  602. .PP
  603. Create a signed message, include some additional certificates and
  604. read the private key from another file:
  605. .PP
  606. .Vb 2
  607. \& openssl cms \-sign \-in in.txt \-text \-out mail.msg \e
  608. \& \-signer mycert.pem \-inkey mykey.pem \-certfile mycerts.pem
  609. .Ve
  610. .PP
  611. Create a signed message with two signers, use key identifier:
  612. .PP
  613. .Vb 2
  614. \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
  615. \& \-signer mycert.pem \-signer othercert.pem \-keyid
  616. .Ve
  617. .PP
  618. Send a signed message under Unix directly to sendmail, including headers:
  619. .PP
  620. .Vb 3
  621. \& openssl cms \-sign \-in in.txt \-text \-signer mycert.pem \e
  622. \& \-from steve@openssl.org \-to someone@somewhere \e
  623. \& \-subject "Signed message" | sendmail someone@somewhere
  624. .Ve
  625. .PP
  626. Verify a message and extract the signer's certificate if successful:
  627. .PP
  628. .Vb 1
  629. \& openssl cms \-verify \-in mail.msg \-signer user.pem \-out signedtext.txt
  630. .Ve
  631. .PP
  632. Send encrypted mail using triple \s-1DES:\s0
  633. .PP
  634. .Vb 3
  635. \& openssl cms \-encrypt \-in in.txt \-from steve@openssl.org \e
  636. \& \-to someone@somewhere \-subject "Encrypted message" \e
  637. \& \-des3 user.pem \-out mail.msg
  638. .Ve
  639. .PP
  640. Sign and encrypt mail:
  641. .PP
  642. .Vb 4
  643. \& openssl cms \-sign \-in ml.txt \-signer my.pem \-text \e
  644. \& | openssl cms \-encrypt \-out mail.msg \e
  645. \& \-from steve@openssl.org \-to someone@somewhere \e
  646. \& \-subject "Signed and Encrypted message" \-des3 user.pem
  647. .Ve
  648. .PP
  649. Note: the encryption command does not include the \fB\-text\fR option because the
  650. message being encrypted already has \s-1MIME\s0 headers.
  651. .PP
  652. Decrypt mail:
  653. .PP
  654. .Vb 1
  655. \& openssl cms \-decrypt \-in mail.msg \-recip mycert.pem \-inkey key.pem
  656. .Ve
  657. .PP
  658. The output from Netscape form signing is a PKCS#7 structure with the
  659. detached signature format. You can use this program to verify the
  660. signature by line wrapping the base64 encoded structure and surrounding
  661. it with:
  662. .PP
  663. .Vb 2
  664. \& \-\-\-\-\-BEGIN PKCS7\-\-\-\-\-
  665. \& \-\-\-\-\-END PKCS7\-\-\-\-\-
  666. .Ve
  667. .PP
  668. and using the command,
  669. .PP
  670. .Vb 1
  671. \& openssl cms \-verify \-inform PEM \-in signature.pem \-content content.txt
  672. .Ve
  673. .PP
  674. alternatively you can base64 decode the signature and use
  675. .PP
  676. .Vb 1
  677. \& openssl cms \-verify \-inform DER \-in signature.der \-content content.txt
  678. .Ve
  679. .PP
  680. Create an encrypted message using 128 bit Camellia:
  681. .PP
  682. .Vb 1
  683. \& openssl cms \-encrypt \-in plain.txt \-camellia128 \-out mail.msg cert.pem
  684. .Ve
  685. .PP
  686. Add a signer to an existing message:
  687. .PP
  688. .Vb 1
  689. \& openssl cms \-resign \-in mail.msg \-signer newsign.pem \-out mail2.msg
  690. .Ve
  691. .PP
  692. Sign mail using RSA-PSS:
  693. .PP
  694. .Vb 2
  695. \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
  696. \& \-signer mycert.pem \-keyopt rsa_padding_mode:pss
  697. .Ve
  698. .PP
  699. Create encrypted mail using RSA-OAEP:
  700. .PP
  701. .Vb 2
  702. \& openssl cms \-encrypt \-in plain.txt \-out mail.msg \e
  703. \& \-recip cert.pem \-keyopt rsa_padding_mode:oaep
  704. .Ve
  705. .PP
  706. Use \s-1SHA256 KDF\s0 with an \s-1ECDH\s0 certificate:
  707. .PP
  708. .Vb 2
  709. \& openssl cms \-encrypt \-in plain.txt \-out mail.msg \e
  710. \& \-recip ecdhcert.pem \-keyopt ecdh_kdf_md:sha256
  711. .Ve
  712. .SH "BUGS"
  713. .IX Header "BUGS"
  714. The \s-1MIME\s0 parser isn't very clever: it seems to handle most messages that I've
  715. thrown at it but it may choke on others.
  716. .PP
  717. The code currently will only write out the signer's certificate to a file: if
  718. the signer has a separate encryption certificate this must be manually
  719. extracted. There should be some heuristic that determines the correct
  720. encryption certificate.
  721. .PP
  722. Ideally a database should be maintained of a certificates for each email
  723. address.
  724. .PP
  725. The code doesn't currently take note of the permitted symmetric encryption
  726. algorithms as supplied in the SMIMECapabilities signed attribute. this means the
  727. user has to manually include the correct encryption algorithm. It should store
  728. the list of permitted ciphers in a database and only use those.
  729. .PP
  730. No revocation checking is done on the signer's certificate.
  731. .SH "HISTORY"
  732. .IX Header "HISTORY"
  733. The use of multiple \fB\-signer\fR options and the \fB\-resign\fR command were first
  734. added in OpenSSL 1.0.0
  735. .PP
  736. The \fBkeyopt\fR option was first added in OpenSSL 1.1.0
  737. .PP
  738. The use of \fB\-recip\fR to specify the recipient when encrypting mail was first
  739. added to OpenSSL 1.1.0
  740. .PP
  741. Support for RSA-OAEP and RSA-PSS was first added to OpenSSL 1.1.0.
  742. .PP
  743. The use of non-RSA keys with \fB\-encrypt\fR and \fB\-decrypt\fR was first added
  744. to OpenSSL 1.1.0.
  745. .PP
  746. The \-no_alt_chains options was first added to OpenSSL 1.0.2b.