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