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