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