openssl-cmp.pod.in 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231
  1. =pod
  2. {- OpenSSL::safe::output_do_not_edit_headers(); -}
  3. =head1 NAME
  4. openssl-cmp - Certificate Management Protocol (CMP, RFC 4210) application
  5. =head1 SYNOPSIS
  6. B<openssl> B<cmp>
  7. [B<-help>]
  8. [B<-config> I<filename>]
  9. [B<-section> I<names>]
  10. [B<-verbosity> I<level>]
  11. Generic message options:
  12. [B<-cmd> I<ir|cr|kur|p10cr|rr|genm>]
  13. [B<-infotype> I<name>]
  14. [B<-geninfo> I<OID:int:N>]
  15. Certificate enrollment options:
  16. [B<-newkey> I<filename>|I<uri>]
  17. [B<-newkeypass> I<arg>]
  18. [B<-subject> I<name>]
  19. [B<-issuer> I<name>]
  20. [B<-days> I<number>]
  21. [B<-reqexts> I<name>]
  22. [B<-sans> I<spec>]
  23. [B<-san_nodefault>]
  24. [B<-policies> I<name>]
  25. [B<-policy_oids> I<names>]
  26. [B<-policy_oids_critical>]
  27. [B<-popo> I<number>]
  28. [B<-csr> I<filename>]
  29. [B<-out_trusted> I<filenames>|I<uris>]
  30. [B<-implicit_confirm>]
  31. [B<-disable_confirm>]
  32. [B<-certout> I<filename>]
  33. [B<-chainout> I<filename>]
  34. Certificate enrollment and revocation options:
  35. [B<-oldcert> I<filename>|I<uri>]
  36. [B<-revreason> I<number>]
  37. Message transfer options:
  38. [B<-server> I<[http[s]://][userinfo@]host[:port][/path][?query][#fragment]>]
  39. [B<-path> I<remote_path>]
  40. [B<-proxy> I<[http[s]://][userinfo@]host[:port][/path][?query][#fragment]>]
  41. [B<-no_proxy> I<addresses>]
  42. [B<-recipient> I<name>]
  43. [B<-keep_alive> I<value>]
  44. [B<-msg_timeout> I<seconds>]
  45. [B<-total_timeout> I<seconds>]
  46. Server authentication options:
  47. [B<-trusted> I<filenames>|I<uris>]
  48. [B<-untrusted> I<filenames>|I<uris>]
  49. [B<-srvcert> I<filename>|I<uri>]
  50. [B<-expect_sender> I<name>]
  51. [B<-ignore_keyusage>]
  52. [B<-unprotected_errors>]
  53. [B<-extracertsout> I<filename>]
  54. [B<-cacertsout> I<filename>]
  55. Client authentication and protection options:
  56. [B<-ref> I<value>]
  57. [B<-secret> I<arg>]
  58. [B<-cert> I<filename>|I<uri>]
  59. [B<-own_trusted> I<filenames>|I<uris>]
  60. [B<-key> I<filename>|I<uri>]
  61. [B<-keypass> I<arg>]
  62. [B<-digest> I<name>]
  63. [B<-mac> I<name>]
  64. [B<-extracerts> I<filenames>|I<uris>]
  65. [B<-unprotected_requests>]
  66. Credentials format options:
  67. [B<-certform> I<PEM|DER>]
  68. [B<-keyform> I<PEM|DER|P12|ENGINE>]
  69. [B<-otherpass> I<arg>]
  70. {- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -}
  71. Random state options:
  72. {- $OpenSSL::safe::opt_r_synopsis -}
  73. TLS connection options:
  74. [B<-tls_used>]
  75. [B<-tls_cert> I<filename>|I<uri>]
  76. [B<-tls_key> I<filename>|I<uri>]
  77. [B<-tls_keypass> I<arg>]
  78. [B<-tls_extra> I<filenames>|I<uris>]
  79. [B<-tls_trusted> I<filenames>|I<uris>]
  80. [B<-tls_host> I<name>]
  81. Client-side debugging options:
  82. [B<-batch>]
  83. [B<-repeat> I<number>]
  84. [B<-reqin> I<filenames>]
  85. [B<-reqin_new_tid>]
  86. [B<-reqout> I<filenames>]
  87. [B<-rspin> I<filenames>]
  88. [B<-rspout> I<filenames>]
  89. [B<-use_mock_srv>]
  90. Mock server options:
  91. [B<-port> I<number>]
  92. [B<-max_msgs> I<number>]
  93. [B<-srv_ref> I<value>]
  94. [B<-srv_secret> I<arg>]
  95. [B<-srv_cert> I<filename>|I<uri>]
  96. [B<-srv_key> I<filename>|I<uri>]
  97. [B<-srv_keypass> I<arg>]
  98. [B<-srv_trusted> I<filenames>|I<uris>]
  99. [B<-srv_untrusted> I<filenames>|I<uris>]
  100. [B<-rsp_cert> I<filename>|I<uri>]
  101. [B<-rsp_extracerts> I<filenames>|I<uris>]
  102. [B<-rsp_capubs> I<filenames>|I<uris>]
  103. [B<-poll_count> I<number>]
  104. [B<-check_after> I<number>]
  105. [B<-grant_implicitconf>]
  106. [B<-pkistatus> I<number>]
  107. [B<-failure> I<number>]
  108. [B<-failurebits> I<number>]
  109. [B<-statusstring> I<arg>]
  110. [B<-send_error>]
  111. [B<-send_unprotected>]
  112. [B<-send_unprot_err>]
  113. [B<-accept_unprotected>]
  114. [B<-accept_unprot_err>]
  115. [B<-accept_raverified>]
  116. Certificate verification options, for both CMP and TLS:
  117. {- $OpenSSL::safe::opt_v_synopsis -}
  118. =head1 DESCRIPTION
  119. The B<cmp> command is a client implementation for the Certificate
  120. Management Protocol (CMP) as defined in RFC4210.
  121. It can be used to request certificates from a CA server,
  122. update their certificates,
  123. request certificates to be revoked, and perform other types of CMP requests.
  124. =head1 OPTIONS
  125. =over 4
  126. =item B<-help>
  127. Display a summary of all options
  128. =item B<-config> I<filename>
  129. Configuration file to use.
  130. An empty string C<""> means none.
  131. Default filename is from the environment variable C<OPENSSL_CONF>.
  132. =item B<-section> I<names>
  133. Section(s) to use within config file defining CMP options.
  134. An empty string C<""> means no specific section.
  135. Default is C<cmp>.
  136. Multiple section names may be given, separated by commas and/or whitespace
  137. (where in the latter case the whole argument must be enclosed in "...").
  138. Contents of sections named later may override contents of sections named before.
  139. In any case, as usual, the C<[default]> section and finally the unnamed
  140. section (as far as present) can provide per-option fallback values.
  141. =item B<-verbosity> I<level>
  142. Level of verbosity for logging, error output, etc.
  143. 0 = EMERG, 1 = ALERT, 2 = CRIT, 3 = ERR, 4 = WARN, 5 = NOTE,
  144. 6 = INFO, 7 = DEBUG, 8 = TRACE.
  145. Defaults to 6 = INFO.
  146. =back
  147. =head2 Generic message options
  148. =over 4
  149. =item B<-cmd> I<ir|cr|kur|p10cr|rr|genm>
  150. CMP command to execute.
  151. Currently implemented commands are:
  152. =over 8
  153. =item ir E<nbsp> - Initialization Request
  154. =item cr E<nbsp> - Certificate Request
  155. =item p10cr - PKCS#10 Certification Request (for legacy support)
  156. =item kur E<nbsp>E<nbsp>- Key Update Request
  157. =item rr E<nbsp> - Revocation Request
  158. =item genm - General Message
  159. =back
  160. B<ir> requests initialization of an end entity into a PKI hierarchy
  161. by issuing a first certificate.
  162. B<cr> requests issuing an additional certificate for an end entity already
  163. initialized to the PKI hierarchy.
  164. B<p10cr> requests issuing an additional certificate similarly to B<cr>
  165. but using legacy PKCS#10 CSR format.
  166. B<kur> requests a (key) update for an existing certificate.
  167. B<rr> requests revocation of an existing certificate.
  168. B<genm> requests information using a General Message, where optionally
  169. included B<InfoTypeAndValue>s may be used to state which info is of interest.
  170. Upon receipt of the General Response, information about all received
  171. ITAV B<infoType>s is printed to stdout.
  172. =item B<-infotype> I<name>
  173. Set InfoType name to use for requesting specific info in B<genm>,
  174. e.g., C<signKeyPairTypes>.
  175. =item B<-geninfo> I<OID:int:N>
  176. generalInfo integer values to place in request PKIHeader with given OID,
  177. e.g., C<1.2.3.4:int:56789>.
  178. =back
  179. =head2 Certificate enrollment options
  180. =over 4
  181. =item B<-newkey> I<filename>|I<uri>
  182. The source of the private or public key for the certificate requested
  183. in Initialization Request (IR), Certification Request(CR), or
  184. Key Update Request (KUR).
  185. Default is the public key in the PKCS#10 CSR given with the B<-csr> option,
  186. if any, or else the current client key, if given.
  187. =item B<-newkeypass> I<arg>
  188. Pass phrase source for the key given with the B<-newkey> option.
  189. If not given here, the password will be prompted for if needed.
  190. For more information about the format of I<arg> see
  191. L<openssl-passphrase-options(1)>.
  192. =item B<-subject> I<name>
  193. X509 Distinguished Name (DN) of subject to use in the requested certificate
  194. template.
  195. For KUR, it defaults to the public key
  196. in the PKCS#10 CSR given with the B<-csr> option, if provided,
  197. or of the reference certificate (see B<-oldcert>) if provided.
  198. This default is used for IR and CR only if no SANs are set.
  199. If the NULL-DN (C<"/">) is given then no subject is placed in the template.
  200. If provided and neither B<-cert> nor B<-oldcert> is given,
  201. the subject DN is used as fallback sender of outgoing CMP messages.
  202. The argument must be formatted as I</type0=value0/type1=value1/type2=...>.
  203. Special characters may be escaped by C<\> (backslash); whitespace is retained.
  204. Empty values are permitted, but the corresponding type will not be included.
  205. Giving a single C</> will lead to an empty sequence of RDNs (a NULL-DN).
  206. Multi-valued RDNs can be formed by placing a C<+> character instead of a C</>
  207. between the AttributeValueAssertions (AVAs) that specify the members of the set.
  208. Example:
  209. C</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe>
  210. =item B<-issuer> I<name>
  211. X509 issuer Distinguished Name (DN) of the CA server
  212. to place in the requested certificate template in IR/CR/KUR.
  213. If the NULL-DN (C<"/">) is given then no issuer is placed in the template.
  214. If provided and neither B<-recipient> nor B<-srvcert> is given,
  215. the issuer DN is used as fallback recipient of outgoing CMP messages.
  216. The argument must be formatted as I</type0=value0/type1=value1/type2=...>.
  217. For details see the description of the B<-subject> option.
  218. =item B<-days> I<number>
  219. Number of days the new certificate is requested to be valid for, counting from
  220. the current time of the host.
  221. Also triggers the explicit request that the
  222. validity period starts from the current time (as seen by the host).
  223. =item B<-reqexts> I<name>
  224. Name of section in OpenSSL config file defining certificate request extensions.
  225. If the B<-csr> option is present, these extensions augment the extensions
  226. contained the given PKCS#10 CSR, overriding any extensions with same OIDs.
  227. =item B<-sans> I<spec>
  228. One or more IP addresses, DNS names, or URIs separated by commas or whitespace
  229. (where in the latter case the whole argument must be enclosed in "...")
  230. to add as Subject Alternative Name(s) (SAN) certificate request extension.
  231. If the special element "critical" is given the SANs are flagged as critical.
  232. Cannot be used if any Subject Alternative Name extension is set via B<-reqexts>.
  233. =item B<-san_nodefault>
  234. When Subject Alternative Names are not given via B<-sans>
  235. nor defined via B<-reqexts>,
  236. they are copied by default from the reference certificate (see B<-oldcert>).
  237. This can be disabled by giving the B<-san_nodefault> option.
  238. =item B<-policies> I<name>
  239. Name of section in OpenSSL config file defining policies to be set
  240. as certificate request extension.
  241. This option cannot be used together with B<-policy_oids>.
  242. =item B<-policy_oids> I<names>
  243. One or more OID(s), separated by commas and/or whitespace
  244. (where in the latter case the whole argument must be enclosed in "...")
  245. to add as certificate policies request extension.
  246. This option cannot be used together with B<-policies>.
  247. =item B<-policy_oids_critical>
  248. Flag the policies given with B<-policy_oids> as critical.
  249. =item B<-popo> I<number>
  250. Proof-of-Possession (POPO) method to use for IR/CR/KUR; values: C<-1>..<2> where
  251. C<-1> = NONE, C<0> = RAVERIFIED, C<1> = SIGNATURE (default), C<2> = KEYENC.
  252. Note that a signature-based POPO can only be produced if a private key
  253. is provided via the B<-newkey> or B<-key> options.
  254. =item B<-csr> I<filename>
  255. PKCS#10 CSR in PEM or DER format containing a certificate request.
  256. With B<-cmd> I<p10cr> it is used directly in a legacy P10CR message.
  257. When used with B<-cmd> I<ir>, I<cr>, or I<kur>, it is transformed into the
  258. respective regular CMP request.
  259. It may also be used with B<-cmd> I<rr> to specify the certificate to be revoked
  260. via the included subject name and public key.
  261. =item B<-out_trusted> I<filenames>|I<uris>
  262. Trusted certificate(s) to use for validating the newly enrolled certificate.
  263. Multiple sources may be given, separated by commas and/or whitespace
  264. (where in the latter case the whole argument must be enclosed in "...").
  265. Each source may contain multiple certificates.
  266. The certificate verification options
  267. B<-verify_hostname>, B<-verify_ip>, and B<-verify_email>
  268. only affect the certificate verification enabled via this option.
  269. =item B<-implicit_confirm>
  270. Request implicit confirmation of newly enrolled certificates.
  271. =item B<-disable_confirm>
  272. Do not send certificate confirmation message for newly enrolled certificate
  273. without requesting implicit confirmation
  274. to cope with broken servers not supporting implicit confirmation correctly.
  275. B<WARNING:> This leads to behavior violating RFC 4210.
  276. =item B<-certout> I<filename>
  277. The file where the newly enrolled certificate should be saved.
  278. =item B<-chainout> I<filename>
  279. The file where the chain of the newly enrolled certificate should be saved.
  280. =back
  281. =head2 Certificate enrollment and revocation options
  282. =over 4
  283. =item B<-oldcert> I<filename>|I<uri>
  284. The certificate to be updated (i.e., renewed or re-keyed) in Key Update Request
  285. (KUR) messages or to be revoked in Revocation Request (RR) messages.
  286. For KUR the certificate to be updated defaults to B<-cert>,
  287. and the resulting certificate is called I<reference certificate>.
  288. For RR the certificate to be revoked can also be specified using B<-csr>.
  289. The reference certificate, if any, is also used for
  290. deriving default subject DN and Subject Alternative Names and the
  291. default issuer entry in the requested certificate template of an IR/CR/KUR.
  292. Its subject is used as sender of outgoing messages if B<-cert> is not given.
  293. Its issuer is used as default recipient in CMP message headers
  294. if neither B<-recipient>, B<-srvcert>, nor B<-issuer> is given.
  295. =item B<-revreason> I<number>
  296. Set CRLReason to be included in revocation request (RR); values: C<0>..C<10>
  297. or C<-1> for none (which is the default).
  298. Reason numbers defined in RFC 5280 are:
  299. CRLReason ::= ENUMERATED {
  300. unspecified (0),
  301. keyCompromise (1),
  302. cACompromise (2),
  303. affiliationChanged (3),
  304. superseded (4),
  305. cessationOfOperation (5),
  306. certificateHold (6),
  307. -- value 7 is not used
  308. removeFromCRL (8),
  309. privilegeWithdrawn (9),
  310. aACompromise (10)
  311. }
  312. =back
  313. =head2 Message transfer options
  314. =over 4
  315. =item B<-server> I<[http[s]://][userinfo@]host[:port][/path][?query][#fragment]>
  316. The IP address or DNS hostname and optionally port
  317. of the CMP server to connect to using HTTP(S) transport.
  318. The scheme C<https> may be given only if the B<-tls_used> option is used.
  319. In this case the default port is 443, else 80.
  320. The optional userinfo and fragment components are ignored.
  321. Any given query component is handled as part of the path component.
  322. If a path is included it provides the default value for the B<-path> option.
  323. =item B<-path> I<remote_path>
  324. HTTP path at the CMP server (aka CMP alias) to use for POST requests.
  325. Defaults to any path given with B<-server>, else C<"/">.
  326. =item B<-proxy> I<[http[s]://][userinfo@]host[:port][/path][?query][#fragment]>
  327. The HTTP(S) proxy server to use for reaching the CMP server unless B<-no_proxy>
  328. applies, see below.
  329. The proxy port defaults to 80 or 443 if the scheme is C<https>; apart from that
  330. the optional C<http://> or C<https://> prefix is ignored (note that TLS may be
  331. selected by B<-tls_used>), as well as any path, userinfo, and query, and fragment
  332. components.
  333. Defaults to the environment variable C<http_proxy> if set, else C<HTTP_PROXY>
  334. in case no TLS is used, otherwise C<https_proxy> if set, else C<HTTPS_PROXY>.
  335. =item B<-no_proxy> I<addresses>
  336. List of IP addresses and/or DNS names of servers
  337. not to use an HTTP(S) proxy for, separated by commas and/or whitespace
  338. (where in the latter case the whole argument must be enclosed in "...").
  339. Default is from the environment variable C<no_proxy> if set, else C<NO_PROXY>.
  340. =item B<-recipient> I<name>
  341. Distinguished Name (DN) to use in the recipient field of CMP request message
  342. headers, i.e., the CMP server (usually the addressed CA).
  343. The recipient field in the header of a CMP message is mandatory.
  344. If not given explicitly the recipient is determined in the following order:
  345. the subject of the CMP server certificate given with the B<-srvcert> option,
  346. the B<-issuer> option,
  347. the issuer of the certificate given with the B<-oldcert> option,
  348. the issuer of the CMP client certificate (B<-cert> option),
  349. as far as any of those is present, else the NULL-DN as last resort.
  350. The argument must be formatted as I</type0=value0/type1=value1/type2=...>.
  351. For details see the description of the B<-subject> option.
  352. =item B<-keep_alive> I<value>
  353. If the given value is 0 then HTTP connections are not kept open
  354. after receiving a response, which is the default behavior for HTTP 1.0.
  355. If the value is 1 or 2 then persistent connections are requested.
  356. If the value is 2 then persistent connections are required,
  357. i.e., in case the server does not grant them an error occurs.
  358. The default value is 1, which means preferring to keep the connection open.
  359. =item B<-msg_timeout> I<seconds>
  360. Number of seconds (or 0 for infinite) a CMP request-response message round trip
  361. is allowed to take before a timeout error is returned.
  362. Default is to use the B<-total_timeout> setting.
  363. =item B<-total_timeout> I<seconds>
  364. Maximum number seconds an overall enrollment transaction may take,
  365. including attempts polling for certificates on C<waiting> PKIStatus.
  366. Default is 0 (infinite).
  367. =back
  368. =head2 Server authentication options
  369. =over 4
  370. =item B<-trusted> I<filenames>|I<uris>
  371. When validating signature-based protection of CMP response messages,
  372. these are the CA certificate(s) to trust while checking certificate chains
  373. during CMP server authentication.
  374. This option gives more flexibility than the B<-srvcert> option because the
  375. server-side CMP signer certificate is not pinned but may be any certificate
  376. for which a chain to one of the given trusted certificates can be constructed.
  377. If no B<-trusted>, B<-srvcert>, and B<-secret> option is given
  378. then protected response messages from the server are not authenticated.
  379. Multiple sources may be given, separated by commas and/or whitespace
  380. (where in the latter case the whole argument must be enclosed in "...").
  381. Each source may contain multiple certificates.
  382. The certificate verification options
  383. B<-verify_hostname>, B<-verify_ip>, and B<-verify_email>
  384. have no effect on the certificate verification enabled via this option.
  385. =item B<-untrusted> I<filenames>|I<uris>
  386. Non-trusted intermediate CA certificate(s).
  387. Any extra certificates given with the B<-cert> option are appended to it.
  388. All these certificates may be useful for cert path construction
  389. for the CMP client certificate (to include in the extraCerts field of outgoing
  390. messages) and for the TLS client certificate (if TLS is enabled)
  391. as well as for chain building
  392. when validating the CMP server certificate (checking signature-based
  393. CMP message protection) and when validating newly enrolled certificates.
  394. Multiple sources may be given, separated by commas and/or whitespace.
  395. Each file may contain multiple certificates.
  396. =item B<-srvcert> I<filename>|I<uri>
  397. The specific CMP server certificate to expect and directly trust (even if it is
  398. expired) when validating signature-based protection of CMP response messages.
  399. May be set alternatively to the B<-trusted> option to pin the accepted server.
  400. If set, the subject of the certificate is also used
  401. as default value for the recipient of CMP requests
  402. and as default value for the expected sender of incoming CMP messages.
  403. =item B<-expect_sender> I<name>
  404. Distinguished Name (DN) expected in the sender field of incoming CMP messages.
  405. Defaults to the subject DN of the pinned B<-srvcert>, if any.
  406. This can be used to make sure that only a particular entity is accepted as
  407. CMP message signer, and attackers are not able to use arbitrary certificates
  408. of a trusted PKI hierarchy to fraudulently pose as a CMP server.
  409. Note that this option gives slightly more freedom than setting the B<-srvcert>,
  410. which pins the server to the holder of a particular certificate, while the
  411. expected sender name will continue to match after updates of the server cert.
  412. The argument must be formatted as I</type0=value0/type1=value1/type2=...>.
  413. For details see the description of the B<-subject> option.
  414. =item B<-ignore_keyusage>
  415. Ignore key usage restrictions in CMP signer certificates when validating
  416. signature-based protection of incoming CMP messages,
  417. else C<digitalSignature> must be allowed for signer certificate.
  418. =item B<-unprotected_errors>
  419. Accept missing or invalid protection of negative responses from the server.
  420. This applies to the following message types and contents:
  421. =over 4
  422. =item * error messages
  423. =item * negative certificate responses (IP/CP/KUP)
  424. =item * negative revocation responses (RP)
  425. =item * negative PKIConf messages
  426. =back
  427. B<WARNING:> This setting leads to unspecified behavior and it is meant
  428. exclusively to allow interoperability with server implementations violating
  429. RFC 4210, e.g.:
  430. =over 4
  431. =item * section 5.1.3.1 allows exceptions from protecting only for special
  432. cases:
  433. "There MAY be cases in which the PKIProtection BIT STRING is deliberately not
  434. used to protect a message [...] because other protection, external to PKIX, will
  435. be applied instead."
  436. =item * section 5.3.21 is clear on ErrMsgContent: "The CA MUST always sign it
  437. with a signature key."
  438. =item * appendix D.4 shows PKIConf message having protection
  439. =back
  440. =item B<-extracertsout> I<filename>
  441. The file where to save all certificates contained in the extraCerts field
  442. of the last received response message (except for pollRep and PKIConf).
  443. =item B<-cacertsout> I<filename>
  444. The file where to save any CA certificates contained in the caPubs field of
  445. the last received certificate response (i.e., IP, CP, or KUP) message.
  446. =back
  447. =head2 Client authentication options
  448. =over 4
  449. =item B<-ref> I<value>
  450. Reference number/string/value to use as fallback senderKID; this is required
  451. if no sender name can be determined from the B<-cert> or <-subject> options and
  452. is typically used when authenticating with pre-shared key (password-based MAC).
  453. =item B<-secret> I<arg>
  454. Prefer PBM-based message protection with given source of a secret value.
  455. The secret is used for creating PBM-based protection of outgoing messages
  456. and (as far as needed) for validating PBM-based protection of incoming messages.
  457. PBM stands for Password-Based Message Authentication Code.
  458. This takes precedence over the B<-cert> and B<-key> options.
  459. For more information about the format of I<arg> see
  460. L<openssl-passphrase-options(1)>.
  461. =item B<-cert> I<filename>|I<uri>
  462. The client's current CMP signer certificate.
  463. Requires the corresponding key to be given with B<-key>.
  464. The subject of this certificate will be used as sender of outgoing CMP messages,
  465. while the subject of B<-oldcert> or B<-subjectName> may provide fallback values.
  466. The issuer of this certificate is used as one of the recipient fallback values
  467. and as fallback issuer entry in the certificate template of IR/CR/KUR.
  468. When using signature-based message protection, this "protection certificate"
  469. will be included first in the extraCerts field of outgoing messages
  470. and the signature is done with the corresponding key.
  471. In Initialization Request (IR) messages this can be used for authenticating
  472. using an external entity certificate as defined in appendix E.7 of RFC 4210.
  473. For Key Update Request (KUR) messages this is also used as
  474. the certificate to be updated if the B<-oldcert> option is not given.
  475. If the file includes further certs, they are appended to the untrusted certs
  476. because they typically constitute the chain of the client certificate, which
  477. is included in the extraCerts field in signature-protected request messages.
  478. =item B<-own_trusted> I<filenames>|I<uris>
  479. If this list of certificates is provided then the chain built for
  480. the client-side CMP signer certificate given with the B<-cert> option
  481. is verified using the given certificates as trust anchors.
  482. Multiple sources may be given, separated by commas and/or whitespace
  483. (where in the latter case the whole argument must be enclosed in "...").
  484. Each source may contain multiple certificates.
  485. The certificate verification options
  486. B<-verify_hostname>, B<-verify_ip>, and B<-verify_email>
  487. have no effect on the certificate verification enabled via this option.
  488. =item B<-key> I<filename>|I<uri>
  489. The corresponding private key file for the client's current certificate given in
  490. the B<-cert> option.
  491. This will be used for signature-based message protection unless
  492. the B<-secret> option indicating PBM or B<-unprotected_requests> is given.
  493. =item B<-keypass> I<arg>
  494. Pass phrase source for the private key given with the B<-key> option.
  495. Also used for B<-cert> and B<-oldcert> in case it is an encrypted PKCS#12 file.
  496. If not given here, the password will be prompted for if needed.
  497. For more information about the format of I<arg> see
  498. L<openssl-passphrase-options(1)>.
  499. =item B<-digest> I<name>
  500. Specifies name of supported digest to use in RFC 4210's MSG_SIG_ALG
  501. and as the one-way function (OWF) in MSG_MAC_ALG.
  502. If applicable, this is used for message protection and
  503. Proof-of-Possession (POPO) signatures.
  504. To see the list of supported digests, use C<openssl list -digest-commands>.
  505. Defaults to C<sha256>.
  506. =item B<-mac> I<name>
  507. Specifies the name of the MAC algorithm in MSG_MAC_ALG.
  508. To get the names of supported MAC algorithms use C<openssl list -mac-algorithms>
  509. and possibly combine such a name with the name of a supported digest algorithm,
  510. e.g., hmacWithSHA256.
  511. Defaults to C<hmac-sha1> as per RFC 4210.
  512. =item B<-extracerts> I<filenames>|I<uris>
  513. Certificates to append in the extraCerts field when sending messages.
  514. They can be used as the default CMP signer certificate chain to include.
  515. Multiple sources may be given, separated by commas and/or whitespace
  516. (where in the latter case the whole argument must be enclosed in "...").
  517. Each source may contain multiple certificates.
  518. =item B<-unprotected_requests>
  519. Send messages without CMP-level protection.
  520. =back
  521. =head2 Credentials format options
  522. =over 4
  523. =item B<-certform> I<PEM|DER>
  524. File format to use when saving a certificate to a file.
  525. Default value is PEM.
  526. =item B<-keyform> I<PEM|DER|P12|ENGINE>
  527. The format of the key input; unspecified by default.
  528. See L<openssl(1)/Format Options> for details.
  529. =item B<-otherpass> I<arg>
  530. Pass phrase source for certificate given with the B<-trusted>, B<-untrusted>,
  531. B<-own_trusted>, B<-srvcert>, B<-out_trusted>, B<-extracerts>,
  532. B<-srv_trusted>, B<-srv_untrusted>, B<-rsp_extracerts>, B<-rsp_capubs>,
  533. B<-tls_extra>, and B<-tls_trusted> options.
  534. If not given here, the password will be prompted for if needed.
  535. For more information about the format of I<arg> see
  536. L<openssl-passphrase-options(1)>.
  537. {- $OpenSSL::safe::opt_engine_item -}
  538. {- output_off() if $disabled{"deprecated-3.0"}; "" -}
  539. As an alternative to using this combination:
  540. -engine {engineid} -key {keyid} -keyform ENGINE
  541. ... it's also possible to just give the key ID in URI form to B<-key>,
  542. like this:
  543. -key org.openssl.engine:{engineid}:{keyid}
  544. This applies to all options specifying keys: B<-key>, B<-newkey>, and
  545. B<-tls_key>.
  546. {- output_on() if $disabled{"deprecated-3.0"}; "" -}
  547. =back
  548. =head2 Provider options
  549. =over 4
  550. {- $OpenSSL::safe::opt_provider_item -}
  551. =back
  552. =head2 Random state options
  553. =over 4
  554. {- $OpenSSL::safe::opt_r_item -}
  555. =back
  556. =head2 TLS connection options
  557. =over 4
  558. =item B<-tls_used>
  559. Enable using TLS (even when other TLS_related options are not set)
  560. when connecting to CMP server.
  561. =item B<-tls_cert> I<filename>|I<uri>
  562. Client's TLS certificate.
  563. If the source includes further certs they are used (along with B<-untrusted>
  564. certs) for constructing the client cert chain provided to the TLS server.
  565. =item B<-tls_key> I<filename>|I<uri>
  566. Private key for the client's TLS certificate.
  567. =item B<-tls_keypass> I<arg>
  568. Pass phrase source for client's private TLS key B<-tls_key>.
  569. Also used for B<-tls_cert> in case it is an encrypted PKCS#12 file.
  570. If not given here, the password will be prompted for if needed.
  571. For more information about the format of I<arg> see
  572. L<openssl-passphrase-options(1)>.
  573. =item B<-tls_extra> I<filenames>|I<uris>
  574. Extra certificates to provide to TLS server during TLS handshake
  575. =item B<-tls_trusted> I<filenames>|I<uris>
  576. Trusted certificate(s) to use for validating the TLS server certificate.
  577. This implies hostname validation.
  578. Multiple sources may be given, separated by commas and/or whitespace
  579. (where in the latter case the whole argument must be enclosed in "...").
  580. Each source may contain multiple certificates.
  581. The certificate verification options
  582. B<-verify_hostname>, B<-verify_ip>, and B<-verify_email>
  583. have no effect on the certificate verification enabled via this option.
  584. =item B<-tls_host> I<name>
  585. Address to be checked during hostname validation.
  586. This may be a DNS name or an IP address.
  587. If not given it defaults to the B<-server> address.
  588. =back
  589. =head2 Client-side debugging options
  590. =over 4
  591. =item B<-batch>
  592. Do not interactively prompt for input, for instance when a password is needed.
  593. This can be useful for batch processing and testing.
  594. =item B<-repeat> I<number>
  595. Invoke the command the given positive number of times with the same parameters.
  596. Default is one invocation.
  597. =item B<-reqin> I<filenames>
  598. Take sequence of CMP requests from file(s).
  599. Multiple filenames may be given, separated by commas and/or whitespace
  600. (where in the latter case the whole argument must be enclosed in "...").
  601. As many files are read as needed for a complete transaction.
  602. =item B<-reqin_new_tid>
  603. Use a fresh transactionID for CMP request messages read using B<-reqin>,
  604. which requires re-protecting them as far as they were protected before.
  605. This may be needed in case the sequence of requests is reused
  606. and the CMP server complains that the transaction ID has already been used.
  607. =item B<-reqout> I<filenames>
  608. Save sequence of CMP requests to file(s).
  609. Multiple filenames may be given, separated by commas and/or whitespace.
  610. As many files are written as needed to store the complete transaction.
  611. =item B<-rspin> I<filenames>
  612. Process sequence of CMP responses provided in file(s), skipping server.
  613. Multiple filenames may be given, separated by commas and/or whitespace.
  614. As many files are read as needed for the complete transaction.
  615. =item B<-rspout> I<filenames>
  616. Save sequence of CMP responses to file(s).
  617. Multiple filenames may be given, separated by commas and/or whitespace.
  618. As many files are written as needed to store the complete transaction.
  619. =item B<-use_mock_srv>
  620. Use the internal mock server for testing the client.
  621. This works at API level, bypassing HTTP transport.
  622. =back
  623. =head2 Mock server options
  624. =over 4
  625. =item B<-port> I<number>
  626. Act as CMP HTTP server mock-up listening on the given port.
  627. =item B<-max_msgs> I<number>
  628. Maximum number of CMP (request) messages the CMP HTTP server mock-up
  629. should handle, which must be nonnegative.
  630. The default value is 0, which means that no limit is imposed.
  631. In any case the server terminates on internal errors, but not when it
  632. detects a CMP-level error that it can successfully answer with an error message.
  633. =item B<-srv_ref> I<value>
  634. Reference value to use as senderKID of server in case no B<-srv_cert> is given.
  635. =item B<-srv_secret> I<arg>
  636. Password source for server authentication with a pre-shared key (secret).
  637. =item B<-srv_cert> I<filename>|I<uri>
  638. Certificate of the server.
  639. =item B<-srv_key> I<filename>|I<uri>
  640. Private key used by the server for signing messages.
  641. =item B<-srv_keypass> I<arg>
  642. Server private key (and cert) file pass phrase source.
  643. =item B<-srv_trusted> I<filenames>|I<uris>
  644. Trusted certificates for client authentication.
  645. The certificate verification options
  646. B<-verify_hostname>, B<-verify_ip>, and B<-verify_email>
  647. have no effect on the certificate verification enabled via this option.
  648. =item B<-srv_untrusted> I<filenames>|I<uris>
  649. Intermediate CA certs that may be useful when validating client certificates.
  650. =item B<-rsp_cert> I<filename>|I<uri>
  651. Certificate to be returned as mock enrollment result.
  652. =item B<-rsp_extracerts> I<filenames>|I<uris>
  653. Extra certificates to be included in mock certification responses.
  654. =item B<-rsp_capubs> I<filenames>|I<uris>
  655. CA certificates to be included in mock Initialization Response (IP) message.
  656. =item B<-poll_count> I<number>
  657. Number of times the client must poll before receiving a certificate.
  658. =item B<-check_after> I<number>
  659. The checkAfter value (number of seconds to wait) to include in poll response.
  660. =item B<-grant_implicitconf>
  661. Grant implicit confirmation of newly enrolled certificate.
  662. =item B<-pkistatus> I<number>
  663. PKIStatus to be included in server response.
  664. Valid range is 0 (accepted) .. 6 (keyUpdateWarning).
  665. =item B<-failure> I<number>
  666. A single failure info bit number to be included in server response.
  667. Valid range is 0 (badAlg) .. 26 (duplicateCertReq).
  668. =item B<-failurebits> I<number>
  669. Number representing failure bits to be included in server response.
  670. Valid range is 0 .. 2^27 - 1.
  671. =item B<-statusstring> I<arg>
  672. Text to be included as status string in server response.
  673. =item B<-send_error>
  674. Force server to reply with error message.
  675. =item B<-send_unprotected>
  676. Send response messages without CMP-level protection.
  677. =item B<-send_unprot_err>
  678. In case of negative responses, server shall send unprotected error messages,
  679. certificate responses (IP/CP/KUP), and revocation responses (RP).
  680. WARNING: This setting leads to behavior violating RFC 4210.
  681. =item B<-accept_unprotected>
  682. Accept missing or invalid protection of requests.
  683. =item B<-accept_unprot_err>
  684. Accept unprotected error messages from client.
  685. =item B<-accept_raverified>
  686. Accept RAVERIFED as proof-of-possession (POPO).
  687. =back
  688. =head2 Certificate verification options, for both CMP and TLS
  689. =over 4
  690. {- $OpenSSL::safe::opt_v_item -}
  691. The certificate verification options
  692. B<-verify_hostname>, B<-verify_ip>, and B<-verify_email>
  693. only affect the certificate verification enabled via the B<-out_trusted> option.
  694. =back
  695. =head1 NOTES
  696. When setting up CMP configurations and experimenting with enrollment options
  697. typically various errors occur until the configuration is correct and complete.
  698. When the CMP server reports an error the client will by default
  699. check the protection of the CMP response message.
  700. Yet some CMP services tend not to protect negative responses.
  701. In this case the client will reject them, and thus their contents are not shown
  702. although they usually contain hints that would be helpful for diagnostics.
  703. For assisting in such cases the CMP client offers a workaround via the
  704. B<-unprotected_errors> option, which allows accepting such negative messages.
  705. =head1 EXAMPLES
  706. =head2 Simple examples using the default OpenSSL configuration file
  707. This CMP client implementation comes with demonstrative CMP sections
  708. in the example configuration file F<openssl/apps/openssl.cnf>,
  709. which can be used to interact conveniently with the Insta Demo CA.
  710. In order to enroll an initial certificate from that CA it is sufficient
  711. to issue the following shell commands.
  712. export OPENSSL_CONF=/path/to/openssl/apps/openssl.cnf
  713. =begin comment
  714. wget 'http://pki.certificate.fi:8081/install-ca-cert.html/ca-certificate.crt\
  715. ?ca-id=632&download-certificate=1' -O insta.ca.crt
  716. =end comment
  717. openssl genrsa -out insta.priv.pem
  718. openssl cmp -section insta
  719. This should produce the file F<insta.cert.pem> containing a new certificate
  720. for the private key held in F<insta.priv.pem>.
  721. It can be viewed using, e.g.,
  722. openssl x509 -noout -text -in insta.cert.pem
  723. In case the network setup requires using an HTTP proxy it may be given as usual
  724. via the environment variable B<http_proxy> or via the B<-proxy> option in the
  725. configuration file or the CMP command-line argument B<-proxy>, for example
  726. -proxy http://192.168.1.1:8080
  727. In the Insta Demo CA scenario both clients and the server may use the pre-shared
  728. secret I<insta> and the reference value I<3078> to authenticate to each other.
  729. Alternatively, CMP messages may be protected in signature-based manner,
  730. where the trust anchor in this case is F<insta.ca.crt>
  731. and the client may use any certificate already obtained from that CA,
  732. as specified in the B<[signature]> section of the example configuration.
  733. This can be used in combination with the B<[insta]> section simply by
  734. openssl cmp -section insta,signature
  735. By default the CMP IR message type is used, yet CR works equally here.
  736. This may be specified directly at the command line:
  737. openssl cmp -section insta -cmd cr
  738. or by referencing in addition the B<[cr]> section of the example configuration:
  739. openssl cmp -section insta,cr
  740. In order to update the enrolled certificate one may call
  741. openssl cmp -section insta,kur
  742. using with PBM-based protection or
  743. openssl cmp -section insta,kur,signature
  744. using signature-based protection.
  745. In a similar way any previously enrolled certificate may be revoked by
  746. openssl cmp -section insta,rr -trusted insta.ca.crt
  747. or
  748. openssl cmp -section insta,rr,signature
  749. Many more options can be given in the configuration file
  750. and/or on the command line.
  751. For instance, the B<-reqexts> CLI option may refer to a section in the
  752. configuration file defining X.509 extensions to use in certificate requests,
  753. such as C<v3_req> in F<openssl/apps/openssl.cnf>:
  754. openssl cmp -section insta,cr -reqexts v3_req
  755. =head2 Certificate enrollment
  756. The following examples do not make use of a configuration file at first.
  757. They assume that a CMP server can be contacted on the local TCP port 80
  758. and accepts requests under the alias I</pkix/>.
  759. For enrolling its very first certificate the client generates a client key
  760. and sends an initial request message to the local CMP server
  761. using a pre-shared secret key for mutual authentication.
  762. In this example the client does not have the CA certificate yet,
  763. so we specify the name of the CA with the B<-recipient> option
  764. and save any CA certificates that we may receive in the C<capubs.pem> file.
  765. In below command line usage examples the C<\> at line ends is used just
  766. for formatting; each of the command invocations should be on a single line.
  767. openssl genrsa -out cl_key.pem
  768. openssl cmp -cmd ir -server 127.0.0.1:80/pkix/ -recipient "/CN=CMPserver" \
  769. -ref 1234 -secret pass:1234-5678 \
  770. -newkey cl_key.pem -subject "/CN=MyName" \
  771. -cacertsout capubs.pem -certout cl_cert.pem
  772. =head2 Certificate update
  773. Then, when the client certificate and its related key pair needs to be updated,
  774. the client can send a key update request taking the certs in C<capubs.pem>
  775. as trusted for authenticating the server and using the previous cert and key
  776. for its own authentication.
  777. Then it can start using the new cert and key.
  778. openssl genrsa -out cl_key_new.pem
  779. openssl cmp -cmd kur -server 127.0.0.1:80/pkix/ \
  780. -trusted capubs.pem \
  781. -cert cl_cert.pem -key cl_key.pem \
  782. -newkey cl_key_new.pem -certout cl_cert.pem
  783. cp cl_key_new.pem cl_key.pem
  784. This command sequence can be repated as often as needed.
  785. =head2 Requesting information from CMP server
  786. Requesting "all relevant information" with an empty General Message.
  787. This prints information about all received ITAV B<infoType>s to stdout.
  788. openssl cmp -cmd genm -server 127.0.0.1/pkix/ -recipient "/CN=CMPserver" \
  789. -ref 1234 -secret pass:1234-5678
  790. =head2 Using a custom configuration file
  791. For CMP client invocations, in particular for certificate enrollment,
  792. usually many parameters need to be set, which is tedious and error-prone to do
  793. on the command line.
  794. Therefore, the client offers the possibility to read
  795. options from sections of the OpenSSL config file, usually called F<openssl.cnf>.
  796. The values found there can still be extended and even overridden by any
  797. subsequently loaded sections and on the command line.
  798. After including in the configuration file the following sections:
  799. [cmp]
  800. server = 127.0.0.1
  801. path = pkix/
  802. trusted = capubs.pem
  803. cert = cl_cert.pem
  804. key = cl_key.pem
  805. newkey = cl_key.pem
  806. certout = cl_cert.pem
  807. [init]
  808. recipient = "/CN=CMPserver"
  809. trusted =
  810. cert =
  811. key =
  812. ref = 1234
  813. secret = pass:1234-5678-1234-567
  814. subject = "/CN=MyName"
  815. cacertsout = capubs.pem
  816. the above enrollment transactions reduce to
  817. openssl cmp -section cmp,init
  818. openssl cmp -cmd kur -newkey cl_key_new.pem
  819. and the above transaction using a general message reduces to
  820. openssl cmp -section cmp,init -cmd genm
  821. =head1 SEE ALSO
  822. L<openssl-genrsa(1)>, L<openssl-ecparam(1)>, L<openssl-list(1)>,
  823. L<openssl-req(1)>, L<openssl-x509(1)>, L<x509v3_config(5)>
  824. =head1 HISTORY
  825. The B<cmp> application was added in OpenSSL 3.0.
  826. The B<-engine option> was deprecated in OpenSSL 3.0.
  827. =head1 COPYRIGHT
  828. Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
  829. Licensed under the OpenSSL license (the "License"). You may not use
  830. this file except in compliance with the License. You can obtain a copy
  831. in the file LICENSE in the source distribution or at
  832. L<https://www.openssl.org/source/license.html>.
  833. =cut