openssl-cms.1ossl 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  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-CMS 1ossl"
  136. .TH OPENSSL-CMS 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\-cms \- CMS command
  143. .SH "SYNOPSIS"
  144. .IX Header "SYNOPSIS"
  145. \&\fBopenssl\fR \fBcms\fR
  146. [\fB\-help\fR]
  147. .PP
  148. General options:
  149. .PP
  150. [\fB\-in\fR \fIfilename\fR]
  151. [\fB\-out\fR \fIfilename\fR]
  152. [\fB\-config\fR \fIconfigfile\fR]
  153. .PP
  154. Operation options:
  155. .PP
  156. [\fB\-encrypt\fR]
  157. [\fB\-decrypt\fR]
  158. [\fB\-sign\fR]
  159. [\fB\-verify\fR]
  160. [\fB\-resign\fR]
  161. [\fB\-sign_receipt\fR]
  162. [\fB\-verify_receipt\fR \fIreceipt\fR]
  163. [\fB\-digest\fR \fIdigest\fR]
  164. [\fB\-digest_create\fR]
  165. [\fB\-digest_verify\fR]
  166. [\fB\-compress\fR]
  167. [\fB\-uncompress\fR]
  168. [\fB\-EncryptedData_encrypt\fR]
  169. [\fB\-EncryptedData_decrypt\fR]
  170. [\fB\-data_create\fR]
  171. [\fB\-data_out\fR]
  172. [\fB\-cmsout\fR]
  173. .PP
  174. File format options:
  175. .PP
  176. [\fB\-inform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR|\fB\s-1SMIME\s0\fR]
  177. [\fB\-outform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR|\fB\s-1SMIME\s0\fR]
  178. [\fB\-rctform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR|\fB\s-1SMIME\s0\fR]
  179. [\fB\-stream\fR]
  180. [\fB\-indef\fR]
  181. [\fB\-noindef\fR]
  182. [\fB\-binary\fR]
  183. [\fB\-crlfeol\fR]
  184. [\fB\-asciicrlf\fR]
  185. .PP
  186. Keys and password options:
  187. .PP
  188. [\fB\-pwri_password\fR \fIpassword\fR]
  189. [\fB\-secretkey\fR \fIkey\fR]
  190. [\fB\-secretkeyid\fR \fIid\fR]
  191. [\fB\-inkey\fR \fIfilename\fR|\fIuri\fR]
  192. [\fB\-passin\fR \fIarg\fR]
  193. [\fB\-keyopt\fR \fIname\fR:\fIparameter\fR]
  194. [\fB\-keyform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR|\fBP12\fR|\fB\s-1ENGINE\s0\fR]
  195. [\fB\-engine\fR \fIid\fR]
  196. [\fB\-provider\fR \fIname\fR]
  197. [\fB\-provider\-path\fR \fIpath\fR]
  198. [\fB\-propquery\fR \fIpropq\fR]
  199. [\fB\-rand\fR \fIfiles\fR]
  200. [\fB\-writerand\fR \fIfile\fR]
  201. .PP
  202. Encryption options:
  203. .PP
  204. [\fB\-originator\fR \fIfile\fR]
  205. [\fB\-recip\fR \fIfile\fR]
  206. [\fIrecipient-cert\fR ...]
  207. [\fB\-\f(BIcipher\fB\fR]
  208. [\fB\-wrap\fR \fIcipher\fR]
  209. [\fB\-aes128\-wrap\fR]
  210. [\fB\-aes192\-wrap\fR]
  211. [\fB\-aes256\-wrap\fR]
  212. [\fB\-des3\-wrap\fR]
  213. [\fB\-debug_decrypt\fR]
  214. .PP
  215. Signing options:
  216. .PP
  217. [\fB\-md\fR \fIdigest\fR]
  218. [\fB\-signer\fR \fIfile\fR]
  219. [\fB\-certfile\fR \fIfile\fR]
  220. [\fB\-cades\fR]
  221. [\fB\-nodetach\fR]
  222. [\fB\-nocerts\fR]
  223. [\fB\-noattr\fR]
  224. [\fB\-nosmimecap\fR]
  225. [\fB\-receipt_request_all\fR]
  226. [\fB\-receipt_request_first\fR]
  227. [\fB\-receipt_request_from\fR \fIemailaddress\fR]
  228. [\fB\-receipt_request_to\fR \fIemailaddress\fR]
  229. .PP
  230. Verification options:
  231. .PP
  232. [\fB\-signer\fR \fIfile\fR]
  233. [\fB\-content\fR \fIfilename\fR]
  234. [\fB\-no_content_verify\fR]
  235. [\fB\-no_attr_verify\fR]
  236. [\fB\-nosigs\fR]
  237. [\fB\-noverify\fR]
  238. [\fB\-nointern\fR]
  239. [\fB\-cades\fR]
  240. [\fB\-verify_retcode\fR]
  241. [\fB\-CAfile\fR \fIfile\fR]
  242. [\fB\-no\-CAfile\fR]
  243. [\fB\-CApath\fR \fIdir\fR]
  244. [\fB\-no\-CApath\fR]
  245. [\fB\-CAstore\fR \fIuri\fR]
  246. [\fB\-no\-CAstore\fR]
  247. .PP
  248. Output options:
  249. .PP
  250. [\fB\-keyid\fR]
  251. [\fB\-econtent_type\fR \fItype\fR]
  252. [\fB\-text\fR]
  253. [\fB\-certsout\fR \fIfile\fR]
  254. [\fB\-to\fR \fIaddr\fR]
  255. [\fB\-from\fR \fIaddr\fR]
  256. [\fB\-subject\fR \fIsubj\fR]
  257. .PP
  258. Printing options:
  259. .PP
  260. [\fB\-noout\fR]
  261. [\fB\-print\fR]
  262. [\fB\-nameopt\fR \fIoption\fR]
  263. [\fB\-receipt_request_print\fR]
  264. .PP
  265. Validation options:
  266. .PP
  267. [\fB\-allow_proxy_certs\fR]
  268. [\fB\-attime\fR \fItimestamp\fR]
  269. [\fB\-no_check_time\fR]
  270. [\fB\-check_ss_sig\fR]
  271. [\fB\-crl_check\fR]
  272. [\fB\-crl_check_all\fR]
  273. [\fB\-explicit_policy\fR]
  274. [\fB\-extended_crl\fR]
  275. [\fB\-ignore_critical\fR]
  276. [\fB\-inhibit_any\fR]
  277. [\fB\-inhibit_map\fR]
  278. [\fB\-partial_chain\fR]
  279. [\fB\-policy\fR \fIarg\fR]
  280. [\fB\-policy_check\fR]
  281. [\fB\-policy_print\fR]
  282. [\fB\-purpose\fR \fIpurpose\fR]
  283. [\fB\-suiteB_128\fR]
  284. [\fB\-suiteB_128_only\fR]
  285. [\fB\-suiteB_192\fR]
  286. [\fB\-trusted_first\fR]
  287. [\fB\-no_alt_chains\fR]
  288. [\fB\-use_deltas\fR]
  289. [\fB\-auth_level\fR \fInum\fR]
  290. [\fB\-verify_depth\fR \fInum\fR]
  291. [\fB\-verify_email\fR \fIemail\fR]
  292. [\fB\-verify_hostname\fR \fIhostname\fR]
  293. [\fB\-verify_ip\fR \fIip\fR]
  294. [\fB\-verify_name\fR \fIname\fR]
  295. [\fB\-x509_strict\fR]
  296. [\fB\-issuer_checks\fR]
  297. .SH "DESCRIPTION"
  298. .IX Header "DESCRIPTION"
  299. This command handles data in \s-1CMS\s0 format such as S/MIME v3.1 email messages.
  300. It can encrypt, decrypt, sign, verify, compress, uncompress, and print messages.
  301. .SH "OPTIONS"
  302. .IX Header "OPTIONS"
  303. There are a number of operation options that set the type of operation to be
  304. performed: encrypt, decrypt, sign, verify, resign, sign_receipt, verify_receipt,
  305. digest_create, digest_verify, compress, uncompress,
  306. EncryptedData_encrypt, EncryptedData_decrypt, data_create, data_out, or cmsout.
  307. The relevance of the other options depends on the operation type
  308. and their meaning may vary according to it.
  309. .IP "\fB\-help\fR" 4
  310. .IX Item "-help"
  311. Print out a usage message.
  312. .SS "General options"
  313. .IX Subsection "General options"
  314. .IP "\fB\-in\fR \fIfilename\fR" 4
  315. .IX Item "-in filename"
  316. The input message to be encrypted or signed or the message to be decrypted
  317. or verified.
  318. .IP "\fB\-out\fR \fIfilename\fR" 4
  319. .IX Item "-out filename"
  320. The message text that has been decrypted or verified or the output \s-1MIME\s0
  321. format message that has been signed or verified.
  322. .IP "\fB\-config\fR \fIconfigfile\fR" 4
  323. .IX Item "-config configfile"
  324. See \*(L"Configuration Option\*(R" in \fBopenssl\fR\|(1).
  325. .SS "Operation options"
  326. .IX Subsection "Operation options"
  327. .IP "\fB\-encrypt\fR" 4
  328. .IX Item "-encrypt"
  329. Encrypt data for the given recipient certificates. Input file is the message
  330. to be encrypted. The output file is the encrypted data in \s-1MIME\s0 format. The
  331. actual \s-1CMS\s0 type is \fBEnvelopedData\fR.
  332. .Sp
  333. Note that no revocation check is done for the recipient cert, so if that
  334. key has been compromised, others may be able to decrypt the text.
  335. .IP "\fB\-decrypt\fR" 4
  336. .IX Item "-decrypt"
  337. Decrypt data using the supplied certificate and private key. Expects
  338. encrypted datain \s-1MIME\s0 format for the input file. The decrypted data
  339. is written to the output file.
  340. .IP "\fB\-sign\fR" 4
  341. .IX Item "-sign"
  342. Sign data using the supplied certificate and private key. Input file is
  343. the message to be signed. The signed data in \s-1MIME\s0 format is written
  344. to the output file.
  345. .IP "\fB\-verify\fR" 4
  346. .IX Item "-verify"
  347. Verify signed data. Expects a signed data on input and outputs
  348. the signed data. Both clear text and opaque signing is supported.
  349. .IP "\fB\-resign\fR" 4
  350. .IX Item "-resign"
  351. Resign a message: take an existing message and one or more new signers.
  352. .IP "\fB\-sign_receipt\fR" 4
  353. .IX Item "-sign_receipt"
  354. Generate and output a signed receipt for the supplied message. The input
  355. message \fBmust\fR contain a signed receipt request. Functionality is otherwise
  356. similar to the \fB\-sign\fR operation.
  357. .IP "\fB\-verify_receipt\fR \fIreceipt\fR" 4
  358. .IX Item "-verify_receipt receipt"
  359. Verify a signed receipt in filename \fBreceipt\fR. The input message \fBmust\fR
  360. contain the original receipt request. Functionality is otherwise similar
  361. to the \fB\-verify\fR operation.
  362. .IP "\fB\-digest\fR \fIdigest\fR" 4
  363. .IX Item "-digest digest"
  364. When used with \fB\-sign\fR, provides the digest in hexadecimal form instead of
  365. computing it from the original message content. Cannot be combined with \fB\-in\fR
  366. or \fB\-nodetach\fR.
  367. .Sp
  368. This operation is the \s-1CMS\s0 equivalent of \fBopenssl\-pkeyutl\fR\|(1) signing.
  369. When signing a pre-computed digest, the security relies on the digest and its
  370. computation from the original message being trusted.
  371. .IP "\fB\-digest_create\fR" 4
  372. .IX Item "-digest_create"
  373. Create a \s-1CMS\s0 \fBDigestedData\fR type.
  374. .IP "\fB\-digest_verify\fR" 4
  375. .IX Item "-digest_verify"
  376. Verify a \s-1CMS\s0 \fBDigestedData\fR type and output the content.
  377. .IP "\fB\-compress\fR" 4
  378. .IX Item "-compress"
  379. Create a \s-1CMS\s0 \fBCompressedData\fR type. OpenSSL must be compiled with \fBzlib\fR
  380. support for this option to work, otherwise it will output an error.
  381. .IP "\fB\-uncompress\fR" 4
  382. .IX Item "-uncompress"
  383. Uncompress a \s-1CMS\s0 \fBCompressedData\fR type and output the content. OpenSSL must be
  384. compiled with \fBzlib\fR support for this option to work, otherwise it will
  385. output an error.
  386. .IP "\fB\-EncryptedData_encrypt\fR" 4
  387. .IX Item "-EncryptedData_encrypt"
  388. Encrypt content using supplied symmetric key and algorithm using a \s-1CMS\s0
  389. \&\fBEncryptedData\fR type and output the content.
  390. .IP "\fB\-EncryptedData_decrypt\fR" 4
  391. .IX Item "-EncryptedData_decrypt"
  392. Decrypt content using supplied symmetric key and algorithm using a \s-1CMS\s0
  393. \&\fBEncryptedData\fR type and output the content.
  394. .IP "\fB\-data_create\fR" 4
  395. .IX Item "-data_create"
  396. Create a \s-1CMS\s0 \fBData\fR type.
  397. .IP "\fB\-data_out\fR" 4
  398. .IX Item "-data_out"
  399. \&\fBData\fR type and output the content.
  400. .IP "\fB\-cmsout\fR" 4
  401. .IX Item "-cmsout"
  402. Takes an input message and writes out a \s-1PEM\s0 encoded \s-1CMS\s0 structure.
  403. .SS "File format options"
  404. .IX Subsection "File format options"
  405. .IP "\fB\-inform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR|\fB\s-1SMIME\s0\fR" 4
  406. .IX Item "-inform DER|PEM|SMIME"
  407. The input format of the \s-1CMS\s0 structure (if one is being read);
  408. the default is \fB\s-1SMIME\s0\fR.
  409. See \fBopenssl\-format\-options\fR\|(1) for details.
  410. .IP "\fB\-outform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR|\fB\s-1SMIME\s0\fR" 4
  411. .IX Item "-outform DER|PEM|SMIME"
  412. The output format of the \s-1CMS\s0 structure (if one is being written);
  413. the default is \fB\s-1SMIME\s0\fR.
  414. See \fBopenssl\-format\-options\fR\|(1) for details.
  415. .IP "\fB\-rctform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR|\fB\s-1SMIME\s0\fR" 4
  416. .IX Item "-rctform DER|PEM|SMIME"
  417. The signed receipt format for use with the \fB\-receipt_verify\fR; the default
  418. is \fB\s-1SMIME\s0\fR.
  419. See \fBopenssl\-format\-options\fR\|(1) for details.
  420. .IP "\fB\-stream\fR, \fB\-indef\fR" 4
  421. .IX Item "-stream, -indef"
  422. The \fB\-stream\fR and \fB\-indef\fR options are equivalent and enable streaming I/O
  423. for encoding operations. This permits single pass processing of data without
  424. the need to hold the entire contents in memory, potentially supporting very
  425. large files. Streaming is automatically set for S/MIME signing with detached
  426. data if the output format is \fB\s-1SMIME\s0\fR it is currently off by default for all
  427. other operations.
  428. .IP "\fB\-noindef\fR" 4
  429. .IX Item "-noindef"
  430. Disable streaming I/O where it would produce and indefinite length constructed
  431. encoding. This option currently has no effect. In future streaming will be
  432. enabled by default on all relevant operations and this option will disable it.
  433. .IP "\fB\-binary\fR" 4
  434. .IX Item "-binary"
  435. Normally the input message is converted to \*(L"canonical\*(R" format which is
  436. effectively using \s-1CR\s0 and \s-1LF\s0 as end of line: as required by the S/MIME
  437. specification. When this option is present no translation occurs. This
  438. is useful when handling binary data which may not be in \s-1MIME\s0 format.
  439. .IP "\fB\-crlfeol\fR" 4
  440. .IX Item "-crlfeol"
  441. Normally the output file uses a single \fB\s-1LF\s0\fR as end of line. When this
  442. option is present \fB\s-1CRLF\s0\fR is used instead.
  443. .IP "\fB\-asciicrlf\fR" 4
  444. .IX Item "-asciicrlf"
  445. When signing use \s-1ASCII CRLF\s0 format canonicalisation. This strips trailing
  446. whitespace from all lines, deletes trailing blank lines at \s-1EOF\s0 and sets
  447. the encapsulated content type. This option is normally used with detached
  448. content and an output signature format of \s-1DER.\s0 This option is not normally
  449. needed when verifying as it is enabled automatically if the encapsulated
  450. content format is detected.
  451. .SS "Keys and password options"
  452. .IX Subsection "Keys and password options"
  453. .IP "\fB\-pwri_password\fR \fIpassword\fR" 4
  454. .IX Item "-pwri_password password"
  455. Specify password for recipient.
  456. .IP "\fB\-secretkey\fR \fIkey\fR" 4
  457. .IX Item "-secretkey key"
  458. Specify symmetric key to use. The key must be supplied in hex format and be
  459. consistent with the algorithm used. Supported by the \fB\-EncryptedData_encrypt\fR
  460. \&\fB\-EncryptedData_decrypt\fR, \fB\-encrypt\fR and \fB\-decrypt\fR options. When used
  461. with \fB\-encrypt\fR or \fB\-decrypt\fR the supplied key is used to wrap or unwrap the
  462. content encryption key using an \s-1AES\s0 key in the \fBKEKRecipientInfo\fR type.
  463. .IP "\fB\-secretkeyid\fR \fIid\fR" 4
  464. .IX Item "-secretkeyid id"
  465. The key identifier for the supplied symmetric key for \fBKEKRecipientInfo\fR type.
  466. This option \fBmust\fR be present if the \fB\-secretkey\fR option is used with
  467. \&\fB\-encrypt\fR. With \fB\-decrypt\fR operations the \fIid\fR is used to locate the
  468. relevant key if it is not supplied then an attempt is used to decrypt any
  469. \&\fBKEKRecipientInfo\fR structures.
  470. .IP "\fB\-inkey\fR \fIfilename\fR|\fIuri\fR" 4
  471. .IX Item "-inkey filename|uri"
  472. The private key to use when signing or decrypting. This must match the
  473. corresponding certificate. If this option is not specified then the
  474. private key must be included in the certificate file specified with
  475. the \fB\-recip\fR or \fB\-signer\fR file. When signing this option can be used
  476. multiple times to specify successive keys.
  477. .IP "\fB\-passin\fR \fIarg\fR" 4
  478. .IX Item "-passin arg"
  479. The private key password source. For more information about the format of \fBarg\fR
  480. see \fBopenssl\-passphrase\-options\fR\|(1).
  481. .IP "\fB\-keyopt\fR \fIname\fR:\fIparameter\fR" 4
  482. .IX Item "-keyopt name:parameter"
  483. For signing and encryption this option can be used multiple times to
  484. set customised parameters for the preceding key or certificate. It can
  485. currently be used to set RSA-PSS for signing, RSA-OAEP for encryption
  486. or to modify default parameters for \s-1ECDH.\s0
  487. .IP "\fB\-keyform\fR \fB\s-1DER\s0\fR|\fB\s-1PEM\s0\fR|\fBP12\fR|\fB\s-1ENGINE\s0\fR" 4
  488. .IX Item "-keyform DER|PEM|P12|ENGINE"
  489. The format of the private key file; unspecified by default.
  490. See \fBopenssl\-format\-options\fR\|(1) for details.
  491. .IP "\fB\-engine\fR \fIid\fR" 4
  492. .IX Item "-engine id"
  493. See \*(L"Engine Options\*(R" in \fBopenssl\fR\|(1).
  494. This option is deprecated.
  495. .IP "\fB\-provider\fR \fIname\fR" 4
  496. .IX Item "-provider name"
  497. .PD 0
  498. .IP "\fB\-provider\-path\fR \fIpath\fR" 4
  499. .IX Item "-provider-path path"
  500. .IP "\fB\-propquery\fR \fIpropq\fR" 4
  501. .IX Item "-propquery propq"
  502. .PD
  503. See \*(L"Provider Options\*(R" in \fBopenssl\fR\|(1), \fBprovider\fR\|(7), and \fBproperty\fR\|(7).
  504. .IP "\fB\-rand\fR \fIfiles\fR, \fB\-writerand\fR \fIfile\fR" 4
  505. .IX Item "-rand files, -writerand file"
  506. See \*(L"Random State Options\*(R" in \fBopenssl\fR\|(1) for details.
  507. .SS "Encryption and decryption options"
  508. .IX Subsection "Encryption and decryption options"
  509. .IP "\fB\-originator\fR \fIfile\fR" 4
  510. .IX Item "-originator file"
  511. A certificate of the originator of the encrypted message. Necessary for
  512. decryption when Key Agreement is in use for a shared key.
  513. .IP "\fB\-recip\fR \fIfile\fR" 4
  514. .IX Item "-recip file"
  515. When decrypting a message this specifies the certificate of the recipient.
  516. The certificate must match one of the recipients of the message.
  517. .Sp
  518. When encrypting a message this option may be used multiple times to specify
  519. each recipient. This form \fBmust\fR be used if customised parameters are
  520. required (for example to specify RSA-OAEP).
  521. .Sp
  522. Only certificates carrying \s-1RSA,\s0 Diffie-Hellman or \s-1EC\s0 keys are supported by this
  523. option.
  524. .IP "\fIrecipient-cert\fR ..." 4
  525. .IX Item "recipient-cert ..."
  526. This is an alternative to using the \fB\-recip\fR option when encrypting a message.
  527. One or more certificate filenames may be given.
  528. .IP "\fB\-\f(BIcipher\fB\fR" 4
  529. .IX Item "-cipher"
  530. The encryption algorithm to use. For example triple \s-1DES\s0 (168 bits) \- \fB\-des3\fR
  531. or 256 bit \s-1AES\s0 \- \fB\-aes256\fR. Any standard algorithm name (as used by the
  532. \&\fBEVP_get_cipherbyname()\fR function) can also be used preceded by a dash, for
  533. example \fB\-aes\-128\-cbc\fR. See \fBopenssl\-enc\fR\|(1) for a list of ciphers
  534. supported by your version of OpenSSL.
  535. .Sp
  536. Currently the \s-1AES\s0 variants with \s-1GCM\s0 mode are the only supported \s-1AEAD\s0
  537. algorithms.
  538. .Sp
  539. If not specified triple \s-1DES\s0 is used. Only used with \fB\-encrypt\fR and
  540. \&\fB\-EncryptedData_create\fR commands.
  541. .IP "\fB\-wrap\fR \fIcipher\fR" 4
  542. .IX Item "-wrap cipher"
  543. Cipher algorithm to use for key wrap when encrypting the message using Key
  544. Agreement for key transport. The algorithm specified should be suitable for key
  545. wrap.
  546. .IP "\fB\-aes128\-wrap\fR, \fB\-aes192\-wrap\fR, \fB\-aes256\-wrap\fR, \fB\-des3\-wrap\fR" 4
  547. .IX Item "-aes128-wrap, -aes192-wrap, -aes256-wrap, -des3-wrap"
  548. Use \s-1AES128, AES192, AES256,\s0 or 3DES\-EDE, respectively, to wrap key.
  549. Depending on the OpenSSL build options used, \fB\-des3\-wrap\fR may not be supported.
  550. .IP "\fB\-debug_decrypt\fR" 4
  551. .IX Item "-debug_decrypt"
  552. This option sets the \fB\s-1CMS_DEBUG_DECRYPT\s0\fR flag. This option should be used
  553. with caution: see the notes section below.
  554. .SS "Signing options"
  555. .IX Subsection "Signing options"
  556. .IP "\fB\-md\fR \fIdigest\fR" 4
  557. .IX Item "-md digest"
  558. Digest algorithm to use when signing or resigning. If not present then the
  559. default digest algorithm for the signing key will be used (usually \s-1SHA1\s0).
  560. .IP "\fB\-signer\fR \fIfile\fR" 4
  561. .IX Item "-signer file"
  562. A signing certificate. When signing or resigning a message, this option can be
  563. used multiple times if more than one signer is required.
  564. .IP "\fB\-certfile\fR \fIfile\fR" 4
  565. .IX Item "-certfile file"
  566. Allows additional certificates to be specified. When signing these will
  567. be included with the message. When verifying these will be searched for
  568. the signers certificates.
  569. The input can be in \s-1PEM, DER,\s0 or PKCS#12 format.
  570. .IP "\fB\-cades\fR" 4
  571. .IX Item "-cades"
  572. When used with \fB\-sign\fR,
  573. add an \s-1ESS\s0 signingCertificate or \s-1ESS\s0 signingCertificateV2 signed-attribute
  574. to the SignerInfo, in order to make the signature comply with the requirements
  575. for a CAdES Basic Electronic Signature (CAdES-BES).
  576. .IP "\fB\-nodetach\fR" 4
  577. .IX Item "-nodetach"
  578. When signing a message use opaque signing: this form is more resistant
  579. to translation by mail relays but it cannot be read by mail agents that
  580. do not support S/MIME. Without this option cleartext signing with
  581. the \s-1MIME\s0 type multipart/signed is used.
  582. .IP "\fB\-nocerts\fR" 4
  583. .IX Item "-nocerts"
  584. When signing a message the signer's certificate is normally included
  585. with this option it is excluded. This will reduce the size of the
  586. signed message but the verifier must have a copy of the signers certificate
  587. available locally (passed using the \fB\-certfile\fR option for example).
  588. .IP "\fB\-noattr\fR" 4
  589. .IX Item "-noattr"
  590. Normally when a message is signed a set of attributes are included which
  591. include the signing time and supported symmetric algorithms. With this
  592. option they are not included.
  593. .IP "\fB\-nosmimecap\fR" 4
  594. .IX Item "-nosmimecap"
  595. Exclude the list of supported algorithms from signed attributes, other options
  596. such as signing time and content type are still included.
  597. .IP "\fB\-receipt_request_all\fR, \fB\-receipt_request_first\fR" 4
  598. .IX Item "-receipt_request_all, -receipt_request_first"
  599. For \fB\-sign\fR option include a signed receipt request. Indicate requests should
  600. be provided by all recipient or first tier recipients (those mailed directly
  601. and not from a mailing list). Ignored it \fB\-receipt_request_from\fR is included.
  602. .IP "\fB\-receipt_request_from\fR \fIemailaddress\fR" 4
  603. .IX Item "-receipt_request_from emailaddress"
  604. For \fB\-sign\fR option include a signed receipt request. Add an explicit email
  605. address where receipts should be supplied.
  606. .IP "\fB\-receipt_request_to\fR \fIemailaddress\fR" 4
  607. .IX Item "-receipt_request_to emailaddress"
  608. Add an explicit email address where signed receipts should be sent to. This
  609. option \fBmust\fR but supplied if a signed receipt is requested.
  610. .SS "Verification options"
  611. .IX Subsection "Verification options"
  612. .IP "\fB\-signer\fR \fIfile\fR" 4
  613. .IX Item "-signer file"
  614. If a message has been verified successfully then the signers certificate(s)
  615. will be written to this file if the verification was successful.
  616. .IP "\fB\-content\fR \fIfilename\fR" 4
  617. .IX Item "-content filename"
  618. This specifies a file containing the detached content for operations taking
  619. S/MIME input, such as the \fB\-verify\fR command. This is only usable if the \s-1CMS\s0
  620. structure is using the detached signature form where the content is
  621. not included. This option will override any content if the input format
  622. is S/MIME and it uses the multipart/signed \s-1MIME\s0 content type.
  623. .IP "\fB\-no_content_verify\fR" 4
  624. .IX Item "-no_content_verify"
  625. Do not verify signed content signatures.
  626. .IP "\fB\-no_attr_verify\fR" 4
  627. .IX Item "-no_attr_verify"
  628. Do not verify signed attribute signatures.
  629. .IP "\fB\-nosigs\fR" 4
  630. .IX Item "-nosigs"
  631. Don't verify message signature.
  632. .IP "\fB\-noverify\fR" 4
  633. .IX Item "-noverify"
  634. Do not verify the signers certificate of a signed message.
  635. .IP "\fB\-nointern\fR" 4
  636. .IX Item "-nointern"
  637. When verifying a message normally certificates (if any) included in
  638. the message are searched for the signing certificate. With this option
  639. only the certificates specified in the \fB\-certfile\fR option are used.
  640. The supplied certificates can still be used as untrusted CAs however.
  641. .IP "\fB\-cades\fR" 4
  642. .IX Item "-cades"
  643. When used with \fB\-verify\fR, require and check signer certificate digest.
  644. See the \s-1NOTES\s0 section for more details.
  645. .IP "\fB\-verify_retcode\fR" 4
  646. .IX Item "-verify_retcode"
  647. Exit nonzero on verification failure.
  648. .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
  649. .IX Item "-CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore"
  650. See \*(L"Trusted Certificate Options\*(R" in \fBopenssl\-verification\-options\fR\|(1) for details.
  651. .SS "Output options"
  652. .IX Subsection "Output options"
  653. .IP "\fB\-keyid\fR" 4
  654. .IX Item "-keyid"
  655. Use subject key identifier to identify certificates instead of issuer name and
  656. serial number. The supplied certificate \fBmust\fR include a subject key
  657. identifier extension. Supported by \fB\-sign\fR and \fB\-encrypt\fR options.
  658. .IP "\fB\-econtent_type\fR \fItype\fR" 4
  659. .IX Item "-econtent_type type"
  660. Set the encapsulated content type to \fItype\fR if not supplied the \fBData\fR type
  661. is used. The \fItype\fR argument can be any valid \s-1OID\s0 name in either text or
  662. numerical format.
  663. .IP "\fB\-text\fR" 4
  664. .IX Item "-text"
  665. This option adds plain text (text/plain) \s-1MIME\s0 headers to the supplied
  666. message if encrypting or signing. If decrypting or verifying it strips
  667. off text headers: if the decrypted or verified message is not of \s-1MIME\s0
  668. type text/plain then an error occurs.
  669. .IP "\fB\-certsout\fR \fIfile\fR" 4
  670. .IX Item "-certsout file"
  671. Any certificates contained in the input message are written to \fIfile\fR.
  672. .IP "\fB\-to\fR, \fB\-from\fR, \fB\-subject\fR" 4
  673. .IX Item "-to, -from, -subject"
  674. The relevant email headers. These are included outside the signed
  675. portion of a message so they may be included manually. If signing
  676. then many S/MIME mail clients check the signers certificate's email
  677. address matches that specified in the From: address.
  678. .SS "Printing options"
  679. .IX Subsection "Printing options"
  680. .IP "\fB\-noout\fR" 4
  681. .IX Item "-noout"
  682. For the \fB\-cmsout\fR operation do not output the parsed \s-1CMS\s0 structure.
  683. This is useful if the syntax of the \s-1CMS\s0 structure is being checked.
  684. .IP "\fB\-print\fR" 4
  685. .IX Item "-print"
  686. For the \fB\-cmsout\fR operation print out all fields of the \s-1CMS\s0 structure.
  687. This implies \fB\-noout\fR.
  688. This is mainly useful for testing purposes.
  689. .IP "\fB\-nameopt\fR \fIoption\fR" 4
  690. .IX Item "-nameopt option"
  691. For the \fB\-cmsout\fR operation when \fB\-print\fR option is in use, specifies
  692. printing options for string fields. For most cases \fButf8\fR is reasonable value.
  693. See \fBopenssl\-namedisplay\-options\fR\|(1) for details.
  694. .IP "\fB\-receipt_request_print\fR" 4
  695. .IX Item "-receipt_request_print"
  696. For the \fB\-verify\fR operation print out the contents of any signed receipt
  697. requests.
  698. .SS "Validation options"
  699. .IX Subsection "Validation options"
  700. .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
  701. .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"
  702. Set various options of certificate chain verification.
  703. See \*(L"Verification Options\*(R" in \fBopenssl\-verification\-options\fR\|(1) for details.
  704. .Sp
  705. Any validation errors cause the command to exit.
  706. .SH "NOTES"
  707. .IX Header "NOTES"
  708. The \s-1MIME\s0 message must be sent without any blank lines between the
  709. headers and the output. Some mail programs will automatically add
  710. a blank line. Piping the mail directly to sendmail is one way to
  711. achieve the correct format.
  712. .PP
  713. The supplied message to be signed or encrypted must include the
  714. necessary \s-1MIME\s0 headers or many S/MIME clients won't display it
  715. properly (if at all). You can use the \fB\-text\fR option to automatically
  716. add plain text headers.
  717. .PP
  718. A \*(L"signed and encrypted\*(R" message is one where a signed message is
  719. then encrypted. This can be produced by encrypting an already signed
  720. message: see the examples section.
  721. .PP
  722. This version of the program only allows one signer per message but it
  723. will verify multiple signers on received messages. Some S/MIME clients
  724. choke if a message contains multiple signers. It is possible to sign
  725. messages \*(L"in parallel\*(R" by signing an already signed message.
  726. .PP
  727. The options \fB\-encrypt\fR and \fB\-decrypt\fR reflect common usage in S/MIME
  728. clients. Strictly speaking these process \s-1CMS\s0 enveloped data: \s-1CMS\s0
  729. encrypted data is used for other purposes.
  730. .PP
  731. The \fB\-resign\fR option uses an existing message digest when adding a new
  732. signer. This means that attributes must be present in at least one existing
  733. signer using the same message digest or this operation will fail.
  734. .PP
  735. The \fB\-stream\fR and \fB\-indef\fR options enable streaming I/O support.
  736. As a result the encoding is \s-1BER\s0 using indefinite length constructed encoding
  737. and no longer \s-1DER.\s0 Streaming is supported for the \fB\-encrypt\fR operation and the
  738. \&\fB\-sign\fR operation if the content is not detached.
  739. .PP
  740. Streaming is always used for the \fB\-sign\fR operation with detached data but
  741. since the content is no longer part of the \s-1CMS\s0 structure the encoding
  742. remains \s-1DER.\s0
  743. .PP
  744. If the \fB\-decrypt\fR option is used without a recipient certificate then an
  745. attempt is made to locate the recipient by trying each potential recipient
  746. in turn using the supplied private key. To thwart the \s-1MMA\s0 attack
  747. (Bleichenbacher's attack on \s-1PKCS\s0 #1 v1.5 \s-1RSA\s0 padding) all recipients are
  748. tried whether they succeed or not and if no recipients match the message
  749. is \*(L"decrypted\*(R" using a random key which will typically output garbage.
  750. The \fB\-debug_decrypt\fR option can be used to disable the \s-1MMA\s0 attack protection
  751. and return an error if no recipient can be found: this option should be used
  752. with caution. For a fuller description see \fBCMS_decrypt\fR\|(3)).
  753. .SH "CADES BASIC ELECTRONIC SIGNATURE (CADES-BES)"
  754. .IX Header "CADES BASIC ELECTRONIC SIGNATURE (CADES-BES)"
  755. A CAdES Basic Electronic Signature (CAdES-BES),
  756. as defined in the European Standard \s-1ETSI EN 319 122\-1 V1.1.1,\s0 contains:
  757. .IP "\(bu" 4
  758. The signed user data as defined in \s-1CMS\s0 (\s-1RFC 3852\s0);
  759. .IP "\(bu" 4
  760. Content-type of the EncapsulatedContentInfo value being signed;
  761. .IP "\(bu" 4
  762. Message-digest of the eContent \s-1OCTET STRING\s0 within encapContentInfo being signed;
  763. .IP "\(bu" 4
  764. An \s-1ESS\s0 signingCertificate or \s-1ESS\s0 signingCertificateV2 attribute,
  765. as defined in Enhanced Security Services (\s-1ESS\s0), \s-1RFC 2634\s0 and \s-1RFC 5035.\s0
  766. An \s-1ESS\s0 signingCertificate attribute only allows for \s-1SHA\-1\s0 as digest algorithm.
  767. An \s-1ESS\s0 signingCertificateV2 attribute allows for any digest algorithm.
  768. .IP "\(bu" 4
  769. The digital signature value computed on the user data and, when present, on the signed attributes.
  770. .Sp
  771. \&\s-1NOTE\s0 that the \fB\-cades\fR option applies to the \fB\-sign\fR or \fB\-verify\fR operations.
  772. With this option, the \fB\-verify\fR operation also requires that the
  773. signingCertificate attribute is present and checks that the given identifiers
  774. match the verification trust chain built during the verification process.
  775. .SH "EXIT CODES"
  776. .IX Header "EXIT CODES"
  777. .IP "0" 4
  778. The operation was completely successfully.
  779. .IP "1" 4
  780. .IX Item "1"
  781. An error occurred parsing the command options.
  782. .IP "2" 4
  783. .IX Item "2"
  784. One of the input files could not be read.
  785. .IP "3" 4
  786. .IX Item "3"
  787. An error occurred creating the \s-1CMS\s0 file or when reading the \s-1MIME\s0
  788. message.
  789. .IP "4" 4
  790. .IX Item "4"
  791. An error occurred decrypting or verifying the message.
  792. .IP "5" 4
  793. .IX Item "5"
  794. The message was verified correctly but an error occurred writing out
  795. the signers certificates.
  796. .SH "COMPATIBILITY WITH PKCS#7 FORMAT"
  797. .IX Header "COMPATIBILITY WITH PKCS#7 FORMAT"
  798. \&\fBopenssl\-smime\fR\|(1) can only process the older \fBPKCS#7\fR format.
  799. \&\fBopenssl cms\fR supports Cryptographic Message Syntax format.
  800. Use of some features will result in messages which cannot be processed by
  801. applications which only support the older format. These are detailed below.
  802. .PP
  803. The use of the \fB\-keyid\fR option with \fB\-sign\fR or \fB\-encrypt\fR.
  804. .PP
  805. The \fB\-outform\fR \fI\s-1PEM\s0\fR option uses different headers.
  806. .PP
  807. The \fB\-compress\fR option.
  808. .PP
  809. The \fB\-secretkey\fR option when used with \fB\-encrypt\fR.
  810. .PP
  811. The use of \s-1PSS\s0 with \fB\-sign\fR.
  812. .PP
  813. The use of \s-1OAEP\s0 or non-RSA keys with \fB\-encrypt\fR.
  814. .PP
  815. Additionally the \fB\-EncryptedData_create\fR and \fB\-data_create\fR type cannot
  816. be processed by the older \fBopenssl\-smime\fR\|(1) command.
  817. .SH "EXAMPLES"
  818. .IX Header "EXAMPLES"
  819. Create a cleartext signed message:
  820. .PP
  821. .Vb 2
  822. \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
  823. \& \-signer mycert.pem
  824. .Ve
  825. .PP
  826. Create an opaque signed message
  827. .PP
  828. .Vb 2
  829. \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \-nodetach \e
  830. \& \-signer mycert.pem
  831. .Ve
  832. .PP
  833. Create a signed message, include some additional certificates and
  834. read the private key from another file:
  835. .PP
  836. .Vb 2
  837. \& openssl cms \-sign \-in in.txt \-text \-out mail.msg \e
  838. \& \-signer mycert.pem \-inkey mykey.pem \-certfile mycerts.pem
  839. .Ve
  840. .PP
  841. Create a signed message with two signers, use key identifier:
  842. .PP
  843. .Vb 2
  844. \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
  845. \& \-signer mycert.pem \-signer othercert.pem \-keyid
  846. .Ve
  847. .PP
  848. Send a signed message under Unix directly to sendmail, including headers:
  849. .PP
  850. .Vb 3
  851. \& openssl cms \-sign \-in in.txt \-text \-signer mycert.pem \e
  852. \& \-from steve@openssl.org \-to someone@somewhere \e
  853. \& \-subject "Signed message" | sendmail someone@somewhere
  854. .Ve
  855. .PP
  856. Verify a message and extract the signer's certificate if successful:
  857. .PP
  858. .Vb 1
  859. \& openssl cms \-verify \-in mail.msg \-signer user.pem \-out signedtext.txt
  860. .Ve
  861. .PP
  862. Send encrypted mail using triple \s-1DES:\s0
  863. .PP
  864. .Vb 3
  865. \& openssl cms \-encrypt \-in in.txt \-from steve@openssl.org \e
  866. \& \-to someone@somewhere \-subject "Encrypted message" \e
  867. \& \-des3 user.pem \-out mail.msg
  868. .Ve
  869. .PP
  870. Sign and encrypt mail:
  871. .PP
  872. .Vb 4
  873. \& openssl cms \-sign \-in ml.txt \-signer my.pem \-text \e
  874. \& | openssl cms \-encrypt \-out mail.msg \e
  875. \& \-from steve@openssl.org \-to someone@somewhere \e
  876. \& \-subject "Signed and Encrypted message" \-des3 user.pem
  877. .Ve
  878. .PP
  879. Note: the encryption command does not include the \fB\-text\fR option because the
  880. message being encrypted already has \s-1MIME\s0 headers.
  881. .PP
  882. Decrypt a message:
  883. .PP
  884. .Vb 1
  885. \& openssl cms \-decrypt \-in mail.msg \-recip mycert.pem \-inkey key.pem
  886. .Ve
  887. .PP
  888. The output from Netscape form signing is a PKCS#7 structure with the
  889. detached signature format. You can use this program to verify the
  890. signature by line wrapping the base64 encoded structure and surrounding
  891. it with:
  892. .PP
  893. .Vb 2
  894. \& \-\-\-\-\-BEGIN PKCS7\-\-\-\-\-
  895. \& \-\-\-\-\-END PKCS7\-\-\-\-\-
  896. .Ve
  897. .PP
  898. and using the command,
  899. .PP
  900. .Vb 1
  901. \& openssl cms \-verify \-inform PEM \-in signature.pem \-content content.txt
  902. .Ve
  903. .PP
  904. alternatively you can base64 decode the signature and use
  905. .PP
  906. .Vb 1
  907. \& openssl cms \-verify \-inform DER \-in signature.der \-content content.txt
  908. .Ve
  909. .PP
  910. Create an encrypted message using 128 bit Camellia:
  911. .PP
  912. .Vb 1
  913. \& openssl cms \-encrypt \-in plain.txt \-camellia128 \-out mail.msg cert.pem
  914. .Ve
  915. .PP
  916. Add a signer to an existing message:
  917. .PP
  918. .Vb 1
  919. \& openssl cms \-resign \-in mail.msg \-signer newsign.pem \-out mail2.msg
  920. .Ve
  921. .PP
  922. Sign a message using RSA-PSS:
  923. .PP
  924. .Vb 2
  925. \& openssl cms \-sign \-in message.txt \-text \-out mail.msg \e
  926. \& \-signer mycert.pem \-keyopt rsa_padding_mode:pss
  927. .Ve
  928. .PP
  929. Create an encrypted message using RSA-OAEP:
  930. .PP
  931. .Vb 2
  932. \& openssl cms \-encrypt \-in plain.txt \-out mail.msg \e
  933. \& \-recip cert.pem \-keyopt rsa_padding_mode:oaep
  934. .Ve
  935. .PP
  936. Use \s-1SHA256 KDF\s0 with an \s-1ECDH\s0 certificate:
  937. .PP
  938. .Vb 2
  939. \& openssl cms \-encrypt \-in plain.txt \-out mail.msg \e
  940. \& \-recip ecdhcert.pem \-keyopt ecdh_kdf_md:sha256
  941. .Ve
  942. .PP
  943. Print \s-1CMS\s0 signed binary data in human-readable form:
  944. .PP
  945. openssl cms \-in signed.cms \-binary \-inform \s-1DER\s0 \-cmsout \-print
  946. .SH "BUGS"
  947. .IX Header "BUGS"
  948. The \s-1MIME\s0 parser isn't very clever: it seems to handle most messages that I've
  949. thrown at it but it may choke on others.
  950. .PP
  951. The code currently will only write out the signer's certificate to a file: if
  952. the signer has a separate encryption certificate this must be manually
  953. extracted. There should be some heuristic that determines the correct
  954. encryption certificate.
  955. .PP
  956. Ideally a database should be maintained of a certificates for each email
  957. address.
  958. .PP
  959. The code doesn't currently take note of the permitted symmetric encryption
  960. algorithms as supplied in the SMIMECapabilities signed attribute. this means the
  961. user has to manually include the correct encryption algorithm. It should store
  962. the list of permitted ciphers in a database and only use those.
  963. .PP
  964. No revocation checking is done on the signer's certificate.
  965. .SH "SEE ALSO"
  966. .IX Header "SEE ALSO"
  967. \&\fBossl_store\-file\fR\|(7)
  968. .SH "HISTORY"
  969. .IX Header "HISTORY"
  970. The use of multiple \fB\-signer\fR options and the \fB\-resign\fR command were first
  971. added in OpenSSL 1.0.0.
  972. .PP
  973. The \fB\-keyopt\fR option was added in OpenSSL 1.0.2.
  974. .PP
  975. Support for RSA-OAEP and RSA-PSS was added in OpenSSL 1.0.2.
  976. .PP
  977. The use of non-RSA keys with \fB\-encrypt\fR and \fB\-decrypt\fR
  978. was added in OpenSSL 1.0.2.
  979. .PP
  980. The \-no_alt_chains option was added in OpenSSL 1.0.2b.
  981. .PP
  982. The \fB\-nameopt\fR option was added in OpenSSL 3.0.0.
  983. .PP
  984. The \fB\-engine\fR option was deprecated in OpenSSL 3.0.
  985. .PP
  986. The \fB\-digest\fR option was added in OpenSSL 3.2.
  987. .SH "COPYRIGHT"
  988. .IX Header "COPYRIGHT"
  989. Copyright 2008\-2023 The OpenSSL Project Authors. All Rights Reserved.
  990. .PP
  991. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  992. this file except in compliance with the License. You can obtain a copy
  993. in the file \s-1LICENSE\s0 in the source distribution or at
  994. <https://www.openssl.org/source/license.html>.