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