openssl-cmp.pod.in 49 KB

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