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