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