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