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