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