1=pod 2{- OpenSSL::safe::output_do_not_edit_headers(); -} 3 4=head1 NAME 5 6openssl-cmp - Certificate Management Protocol (CMP, RFC 4210) application 7 8=head1 SYNOPSIS 9 10B<openssl> B<cmp> 11[B<-help>] 12[B<-config> I<filename>] 13[B<-section> I<names>] 14[B<-verbosity> I<level>] 15 16Generic message options: 17 18[B<-cmd> I<ir|cr|kur|p10cr|rr|genm>] 19[B<-infotype> I<name>] 20[B<-profile> I<name>] 21[B<-geninfo> I<values>] 22[B<-template> I<filename>] 23[B<-keyspec> I<filename>] 24 25Certificate enrollment options: 26 27[B<-newkey> I<filename>|I<uri>] 28[B<-newkeypass> I<arg>] 29[B<-centralkeygen> 30[B<-newkeyout> I<filename>] 31[B<-subject> I<name>] 32[B<-days> I<number>] 33[B<-reqexts> I<name>] 34[B<-sans> I<spec>] 35[B<-san_nodefault>] 36[B<-policies> I<name>] 37[B<-policy_oids> I<names>] 38[B<-policy_oids_critical>] 39[B<-popo> I<number>] 40[B<-csr> I<filename>] 41[B<-out_trusted> I<filenames>|I<uris>] 42[B<-implicit_confirm>] 43[B<-disable_confirm>] 44[B<-certout> I<filename>] 45[B<-chainout> I<filename>] 46 47Certificate enrollment and revocation options: 48 49[B<-oldcert> I<filename>|I<uri>] 50[B<-issuer> I<name>] 51[B<-serial> I<number>] 52[B<-revreason> I<number>] 53 54Message transfer options: 55 56[B<-server> I<[http[s]://][userinfo@]host[:port][/path][?query][#fragment]>] 57[B<-proxy> I<[http[s]://][userinfo@]host[:port][/path][?query][#fragment]>] 58[B<-no_proxy> I<addresses>] 59[B<-recipient> I<name>] 60[B<-path> I<remote_path>] 61[B<-keep_alive> I<value>] 62[B<-msg_timeout> I<seconds>] 63[B<-total_timeout> I<seconds>] 64 65Server authentication options: 66 67[B<-trusted> I<filenames>|I<uris>] 68[B<-untrusted> I<filenames>|I<uris>] 69[B<-srvcert> I<filename>|I<uri>] 70[B<-expect_sender> I<name>] 71[B<-ignore_keyusage>] 72[B<-unprotected_errors>] 73[B<-no_cache_extracerts>] 74[B<-srvcertout> I<filename>] 75[B<-extracertsout> I<filename>] 76[B<-cacertsout> I<filename>] 77[B<-oldwithold> I<filename>] 78[B<-newwithnew> I<filename>] 79[B<-newwithold> I<filename>] 80[B<-oldwithnew> I<filename>] 81[B<-crlcert> I<filename>] 82[B<-oldcrl> I<filename>] 83[B<-crlout> I<filename>] 84 85Client authentication and protection options: 86 87[B<-ref> I<value>] 88[B<-secret> I<arg>] 89[B<-cert> I<filename>|I<uri>] 90[B<-own_trusted> I<filenames>|I<uris>] 91[B<-key> I<filename>|I<uri>] 92[B<-keypass> I<arg>] 93[B<-digest> I<name>] 94[B<-mac> I<name>] 95[B<-extracerts> I<filenames>|I<uris>] 96[B<-unprotected_requests>] 97 98Credentials format options: 99 100[B<-certform> I<PEM|DER>] 101[B<-crlform> I<PEM|DER>] 102[B<-keyform> I<PEM|DER|P12|ENGINE>] 103[B<-otherpass> I<arg>] 104{- $OpenSSL::safe::opt_engine_synopsis -}{- $OpenSSL::safe::opt_provider_synopsis -} 105 106Random state options: 107 108{- $OpenSSL::safe::opt_r_synopsis -} 109 110TLS connection options: 111 112[B<-tls_used>] 113[B<-tls_cert> I<filename>|I<uri>] 114[B<-tls_key> I<filename>|I<uri>] 115[B<-tls_keypass> I<arg>] 116[B<-tls_extra> I<filenames>|I<uris>] 117[B<-tls_trusted> I<filenames>|I<uris>] 118[B<-tls_host> I<name>] 119 120Client-side debugging options: 121 122[B<-batch>] 123[B<-repeat> I<number>] 124[B<-reqin> I<filenames>] 125[B<-reqin_new_tid>] 126[B<-reqout> I<filenames>] 127[B<-reqout_only> I<filename>] 128[B<-rspin> I<filenames>] 129[B<-rspout> I<filenames>] 130[B<-use_mock_srv>] 131 132Mock server options: 133 134[B<-port> I<number>] 135[B<-max_msgs> I<number>] 136[B<-srv_ref> I<value>] 137[B<-srv_secret> I<arg>] 138[B<-srv_cert> I<filename>|I<uri>] 139[B<-srv_key> I<filename>|I<uri>] 140[B<-srv_keypass> I<arg>] 141[B<-srv_trusted> I<filenames>|I<uris>] 142[B<-srv_untrusted> I<filenames>|I<uris>] 143[B<-ref_cert> I<filename>|I<uri>] 144[B<-rsp_cert> I<filename>|I<uri>] 145[B<-rsp_key> I<filename>|I<uri>] 146[B<-rsp_keypass> I<filename>|I<uri>] 147[B<-rsp_crl> I<filename>|I<uri>] 148[B<-rsp_extracerts> I<filenames>|I<uris>] 149[B<-rsp_capubs> I<filenames>|I<uris>] 150[B<-rsp_newwithnew> I<filename>|I<uri>] 151[B<-rsp_newwithold> I<filename>|I<uri>] 152[B<-rsp_oldwithnew> I<filename>|I<uri>] 153[B<-poll_count> I<number>] 154[B<-check_after> I<number>] 155[B<-grant_implicitconf>] 156[B<-pkistatus> I<number>] 157[B<-failure> I<number>] 158[B<-failurebits> I<number>] 159[B<-statusstring> I<arg>] 160[B<-send_error>] 161[B<-send_unprotected>] 162[B<-send_unprot_err>] 163[B<-accept_unprotected>] 164[B<-accept_unprot_err>] 165[B<-accept_raverified>] 166 167Certificate verification options, for both CMP and TLS: 168 169{- $OpenSSL::safe::opt_v_synopsis -} 170 171=head1 DESCRIPTION 172 173The B<cmp> command is a client implementation for the Certificate 174Management Protocol (CMP) as defined in RFC4210. 175It can be used to request certificates from a CA server, 176update their certificates, 177request certificates to be revoked, and perform other types of CMP requests. 178 179=head1 OPTIONS 180 181=over 4 182 183=item B<-help> 184 185Display a summary of all options 186 187=item B<-config> I<filename> 188 189Configuration file to use. 190An empty string C<""> means none. 191Default filename is from the environment variable C<OPENSSL_CONF>. 192 193=item B<-section> I<names> 194 195Section(s) to use within config file defining CMP options. 196An empty string C<""> means no specific section. 197Default is C<cmp>. 198 199Multiple section names may be given, separated by commas and/or whitespace 200(where in the latter case the whole argument must be enclosed in "..."). 201Contents of sections named later may override contents of sections named before. 202In any case, as usual, the C<[default]> section and finally the unnamed 203section (as far as present) can provide per-option fallback values. 204 205=item B<-verbosity> I<level> 206 207Level of verbosity for logging, error output, etc. 2080 = EMERG, 1 = ALERT, 2 = CRIT, 3 = ERR, 4 = WARN, 5 = NOTE, 2096 = INFO, 7 = DEBUG, 8 = TRACE. 210Defaults to 6 = INFO. 211 212=back 213 214=head2 Generic message options 215 216=over 4 217 218=item B<-cmd> I<ir|cr|kur|p10cr|rr|genm> 219 220CMP command to execute. 221Currently implemented commands are: 222 223=over 8 224 225=item ir E<nbsp> - Initialization Request 226 227=item cr E<nbsp> - Certificate Request 228 229=item p10cr - PKCS#10 Certification Request (for legacy support) 230 231=item kur E<nbsp>E<nbsp>- Key Update Request 232 233=item rr E<nbsp> - Revocation Request 234 235=item genm - General Message 236 237=back 238 239B<ir> requests initialization of an end entity into a PKI hierarchy 240by issuing a first certificate. 241 242B<cr> requests issuing an additional certificate for an end entity already 243initialized to the PKI hierarchy. 244 245B<p10cr> requests issuing an additional certificate similarly to B<cr> 246but using legacy PKCS#10 CSR format. 247 248B<kur> requests a (key) update for an existing certificate. 249 250B<rr> requests revocation of an existing certificate. 251 252B<genm> requests information using a General Message, where optionally 253included B<InfoTypeAndValue>s may be used to state which info is of interest. 254Upon receipt of the General Response, information about all received 255ITAV B<infoType>s is printed to stdout. 256 257=item B<-infotype> I<name> 258 259Set InfoType name to use for requesting specific info in B<genm>, 260e.g., C<signKeyPairTypes>. 261There is specific support for C<caCerts>, C<rootCaCert>, 262C<certReqTemplate>, and C<crlStatusList> (CRL update retrieval). 263 264=item B<-profile> I<name> 265 266Name of a certificate profile to place in 267the PKIHeader generalInfo field of request messages. 268 269=item B<-geninfo> I<values> 270 271A comma-separated list of InfoTypeAndValue to place in 272the generalInfo field of the PKIHeader of requests messages. 273Each InfoTypeAndValue gives an OID and an integer or string value 274of the form I<OID>:int:I<number> or I<OID>:str:I<text>, 275e.g., C<'1.2.3.4:int:56789, id-kp:str:name'>. 276 277=item B<-template> I<filename> 278 279The file to save any CRMF certTemplate in DER format 280received in a genp message with id-it-certReqTemplate. 281 282=item B<-keyspec> I<filename> 283 284It is optional and used to specify the file to save any keySpec if 285present in a genp message with id-it-keyGenParameters. 286 287Note: any keySpec field contents received are logged as INFO. 288 289=back 290 291=head2 Certificate enrollment options 292 293=over 4 294 295=item B<-newkey> I<filename>|I<uri> 296 297The source of the private or public key for the certificate being requested. 298Defaults to the public key in the PKCS#10 CSR given with the B<-csr> option, 299the public key of the reference certificate, or the current client key. 300 301The public portion of the key is placed in the certification request. 302 303Unless B<-cmd> I<p10cr>, B<-popo> I<-1>, or B<-popo> I<0> is given, the 304private key will be needed as well to provide the proof of possession (POPO), 305where the B<-key> option may provide a fallback. 306 307=item B<-newkeypass> I<arg> 308 309Pass phrase source for the key given with the B<-newkey> option. 310If not given here, the password will be prompted for if needed. 311 312For more information about the format of I<arg> see 313L<openssl-passphrase-options(1)>. 314 315=item B<-centralkeygen> 316 317Request central key generation for certificate enrollment. 318This applies to B<-cmd> I<ir|cr|kur|p10cr>. 319 320=item B<-newkeyout> I<filename> 321 322File to save centrally generated private key, in PEM format. 323 324=item B<-subject> I<name> 325 326X.509 Distinguished Name (DN) to use as subject field 327in the requested certificate template in IR/CR/KUR messages. 328If the NULL-DN (C</>) is given then no subject is placed in the template. 329Default is the subject DN of any PKCS#10 CSR given with the B<-csr> option. 330For KUR, a further fallback is the subject DN 331of the reference certificate (see B<-oldcert>) if provided. 332This fallback is used for IR and CR only if no SANs are set. 333 334If provided and neither of B<-cert>, B<-oldcert>, or B<-csr> is given, 335the subject DN is used as fallback sender of outgoing CMP messages. 336 337The argument must be formatted as I</type0=value0/type1=value1/type2=...>. 338Special characters may be escaped by C<\> (backslash); whitespace is retained. 339Empty values are permitted, but the corresponding type will not be included. 340Giving a single C</> will lead to an empty sequence of RDNs (a NULL-DN). 341Multi-valued RDNs can be formed by placing a C<+> character instead of a C</> 342between the AttributeValueAssertions (AVAs) that specify the members of the set. 343Example: 344 345C</DC=org/DC=OpenSSL/DC=users/UID=123456+CN=John Doe> 346 347=item B<-days> I<number> 348 349Number of days the new certificate is requested to be valid for, counting from 350the current time of the host. 351Also triggers the explicit request that the 352validity period starts from the current time (as seen by the host). 353 354=item B<-reqexts> I<name> 355 356Name of section in OpenSSL config file defining certificate request extensions. 357If the B<-csr> option is present, these extensions augment the extensions 358contained the given PKCS#10 CSR, overriding any extensions with same OIDs. 359 360=item B<-sans> I<spec> 361 362One or more IP addresses, email addresses, DNS names, or URIs 363separated by commas or whitespace 364(where in the latter case the whole argument must be enclosed in "...") 365to add as Subject Alternative Name(s) (SAN) certificate request extension. 366If the special element "critical" is given the SANs are flagged as critical. 367Cannot be used if any Subject Alternative Name extension is set via B<-reqexts>. 368 369=item B<-san_nodefault> 370 371When Subject Alternative Names are not given via B<-sans> 372nor defined via B<-reqexts>, 373they are copied by default from the reference certificate (see B<-oldcert>). 374This can be disabled by giving the B<-san_nodefault> option. 375 376=item B<-policies> I<name> 377 378Name of section in OpenSSL config file defining policies to be set 379as certificate request extension. 380This option cannot be used together with B<-policy_oids>. 381 382=item B<-policy_oids> I<names> 383 384One or more OID(s), separated by commas and/or whitespace 385(where in the latter case the whole argument must be enclosed in "...") 386to add as certificate policies request extension. 387This option cannot be used together with B<-policies>. 388 389=item B<-policy_oids_critical> 390 391Flag the policies given with B<-policy_oids> as critical. 392 393=item B<-popo> I<number> 394 395Proof-of-possession (POPO) method to use for IR/CR/KUR; values: C<-1>..<2> where 396C<-1> = NONE, which implies central key generation, 397C<0> = RAVERIFIED, C<1> = SIGNATURE (default), C<2> = KEYENC. 398 399Note that a signature-based POPO can only be produced if a private key 400is provided via the B<-newkey> or B<-key> options. 401 402=item B<-csr> I<filename> 403 404PKCS#10 CSR in PEM or DER format containing a certificate request. 405With B<-cmd> I<p10cr> it is used directly in a legacy P10CR message. 406 407When used with B<-cmd> I<ir>, I<cr>, or I<kur>, 408it is transformed into the respective regular CMP request. 409In this case, a private key must be provided (with B<-newkey> or B<-key>) 410for the proof of possession (unless B<-popo> I<-1> or B<-popo> I<0> is used) 411and the respective public key is placed in the certification request 412(rather than taking over the public key contained in the PKCS#10 CSR). 413 414PKCS#10 CSR input may also be used with B<-cmd> I<rr> 415to specify the certificate to be revoked 416via the included subject name and public key. 417Its subject is used as fallback sender in CMP message headers 418if B<-cert> and B<-oldcert> are not given. 419 420=item B<-out_trusted> I<filenames>|I<uris> 421 422Trusted certificate(s) to use for validating the newly enrolled certificate. 423During this verification, any certificate status checking is disabled. 424 425Multiple sources may be given, separated by commas and/or whitespace 426(where in the latter case the whole argument must be enclosed in "..."). 427Each source may contain multiple certificates. 428 429The certificate verification options 430B<-verify_hostname>, B<-verify_ip>, and B<-verify_email> 431only affect the certificate verification enabled via this option. 432 433=item B<-implicit_confirm> 434 435Request implicit confirmation of newly enrolled certificates. 436 437=item B<-disable_confirm> 438 439Do not send certificate confirmation message for newly enrolled certificate 440without requesting implicit confirmation 441to cope with broken servers not supporting implicit confirmation correctly. 442B<WARNING:> This leads to behavior violating RFC 4210. 443 444=item B<-certout> I<filename> 445 446The file where any newly enrolled certificate should be saved. 447 448=item B<-chainout> I<filename> 449 450The file where the chain of any newly enrolled certificate should be saved. 451This chain excludes the leaf certificate, i.e., the newly enrolled certificate. 452Also the trust anchor (the root certificate) is not included. 453 454If the B<-certout> option is given, too, with equal I<filename> argument, 455then the file produced contains both outputs concatenated: 456the newly enrolled certificate followed by its chain. 457 458=back 459 460=head2 Certificate enrollment and revocation options 461 462=over 4 463 464=item B<-oldcert> I<filename>|I<uri> 465 466The certificate to be updated (i.e., renewed or re-keyed) in Key Update Request 467(KUR) messages or to be revoked in Revocation Request (RR) messages. 468For KUR the certificate to be updated defaults to B<-cert>, 469and the resulting certificate is called I<reference certificate>. 470For RR the certificate to be revoked can also be specified using B<-csr>. 471B<-oldcert> and B<-csr> is ignored if B<-issuer> and B<-serial> is provided. 472 473The reference certificate, if any, is also used for 474deriving default subject DN and Subject Alternative Names and the 475default issuer entry in the requested certificate template of an IR/CR/KUR. 476Its public key is used as a fallback in the template of certification requests. 477Its subject is used as sender of outgoing messages if B<-cert> is not given. 478Its issuer is used as default recipient in CMP message headers 479if neither B<-recipient>, B<-srvcert>, nor B<-issuer> is given. 480 481=item B<-issuer> I<name> 482 483X.509 Distinguished Name (DN) to place as the issuer field 484in the requested certificate template in IR/CR/KUR/RR messages. 485If the NULL-DN (C</>) is given then no issuer is placed in the template. 486 487If provided and neither B<-recipient> nor B<-srvcert> is given, 488the issuer DN is used as fallback recipient of outgoing CMP messages. 489 490The argument must be formatted as I</type0=value0/type1=value1/type2=...>. 491For details see the description of the B<-subject> option. 492 493=item B<-serial> I<number> 494 495Specify the Serial number of certificate to be revoked in revocation request. 496The serial number can be decimal or hex (if preceded by C<0x>) 497 498=item B<-revreason> I<number> 499 500Set CRLReason to be included in revocation request (RR); values: C<0>..C<10> 501or C<-1> for none (which is the default). 502 503Reason numbers defined in RFC 5280 are: 504 505 CRLReason ::= ENUMERATED { 506 unspecified (0), 507 keyCompromise (1), 508 cACompromise (2), 509 affiliationChanged (3), 510 superseded (4), 511 cessationOfOperation (5), 512 certificateHold (6), 513 -- value 7 is not used 514 removeFromCRL (8), 515 privilegeWithdrawn (9), 516 aACompromise (10) 517 } 518 519=back 520 521=head2 Message transfer options 522 523=over 4 524 525=item B<-server> I<[http[s]://][userinfo@]host[:port][/path][?query][#fragment]> 526 527The I<host> domain name or IP address and optionally I<port> 528of the CMP server to connect to using HTTP(S). 529IP address may be for v4 or v6, such as C<127.0.0.1> or C<[::1]> for localhost. 530If the host string is an IPv6 address, it must be enclosed in C<[> and C<]>. 531 532This option excludes I<-port> and I<-use_mock_srv>. 533It is ignored if I<-rspin> is given with enough filename arguments. 534 535If the scheme C<https> is given, the B<-tls_used> option is implied. 536When TLS is used, the default port is 443, otherwise 80. 537The optional userinfo and fragment components are ignored. 538Any given query component is handled as part of the path component. 539If a path is included it provides the default value for the B<-path> option. 540 541=item B<-proxy> I<[http[s]://][userinfo@]host[:port][/path][?query][#fragment]> 542 543The HTTP(S) proxy server to use for reaching the CMP server unless B<-no_proxy> 544applies, see below. 545If the host string is an IPv6 address, it must be enclosed in C<[> and C<]>. 546The proxy port defaults to 80 or 443 if the scheme is C<https>; apart from that 547the optional C<http://> or C<https://> prefix is ignored (note that using TLS 548may be required by B<-tls_used> or B<-server> with the prefix C<https>), 549as well as any path, userinfo, and query, and fragment components. 550Defaults to the environment variable C<http_proxy> if set, else C<HTTP_PROXY> 551in case no TLS is used, otherwise C<https_proxy> if set, else C<HTTPS_PROXY>. 552This option is ignored if I<-server> is not given. 553 554=item B<-no_proxy> I<addresses> 555 556List of IP addresses and/or DNS names of servers 557not to use an HTTP(S) proxy for, separated by commas and/or whitespace 558(where in the latter case the whole argument must be enclosed in "..."). 559Default is from the environment variable C<no_proxy> if set, else C<NO_PROXY>. 560This option is ignored if I<-server> is not given. 561 562=item B<-recipient> I<name> 563 564Distinguished Name (DN) to use in the recipient field of CMP request message 565headers, i.e., the CMP server (usually the addressed CA). 566 567The recipient field in the header of a CMP message is mandatory. 568If not given explicitly the recipient is determined in the following order: 569the subject of the CMP server certificate given with the B<-srvcert> option, 570the B<-issuer> option, 571the issuer of the certificate given with the B<-oldcert> option, 572the issuer of the CMP client certificate (B<-cert> option), 573as far as any of those is present, else the NULL-DN as last resort. 574 575The argument must be formatted as I</type0=value0/type1=value1/type2=...>. 576For details see the description of the B<-subject> option. 577 578=item B<-path> I<remote_path> 579 580HTTP path at the CMP server (aka CMP alias) to use for POST requests. 581Defaults to any path given with B<-server>, else C<"/">. 582 583=item B<-keep_alive> I<value> 584 585If the given value is 0 then HTTP connections are closed after each response 586(which would be the default behavior of HTTP 1.0) 587even if a CMP transaction needs more than one round trip. 588If the value is 1 or 2 589then for each transaction a persistent connection is requested. 590If the value is 2 then a persistent connection is required, 591i.e., an error occurs if the server does not grant it. 592The default value is 1, which means preferring to keep the connection open. 593 594=item B<-msg_timeout> I<seconds> 595 596Number of seconds a CMP request-response message round trip 597is allowed to take before a timeout error is returned. 598A value <= 0 means no limitation (waiting indefinitely). 599Default is to use the B<-total_timeout> setting. 600 601=item B<-total_timeout> I<seconds> 602 603Maximum total number of seconds a transaction may take, 604including polling etc. 605A value <= 0 means no limitation (waiting indefinitely). 606Default is 0. 607 608=back 609 610=head2 Server authentication options 611 612=over 4 613 614=item B<-trusted> I<filenames>|I<uris> 615 616The certificate(s), typically of root CAs, the client shall use as trust anchors 617when validating signature-based protection of CMP response messages. 618This option is ignored if the B<-srvcert> option is given as well. 619It provides more flexibility than B<-srvcert> because the CMP protection 620certificate of the server is not pinned but may be any certificate 621from which a chain to one of the given trust anchors can be constructed. 622 623If none of B<-trusted>, B<-srvcert>, and B<-secret> is given, message validation 624errors will be thrown unless B<-unprotected_errors> permits an exception. 625 626Multiple sources may be given, separated by commas and/or whitespace 627(where in the latter case the whole argument must be enclosed in "..."). 628Each source may contain multiple certificates. 629 630The certificate verification options 631B<-verify_hostname>, B<-verify_ip>, and B<-verify_email> 632have no effect on the certificate verification enabled via this option. 633 634=item B<-untrusted> I<filenames>|I<uris> 635 636Non-trusted intermediate CA certificate(s). 637Any extra certificates given with the B<-cert> option are appended to it. 638All these certificates may be useful for cert path construction 639for the own CMP signer certificate (to include in the extraCerts field of 640request messages) and for the TLS client certificate (if TLS is used) 641as well as for chain building 642when validating server certificates (checking signature-based 643CMP message protection) and when validating newly enrolled certificates. 644 645Multiple sources may be given, separated by commas and/or whitespace 646(where in the latter case the whole argument must be enclosed in "..."). 647Each source may contain multiple certificates. 648 649=item B<-srvcert> I<filename>|I<uri> 650 651The specific CMP server certificate to expect and directly trust (even if it is 652expired) when verifying signature-based protection of CMP response messages. 653This pins the accepted server and results in ignoring the B<-trusted> option. 654 655If set, the subject of the certificate is also used 656as default value for the recipient of CMP requests 657and as default value for the expected sender of CMP responses. 658 659=item B<-expect_sender> I<name> 660 661Distinguished Name (DN) expected in the sender field of incoming CMP messages. 662Defaults to the subject DN of the pinned B<-srvcert>, if any. 663 664This can be used to make sure that only a particular entity is accepted as 665CMP message signer, and attackers are not able to use arbitrary certificates 666of a trusted PKI hierarchy to fraudulently pose as a CMP server. 667Note that this option gives slightly more freedom than setting the B<-srvcert>, 668which pins the server to the holder of a particular certificate, while the 669expected sender name will continue to match after updates of the server cert. 670 671The argument must be formatted as I</type0=value0/type1=value1/type2=...>. 672For details see the description of the B<-subject> option. 673 674=item B<-ignore_keyusage> 675 676Ignore key usage restrictions in CMP signer certificates when validating 677signature-based protection of incoming CMP messages. 678By default, C<digitalSignature> must be allowed by CMP signer certificates. 679This option applies to both CMP clients and the mock server. 680 681=item B<-unprotected_errors> 682 683Accept missing or invalid protection of negative responses from the server. 684This applies to the following message types and contents: 685 686=over 4 687 688=item * error messages 689 690=item * negative certificate responses (IP/CP/KUP) 691 692=item * negative revocation responses (RP) 693 694=item * negative PKIConf messages 695 696=back 697 698B<WARNING:> This setting leads to unspecified behavior and it is meant 699exclusively to allow interoperability with server implementations violating 700RFC 4210, e.g.: 701 702=over 4 703 704=item * section 5.1.3.1 allows exceptions from protecting only for special 705cases: 706"There MAY be cases in which the PKIProtection BIT STRING is deliberately not 707used to protect a message [...] because other protection, external to PKIX, will 708be applied instead." 709 710=item * section 5.3.21 is clear on ErrMsgContent: "The CA MUST always sign it 711with a signature key." 712 713=item * appendix D.4 shows PKIConf message having protection 714 715=back 716 717=item B<-no_cache_extracerts> 718 719Do not cache certificates in the extraCerts field of CMP messages received. 720By default, they are kept as they may be helful for validating further messages. 721This option applies to both CMP clients and the mock server. 722 723=item B<-srvcertout> I<filename> 724 725The file where to save the successfully validated certificate, if any, 726that the CMP server used for signature-based response message protection. 727If there is no such certificate, typically because the protection was MAC-based, 728this is indicated by deleting the file (if it existed). 729 730=item B<-extracertsout> I<filename> 731 732The file where to save the list of certificates contained in the extraCerts 733field of the last received response message that is not a pollRep nor PKIConf. 734 735=item B<-cacertsout> I<filename> 736 737The file where to save the list of CA certificates contained in the caPubs field 738if a positive certificate response (i.e., IP, CP, or KUP) message was received 739or contained in a general response (genp) message with infoType C<caCerts>. 740 741=item B<-oldwithold> I<filename> 742 743The root CA certificate to include in a genm request of infoType C<rootCaCert>. 744If present and the optional oldWithNew certificate is received, 745it is verified using the newWithNew certificate as the (only) trust anchor. 746 747=item B<-newwithnew> I<filename> 748 749This option must be provided when B<-infotype> I<rootCaCert> is given. 750It specifies the file to save the newWithNew certificate 751received in a genp message of type C<rootCaKeyUpdate>. 752If on success no such cert was received, this file (if present) is deleted 753to indicate that the requested root CA certificate update is not available. 754 755Any received newWithNew certificate is verified 756using any received newWithOld certificate as untrusted intermediate certificate 757and the certificate provided with B<-oldwithold> as the (only) trust anchor, 758or if not provided, using the certificates given with the B<-trusted> option. 759 760B<WARNING:> 761The newWithNew certificate is meant to be a certificate that will be trusted. 762The trust placed in it cannot be stronger than the trust placed in 763the B<-oldwithold> certificate if present, otherwise it cannot be stronger than 764the weakest trust placed in any of the B<-trusted> certificates. 765 766=item B<-newwithold> I<filename> 767 768The file to save any newWithOld certificate 769received in a genp message of infoType C<rootCaKeyUpdate>. 770If on success no such cert was received, this is indicated by deleting the file. 771 772=item B<-oldwithnew> I<filename> 773 774The file to save any oldWithNew certificate 775received in a genp message of infoType C<rootCaKeyUpdate>. 776If on success no such cert was received, this is indicated by deleting the file. 777 778=item B<-crlcert> I<filename> 779 780Certificate to derive CRL issuer data for the source field 781when obtaining a CRL in a genm request with infoType C<crlStatusList>. 782Any available distribution point name is preferred over issuer names. 783 784=item B<-oldcrl> I<filename> 785 786The CRL to obtain an update for in a genm request with infoType C<crlStatusList>. 787Unless the B<-crlcert> option is provided as well, 788the given CRL is used for deriving CRL issuer data for the source field. 789Any available distribution point name is preferred over issuer names. 790If the CRL contains a thisUpdate field, its value is copied to the request. 791 792=item B<-crlout> I<filename> 793 794The file to save any CRL received in a genp message of infoType C<crls>. 795If on success no such CRL was received, this is indicated by deleting the file. 796 797=back 798 799=head2 Client authentication options 800 801=over 4 802 803=item B<-ref> I<value> 804 805Reference number/string/value to use as fallback senderKID; this is required 806if no sender name can be determined from the B<-cert> or <-subject> options and 807is typically used when authenticating with pre-shared key (password-based MAC). 808 809=item B<-secret> I<arg> 810 811Provides the source of a secret value to use with MAC-based message protection. 812This takes precedence over the B<-cert> and B<-key> options. 813The secret is used for creating MAC-based protection of outgoing messages 814and for validating incoming messages that have MAC-based protection. 815The algorithm used by default is Password-Based Message Authentication Code (PBM) 816as defined in RFC 4210 section 5.1.3.1. 817 818For more information about the format of I<arg> see 819L<openssl-passphrase-options(1)>. 820 821=item B<-cert> I<filename>|I<uri> 822 823The client's current CMP signer certificate. 824Requires the corresponding key to be given with B<-key>. 825 826The subject and the public key contained in this certificate 827serve as fallback values in the certificate template of IR/CR/KUR messages. 828 829The subject of this certificate will be used as sender of outgoing CMP messages, 830while the subject of B<-oldcert> or B<-subjectName> may provide fallback values. 831 832The issuer of this certificate is used as one of the recipient fallback values 833and as fallback issuer entry in the certificate template of IR/CR/KUR messages. 834 835When performing signature-based message protection, 836this "protection certificate", also called "signer certificate", 837will be included first in the extraCerts field of outgoing messages 838and the signature is done with the corresponding key. 839In Initialization Request (IR) messages this can be used for authenticating 840using an external entity certificate as defined in appendix E.7 of RFC 4210. 841 842For Key Update Request (KUR) messages this is also used as 843the certificate to be updated if the B<-oldcert> option is not given. 844 845If the file includes further certs, they are appended to the untrusted certs 846because they typically constitute the chain of the client certificate, which 847is included in the extraCerts field in signature-protected request messages. 848 849=item B<-own_trusted> I<filenames>|I<uris> 850 851If this list of certificates is provided then the chain built for 852the client-side CMP signer certificate given with the B<-cert> option 853is verified using the given certificates as trust anchors. 854 855Multiple sources may be given, separated by commas and/or whitespace 856(where in the latter case the whole argument must be enclosed in "..."). 857Each source may contain multiple certificates. 858 859The certificate verification options 860B<-verify_hostname>, B<-verify_ip>, and B<-verify_email> 861have no effect on the certificate verification enabled via this option. 862 863=item B<-key> I<filename>|I<uri> 864 865The corresponding private key file for the client's current certificate given in 866the B<-cert> option. 867This will be used for signature-based message protection unless the B<-secret> 868option indicating MAC-based protection or B<-unprotected_requests> is given. 869 870It is also used as a fallback for the B<-newkey> option with IR/CR/KUR messages. 871 872=item B<-keypass> I<arg> 873 874Pass phrase source for the private key given with the B<-key> option. 875Also used for B<-cert> and B<-oldcert> in case it is an encrypted PKCS#12 file. 876If not given here, the password will be prompted for if needed. 877 878For more information about the format of I<arg> see 879L<openssl-passphrase-options(1)>. 880 881=item B<-digest> I<name> 882 883Specifies name of supported digest to use in RFC 4210's MSG_SIG_ALG 884and as the one-way function (OWF) in C<MSG_MAC_ALG>. 885If applicable, this is used for message protection and 886proof-of-possession (POPO) signatures. 887To see the list of supported digests, use C<openssl list -digest-commands>. 888Defaults to C<sha256>. 889 890=item B<-mac> I<name> 891 892Specifies the name of the MAC algorithm in C<MSG_MAC_ALG>. 893To get the names of supported MAC algorithms use C<openssl list -mac-algorithms> 894and possibly combine such a name with the name of a supported digest algorithm, 895e.g., hmacWithSHA256. 896Defaults to C<hmac-sha1> as per RFC 4210. 897 898=item B<-extracerts> I<filenames>|I<uris> 899 900Certificates to append in the extraCerts field when sending messages. 901They can be used as the default CMP signer certificate chain to include. 902 903Multiple sources may be given, separated by commas and/or whitespace 904(where in the latter case the whole argument must be enclosed in "..."). 905Each source may contain multiple certificates. 906 907=item B<-unprotected_requests> 908 909Send request messages without CMP-level protection. 910 911=back 912 913=head2 Credentials format options 914 915=over 4 916 917=item B<-certform> I<PEM|DER> 918 919File format to use when saving a certificate to a file. 920Default value is PEM. 921 922=item B<-crlform> I<PEM|DER> 923 924File format to use when saving a CRL to a file. 925Default value is DER. 926DER format is preferred because it enables more efficient storage 927of large CRLs. 928 929=item B<-keyform> I<PEM|DER|P12|ENGINE> 930 931The format of the key input; unspecified by default. 932See L<openssl(1)/Format Options> for details. 933 934=item B<-otherpass> I<arg> 935 936Pass phrase source for certificate given with the B<-trusted>, B<-untrusted>, 937B<-own_trusted>, B<-srvcert>, B<-crlcert>, B<-out_trusted>, B<-extracerts>, 938B<-srv_trusted>, B<-srv_untrusted>, B<-ref_cert>, 939B<-rsp_extracerts>, B<-rsp_capubs>, 940B<-rsp_newwithnew>, B<-rsp_newwithold>, B<-rsp_oldwithnew>, 941B<-tls_extra>, and B<-tls_trusted> options. 942If not given here, the password will be prompted for if needed. 943 944For more information about the format of I<arg> see 945L<openssl-passphrase-options(1)>. 946 947{- $OpenSSL::safe::opt_engine_item -} 948 949{- output_off() if $disabled{"deprecated-3.0"}; "" -} 950As an alternative to using this combination: 951 952 -engine {engineid} -key {keyid} -keyform ENGINE 953 954... it's also possible to just give the key ID in URI form to B<-key>, 955like this: 956 957 -key org.openssl.engine:{engineid}:{keyid} 958 959This applies to all options specifying keys: B<-key>, B<-newkey>, and 960B<-tls_key>. 961{- output_on() if $disabled{"deprecated-3.0"}; "" -} 962 963=back 964 965=head2 Provider options 966 967=over 4 968 969{- $OpenSSL::safe::opt_provider_item -} 970 971=back 972 973=head2 Random state options 974 975=over 4 976 977{- $OpenSSL::safe::opt_r_item -} 978 979=back 980 981=head2 TLS connection options 982 983=over 4 984 985=item B<-tls_used> 986 987Make the CMP client use TLS (regardless if other TLS-related options are set) 988for message exchange with the server via HTTP. 989This option is not supported with the I<-port> option. 990It is implied if the B<-server> option is given with the scheme C<https>. 991It is ignored if the B<-server> option is not given or B<-use_mock_srv> is given 992or B<-rspin> is given with enough filename arguments. 993 994The following TLS-related options are ignored if TLS is not used. 995 996=item B<-tls_cert> I<filename>|I<uri> 997 998Client's TLS certificate to use for authenticating to the TLS server. 999If the source includes further certs they are used (along with B<-untrusted> 1000certs) for constructing the client cert chain provided to the TLS server. 1001 1002=item B<-tls_key> I<filename>|I<uri> 1003 1004Private key for the client's TLS certificate. 1005 1006=item B<-tls_keypass> I<arg> 1007 1008Pass phrase source for client's private TLS key B<-tls_key>. 1009Also used for B<-tls_cert> in case it is an encrypted PKCS#12 file. 1010If not given here, the password will be prompted for if needed. 1011 1012For more information about the format of I<arg> see 1013L<openssl-passphrase-options(1)>. 1014 1015=item B<-tls_extra> I<filenames>|I<uris> 1016 1017Extra certificates to provide to the TLS server during handshake. 1018 1019=item B<-tls_trusted> I<filenames>|I<uris> 1020 1021Trusted certificate(s) to use for validating the TLS server certificate. 1022This implies hostname validation. 1023 1024Multiple sources may be given, separated by commas and/or whitespace 1025(where in the latter case the whole argument must be enclosed in "..."). 1026Each source may contain multiple certificates. 1027 1028The certificate verification options 1029B<-verify_hostname>, B<-verify_ip>, and B<-verify_email> 1030have no effect on the certificate verification enabled via this option. 1031 1032=item B<-tls_host> I<name> 1033 1034Address to be checked during hostname validation. 1035This may be a DNS name or an IP address. 1036If not given it defaults to the B<-server> address. 1037 1038=back 1039 1040=head2 Client-side options for debugging and offline scenarios 1041 1042=over 4 1043 1044=item B<-batch> 1045 1046Do not interactively prompt for input, for instance when a password is needed. 1047This can be useful for batch processing and testing. 1048 1049=item B<-repeat> I<number> 1050 1051Invoke the command the given positive number of times with the same parameters. 1052Default is one invocation. 1053 1054=item B<-reqin> I<filenames> 1055 1056Take the sequence of CMP requests to send to the server from the given file(s) 1057rather than from the sequence of requests produced internally. 1058 1059This option is useful for supporting offline scenarios where the certificate 1060request (or any other CMP request) is produced beforehand and sent out later. 1061 1062This option is ignored if the B<-rspin> option is given 1063because in the latter case no requests are actually sent. 1064 1065Note that in any case the client produces internally its sequence 1066of CMP request messages. Thus, all options required for doing this 1067(such as B<-cmd> and all options providing the required parameters) 1068need to be given also when the B<-reqin> option is present. 1069 1070If the B<-reqin> option is given for a certificate request 1071and no B<-newkey>, B<-key>, B<-oldcert>, or B<-csr> option is given, 1072a fallback public key is taken from the request message file 1073(if it is included in the certificate template). 1074 1075Hint: In case the B<-reqin> option is given for a certificate request, there are 1076situations where the client has access to the public key to be certified but 1077not to the private key that by default will be needed for proof of possession. 1078In this case the POPO is not actually needed (because the internally produced 1079certificate request message will not be sent), and its generation 1080can be disabled using the options B<-popo> I<-1> or B<-popo> I<0>. 1081 1082Multiple filenames may be given, separated by commas and/or whitespace 1083(where in the latter case the whole argument must be enclosed in "..."). 1084 1085The files are read as far as needed to complete the transaction 1086and filenames have been provided. If more requests are needed, 1087the remaining ones are taken from the items at the respective position 1088in the sequence of requests produced internally. 1089 1090The client needs to update the recipNonce field in the given requests (except 1091for the first one) in order to satisfy the checks to be performed by the server. 1092This causes re-protection (if protecting requests is required). 1093 1094=item B<-reqin_new_tid> 1095 1096Use a fresh transactionID for CMP request messages read using B<-reqin>, 1097which causes their reprotection (if protecting requests is required). 1098This may be needed in case the sequence of requests is reused 1099and the CMP server complains that the transaction ID has already been used. 1100 1101=item B<-reqout> I<filenames> 1102 1103Save the sequence of CMP requests created by the client to the given file(s). 1104These requests are not sent to the server if the B<-reqin> option is used, too. 1105 1106Multiple filenames may be given, separated by commas and/or whitespace. 1107 1108Files are written as far as needed to save the transaction 1109and filenames have been provided. 1110If the transaction contains more requests, the remaining ones are not saved. 1111 1112=item B<-reqout_only> I<filename> 1113 1114Save the first CMP requests created by the client to the given file and exit. 1115Any options related to CMP servers and their responses are ignored. 1116 1117This option is useful for supporting offline scenarios where the certificate 1118request (or any other CMP request) is produced beforehand and sent out later. 1119 1120=item B<-rspin> I<filenames> 1121 1122Process the sequence of CMP responses provided in the given file(s), 1123not contacting any given server, 1124as long as enough filenames are provided to complete the transaction. 1125 1126Multiple filenames may be given, separated by commas and/or whitespace. 1127 1128Any server specified via the I<-server> or I<-use_mock_srv> options is contacted 1129only if more responses are needed to complete the transaction. 1130In this case the transaction will fail 1131unless the server has been prepared to continue the already started transaction. 1132 1133=item B<-rspout> I<filenames> 1134 1135Save the sequence of actually used CMP responses to the given file(s). 1136These have been received from the server unless B<-rspin> takes effect. 1137 1138Multiple filenames may be given, separated by commas and/or whitespace. 1139 1140Files are written as far as needed to save the responses 1141contained in the transaction and filenames have been provided. 1142If the transaction contains more responses, the remaining ones are not saved. 1143 1144=item B<-use_mock_srv> 1145 1146Test the client using the internal CMP server mock-up at API level, 1147bypassing socket-based transfer via HTTP. 1148This excludes the B<-server> and B<-port> options. 1149 1150=back 1151 1152=head2 Mock server options 1153 1154=over 4 1155 1156=item B<-port> I<number> 1157 1158Act as HTTP-based CMP server mock-up listening on the given local port. 1159The client may address the server via, e.g., C<127.0.0.1> or C<[::1]>. 1160This option excludes the B<-server> and B<-use_mock_srv> options. 1161The B<-rspin>, B<-rspout>, B<-reqin>, and B<-reqout> options 1162so far are not supported in this mode. 1163 1164=item B<-max_msgs> I<number> 1165 1166Maximum number of CMP (request) messages the CMP HTTP server mock-up 1167should handle, which must be nonnegative. 1168The default value is 0, which means that no limit is imposed. 1169In any case the server terminates on internal errors, but not when it 1170detects a CMP-level error that it can successfully answer with an error message. 1171 1172=item B<-srv_ref> I<value> 1173 1174Reference value to use as senderKID of server in case no B<-srv_cert> is given. 1175 1176=item B<-srv_secret> I<arg> 1177 1178Password source for server authentication with a pre-shared key (secret). 1179 1180=item B<-srv_cert> I<filename>|I<uri> 1181 1182Certificate of the server. 1183 1184=item B<-srv_key> I<filename>|I<uri> 1185 1186Private key used by the server for signing messages. 1187 1188=item B<-srv_keypass> I<arg> 1189 1190Server private key (and cert) file pass phrase source. 1191 1192=item B<-srv_trusted> I<filenames>|I<uris> 1193 1194Trusted certificates for client authentication. 1195 1196The certificate verification options 1197B<-verify_hostname>, B<-verify_ip>, and B<-verify_email> 1198have no effect on the certificate verification enabled via this option. 1199 1200=item B<-srv_untrusted> I<filenames>|I<uris> 1201 1202Intermediate CA certs that may be useful when validating client certificates. 1203 1204=item B<-ref_cert> I<filename>|I<uri> 1205 1206Certificate to be expected for RR messages and any oldCertID in KUR messages. 1207 1208=item B<-rsp_cert> I<filename>|I<uri> 1209 1210Certificate to be returned as mock enrollment result. 1211 1212=item B<-rsp_key> I<filename>|I<uri> 1213 1214Private key to be returned as central key generation result. 1215 1216=item B<-rsp_keypass> I<arg> 1217 1218Pass phrase source for B<rsp_cert> and B<rsp_key>. 1219 1220=item B<-rsp_crl> I<filename>|I<uri> 1221 1222CRL to be returned in genp of type C<crls>. 1223 1224=item B<-rsp_extracerts> I<filenames>|I<uris> 1225 1226Extra certificates to be included in mock certification responses. 1227 1228=item B<-rsp_capubs> I<filenames>|I<uris> 1229 1230CA certificates to be included in mock Initialization Response (IP) message. 1231 1232=item B<-rsp_newwithnew> I<filename>|I<uri> 1233 1234Certificate to be returned in newWithNew field of genp of type rootCaKeyUpdate. 1235 1236=item B<-rsp_newwithold> I<filename>|I<uri> 1237 1238Certificate to be returned in newWithOld field of genp of type rootCaKeyUpdate. 1239 1240=item B<-rsp_oldwithnew> I<filename>|I<uri> 1241 1242Certificate to be returned in oldWithNew field of genp of type rootCaKeyUpdate. 1243 1244=item B<-poll_count> I<number> 1245 1246Number of times the client must poll before receiving a certificate. 1247 1248=item B<-check_after> I<number> 1249 1250The checkAfter value (number of seconds to wait) to include in poll response. 1251 1252=item B<-grant_implicitconf> 1253 1254Grant implicit confirmation of newly enrolled certificate. 1255 1256=item B<-pkistatus> I<number> 1257 1258PKIStatus to be included in server response. 1259Valid range is 0 (accepted) .. 6 (keyUpdateWarning). 1260 1261=item B<-failure> I<number> 1262 1263A single failure info bit number to be included in server response. 1264Valid range is 0 (badAlg) .. 26 (duplicateCertReq). 1265 1266=item B<-failurebits> I<number> 1267Number representing failure bits to be included in server response. 1268Valid range is 0 .. 2^27 - 1. 1269 1270=item B<-statusstring> I<arg> 1271 1272Text to be included as status string in server response. 1273 1274=item B<-send_error> 1275 1276Force server to reply with error message. 1277 1278=item B<-send_unprotected> 1279 1280Send response messages without CMP-level protection. 1281 1282=item B<-send_unprot_err> 1283 1284In case of negative responses, server shall send unprotected error messages, 1285certificate responses (IP/CP/KUP), and revocation responses (RP). 1286WARNING: This setting leads to behavior violating RFC 4210. 1287 1288=item B<-accept_unprotected> 1289 1290Accept missing or invalid protection of requests. 1291 1292=item B<-accept_unprot_err> 1293 1294Accept unprotected error messages from client. 1295So far this has no effect because the server does not accept any error messages. 1296 1297=item B<-accept_raverified> 1298 1299Accept RAVERIFED as proof of possession (POPO). 1300 1301=back 1302 1303=head2 Certificate verification options, for both CMP and TLS 1304 1305=over 4 1306 1307{- $OpenSSL::safe::opt_v_item -} 1308 1309The certificate verification options 1310B<-verify_hostname>, B<-verify_ip>, and B<-verify_email> 1311only affect the certificate verification enabled via the B<-out_trusted> option. 1312 1313=back 1314 1315=head1 NOTES 1316 1317When a client obtains, from a CMP server, CA certificates that it is going to 1318trust, for instance via the C<caPubs> field of a certificate response 1319or using general messages with infoType C<caCerts> or C<rootCaCert>, 1320authentication of the CMP server is particularly critical. 1321So special care must be taken setting up server authentication 1322using B<-trusted> and related options for certificate-based authentication 1323or B<-secret> for MAC-based protection. 1324If authentication is certificate-based, the B<-srvcertout> option 1325should be used to obtain the validated server certificate 1326and perform an authorization check based on it. 1327 1328When setting up CMP configurations and experimenting with enrollment options 1329typically various errors occur until the configuration is correct and complete. 1330When the CMP server reports an error the client will by default 1331check the protection of the CMP response message. 1332Yet some CMP services tend not to protect negative responses. 1333In this case the client will reject them, and thus their contents are not shown 1334although they usually contain hints that would be helpful for diagnostics. 1335For assisting in such cases the CMP client offers a workaround via the 1336B<-unprotected_errors> option, which allows accepting such negative messages. 1337 1338If OpenSSL was built with trace support enabled (e.g., C<./config enable-trace>) 1339and the environment variable B<OPENSSL_TRACE> includes B<HTTP>, 1340the requests and the response headers transferred via HTTP are printed. 1341 1342=head1 EXAMPLES 1343 1344=head2 Simple examples using the default OpenSSL configuration file 1345 1346This CMP client implementation comes with demonstrative CMP sections 1347in the example configuration file F<openssl/apps/openssl.cnf>, 1348which can be used to interact conveniently with the Insta Demo CA. 1349 1350In order to enroll an initial certificate from that CA it is sufficient 1351to issue the following shell commands. 1352 1353 export OPENSSL_CONF=/path/to/openssl/apps/openssl.cnf 1354 1355=begin comment 1356 1357 wget 'http://pki.certificate.fi:8081/install-ca-cert.html/ca-certificate.crt\ 1358 ?ca-id=632&download-certificate=1' -O insta.ca.crt 1359 1360=end comment 1361 1362 openssl genrsa -out insta.priv.pem 1363 openssl cmp -section insta 1364 1365This should produce the file F<insta.cert.pem> containing a new certificate 1366for the private key held in F<insta.priv.pem>. 1367It can be viewed using, e.g., 1368 1369 openssl x509 -noout -text -in insta.cert.pem 1370 1371In case the network setup requires using an HTTP proxy it may be given as usual 1372via the environment variable B<http_proxy> or via the B<-proxy> option in the 1373configuration file or the CMP command-line argument B<-proxy>, for example 1374 1375 -proxy http://192.168.1.1:8080 1376 1377In the Insta Demo CA scenario both clients and the server may use the pre-shared 1378secret I<insta> and the reference value I<3078> to authenticate to each other. 1379 1380Alternatively, CMP messages may be protected in signature-based manner, 1381where the trust anchor in this case is F<insta.ca.crt> 1382and the client may use any certificate already obtained from that CA, 1383as specified in the B<[signature]> section of the example configuration. 1384This can be used in combination with the B<[insta]> section simply by 1385 1386 openssl cmp -section insta,signature 1387 1388By default the CMP IR message type is used, yet CR works equally here. 1389This may be specified directly at the command line: 1390 1391 openssl cmp -section insta -cmd cr 1392 1393or by referencing in addition the B<[cr]> section of the example configuration: 1394 1395 openssl cmp -section insta,cr 1396 1397In order to update the enrolled certificate one may call 1398 1399 openssl cmp -section insta,kur,signature 1400 1401using signature-based protection with the certificate that is to be updated. 1402For certificate updates, MAC-based protection should generally not be used. 1403 1404In a similar way any previously enrolled certificate may be revoked by 1405 1406 openssl cmp -section insta,rr -trusted insta.ca.crt 1407 1408or 1409 1410 openssl cmp -section insta,rr,signature 1411 1412Many more options can be given in the configuration file 1413and/or on the command line. 1414For instance, the B<-reqexts> CLI option may refer to a section in the 1415configuration file defining X.509 extensions to use in certificate requests, 1416such as C<v3_req> in F<openssl/apps/openssl.cnf>: 1417 1418 openssl cmp -section insta,cr -reqexts v3_req 1419 1420=head2 Certificate enrollment 1421 1422The following examples do not make use of a configuration file at first. 1423They assume that a CMP server can be contacted on the local TCP port 80 1424and accepts requests under the alias I</pkix/>. 1425 1426For enrolling its very first certificate the client generates a client key 1427and sends an initial request message to the local CMP server 1428using a pre-shared secret key for mutual authentication. 1429In this example the client does not have the CA certificate yet, 1430so we specify the name of the CA with the B<-recipient> option 1431and save any CA certificates that we may receive in the C<capubs.pem> file. 1432 1433In below command line usage examples the C<\> at line ends is used just 1434for formatting; each of the command invocations should be on a single line. 1435 1436 openssl genrsa -out cl_key.pem 1437 openssl cmp -cmd ir -server 127.0.0.1:80/pkix/ -recipient "/CN=CMPserver" \ 1438 -ref 1234 -secret pass:1234-5678 \ 1439 -newkey cl_key.pem -subject "/CN=MyName" \ 1440 -cacertsout capubs.pem -certout cl_cert.pem 1441 1442=head2 Certificate update 1443 1444Then, when the client certificate and its related key pair needs to be updated, 1445the client can send a key update request taking the certs in C<capubs.pem> 1446as trusted for authenticating the server and using the previous cert and key 1447for its own authentication. 1448Then it can start using the new cert and key. 1449 1450 openssl genrsa -out cl_key_new.pem 1451 openssl cmp -cmd kur -server 127.0.0.1:80/pkix/ \ 1452 -trusted capubs.pem \ 1453 -cert cl_cert.pem -key cl_key.pem \ 1454 -newkey cl_key_new.pem -certout cl_cert.pem 1455 cp cl_key_new.pem cl_key.pem 1456 1457This command sequence can be repeated as often as needed. 1458 1459=head2 Requesting information from CMP server 1460 1461Requesting "all relevant information" with an empty General Message. 1462This prints information about all received ITAV B<infoType>s to stdout. 1463 1464 openssl cmp -cmd genm -server 127.0.0.1/pkix/ -recipient "/CN=CMPserver" \ 1465 -ref 1234 -secret pass:1234-5678 1466 1467=head2 Using a custom configuration file 1468 1469For CMP client invocations, in particular for certificate enrollment, 1470usually many parameters need to be set, which is tedious and error-prone to do 1471on the command line. 1472Therefore, the client offers the possibility to read 1473options from sections of the OpenSSL config file, usually called F<openssl.cnf>. 1474The values found there can still be extended and even overridden by any 1475subsequently loaded sections and on the command line. 1476 1477After including in the configuration file the following sections: 1478 1479 [cmp] 1480 server = 127.0.0.1 1481 path = pkix/ 1482 trusted = capubs.pem 1483 cert = cl_cert.pem 1484 key = cl_key.pem 1485 newkey = cl_key.pem 1486 certout = cl_cert.pem 1487 1488 [init] 1489 recipient = "/CN=CMPserver" 1490 trusted = 1491 cert = 1492 key = 1493 ref = 1234 1494 secret = pass:1234-5678-1234-567 1495 subject = "/CN=MyName" 1496 cacertsout = capubs.pem 1497 1498the above enrollment transactions reduce to 1499 1500 openssl cmp -section cmp,init 1501 openssl cmp -cmd kur -newkey cl_key_new.pem 1502 1503and the above transaction using a general message reduces to 1504 1505 openssl cmp -section cmp,init -cmd genm 1506 1507=head1 SEE ALSO 1508 1509L<openssl-genrsa(1)>, L<openssl-ecparam(1)>, L<openssl-list(1)>, 1510L<openssl-req(1)>, L<openssl-x509(1)>, L<x509v3_config(5)> 1511 1512=head1 HISTORY 1513 1514The B<cmp> application was added in OpenSSL 3.0. 1515 1516The B<-engine> option was deprecated in OpenSSL 3.0. 1517 1518The B<-oldwithold>, B<-newwithnew>, B<-newwithold>, B<-oldwithnew>, 1519The B<-srvcertout>, and B<-serial> option were added in OpenSSL 3.2, as well 1520as an extension of B<-cacertsout> to use when getting CA certificates. 1521Since then, the B<-issuer> may be used also for certificates to be revoked. 1522 1523The B<-profile> and B<-no_cache_extracerts> options were added in OpenSSL 3.3, 1524as well as support for delayed delivery of all types of response messages. 1525 1526The B<-template>, B<-crlcert>, B<-oldcrl>, B<-crlout>, B<-crlform> 1527and B<-rsp_crl> options were added in OpenSSL 3.4. 1528 1529B<-centralkeygen>, b<-newkeyout>, B<-rsp_key> and 1530B<-rsp_keypass> were added in OpenSSL 3.5. 1531 1532=head1 COPYRIGHT 1533 1534Copyright 2007-2025 The OpenSSL Project Authors. All Rights Reserved. 1535 1536Licensed under the Apache License 2.0 (the "License"). You may not use 1537this file except in compliance with the License. You can obtain a copy 1538in the file LICENSE in the source distribution or at 1539L<https://www.openssl.org/source/license.html>. 1540 1541=cut 1542