openssl-cmp.pod.in 47 KB

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