add internal doc files actually belonging to CMP contribution chunk 6
[openssl.git] / doc / man1 / openssl.pod
1 =pod
2
3 =head1 NAME
4
5 openssl - OpenSSL command line tool
6
7 =head1 SYNOPSIS
8
9 B<openssl>
10 I<command>
11 [ I<options> ... ]
12 [ I<parameters> ... ]
13
14 B<openssl>
15 B<list>
16 B<-standard-commands> |
17 B<-digest-commands> |
18 B<-cipher-commands> |
19 B<-cipher-algorithms> |
20 B<-digest-algorithms> |
21 B<-mac-algorithms> |
22 B<-public-key-algorithms>
23
24 B<openssl> B<no->I<XXX> [ I<options> ]
25
26 =head1 DESCRIPTION
27
28 OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL
29 v2/v3) and Transport Layer Security (TLS v1) network protocols and related
30 cryptography standards required by them.
31
32 The B<openssl> program is a command line tool for using the various
33 cryptography functions of OpenSSL's B<crypto> library from the shell.
34 It can be used for
35
36  o  Creation and management of private keys, public keys and parameters
37  o  Public key cryptographic operations
38  o  Creation of X.509 certificates, CSRs and CRLs
39  o  Calculation of Message Digests and Message Authentication Codes
40  o  Encryption and Decryption with Ciphers
41  o  SSL/TLS Client and Server Tests
42  o  Handling of S/MIME signed or encrypted mail
43  o  Timestamp requests, generation and verification
44
45 =head1 COMMAND SUMMARY
46
47 The B<openssl> program provides a rich variety of commands (I<command> in
48 the L</SYNOPSIS> above).
49 Each command can have many options and argument parameters, shown above as
50 I<options> and I<parameters>.
51
52 Detailed documentation and use cases for most standard subcommands are available
53 (e.g., L<openssl-x509(1)>).
54
55 Many commands use an external configuration file for some or all of their
56 arguments and have a B<-config> option to specify that file.
57 The default name of the file is F<openssl.cnf> in the default certificate
58 storage area, which can be determined from the L<openssl-version(1)>
59 command.
60 The environment variable B<OPENSSL_CONF> can be used to specify
61 a different location of the file.
62 See L<openssl-env(7)>.
63
64 The list options B<-standard-commands>, B<-digest-commands>,
65 and B<-cipher-commands> output a list (one entry per line) of the names
66 of all standard commands, message digest commands, or cipher commands,
67 respectively, that are available.
68
69 The list parameters B<-cipher-algorithms>, B<-digest-algorithms>,
70 and B<-mac-algorithms> list all cipher, message digest, and message
71 authentication code names, one entry per line. Aliases are listed as:
72
73  from => to
74
75 The list parameter B<-public-key-algorithms> lists all supported public
76 key algorithms.
77
78 The command B<no->I<XXX> tests whether a command of the
79 specified name is available.  If no command named I<XXX> exists, it
80 returns 0 (success) and prints B<no->I<XXX>; otherwise it returns 1
81 and prints I<XXX>.  In both cases, the output goes to B<stdout> and
82 nothing is printed to B<stderr>.  Additional command line arguments
83 are always ignored.  Since for each cipher there is a command of the
84 same name, this provides an easy way for shell scripts to test for the
85 availability of ciphers in the B<openssl> program.  (B<no->I<XXX> is
86 not able to detect pseudo-commands such as B<quit>,
87 B<list>, or B<no->I<XXX> itself.)
88
89 =head2 Standard Commands
90
91 =over 4
92
93 =item B<asn1parse>
94
95 Parse an ASN.1 sequence.
96
97 =item B<ca>
98
99 Certificate Authority (CA) Management.
100
101 =item B<ciphers>
102
103 Cipher Suite Description Determination.
104
105 =item B<cms>
106
107 CMS (Cryptographic Message Syntax) utility.
108
109 =item B<crl>
110
111 Certificate Revocation List (CRL) Management.
112
113 =item B<crl2pkcs7>
114
115 CRL to PKCS#7 Conversion.
116
117 =item B<dgst>
118
119 Message Digest calculation. MAC calculations are superseded by
120 L<openssl-mac(1)>.
121
122 =item B<dhparam>
123
124 Generation and Management of Diffie-Hellman Parameters. Superseded by
125 L<openssl-genpkey(1)> and L<openssl-pkeyparam(1)>.
126
127 =item B<dsa>
128
129 DSA Data Management.
130
131 =item B<dsaparam>
132
133 DSA Parameter Generation and Management. Superseded by
134 L<openssl-genpkey(1)> and L<openssl-pkeyparam(1)>.
135
136 =item B<ec>
137
138 EC (Elliptic curve) key processing.
139
140 =item B<ecparam>
141
142 EC parameter manipulation and generation.
143
144 =item B<enc>
145
146 Encryption, decryption, and encoding.
147
148 =item B<engine>
149
150 Engine (loadable module) information and manipulation.
151
152 =item B<errstr>
153
154 Error Number to Error String Conversion.
155
156 =item B<fipsinstall>
157
158 FIPS configuration installation.
159
160 =item B<gendsa>
161
162 Generation of DSA Private Key from Parameters. Superseded by
163 L<openssl-genpkey(1)> and L<openssl-pkey(1)>.
164
165 =item B<genpkey>
166
167 Generation of Private Key or Parameters.
168
169 =item B<genrsa>
170
171 Generation of RSA Private Key. Superseded by L<openssl-genpkey(1)>.
172
173 =item B<help>
174
175 Display information about a command's options.
176
177 =item B<info>
178
179 Display diverse information built into the OpenSSL libraries.
180
181 =item B<kdf>
182
183 Key Derivation Functions.
184
185 =item B<list>
186
187 List algorithms and features.
188
189 =item B<mac>
190
191 Message Authentication Code Calculation.
192
193 =item B<nseq>
194
195 Create or examine a Netscape certificate sequence.
196
197 =item B<ocsp>
198
199 Online Certificate Status Protocol utility.
200
201 =item B<passwd>
202
203 Generation of hashed passwords.
204
205 =item B<pkcs12>
206
207 PKCS#12 Data Management.
208
209 =item B<pkcs7>
210
211 PKCS#7 Data Management.
212
213 =item B<pkcs8>
214
215 PKCS#8 format private key conversion tool.
216
217 =item B<pkey>
218
219 Public and private key management.
220
221 =item B<pkeyparam>
222
223 Public key algorithm parameter management.
224
225 =item B<pkeyutl>
226
227 Public key algorithm cryptographic operation utility.
228
229 =item B<prime>
230
231 Compute prime numbers.
232
233 =item B<provider>
234
235 Load and query providers.
236
237 =item B<rand>
238
239 Generate pseudo-random bytes.
240
241 =item B<rehash>
242
243 Create symbolic links to certificate and CRL files named by the hash values.
244
245 =item B<req>
246
247 PKCS#10 X.509 Certificate Signing Request (CSR) Management.
248
249 =item B<rsa>
250
251 RSA key management.
252
253 =item B<rsautl>
254
255 RSA utility for signing, verification, encryption, and decryption. Superseded
256 by  L<openssl-pkeyutl(1)>.
257
258 =item B<s_client>
259
260 This implements a generic SSL/TLS client which can establish a transparent
261 connection to a remote server speaking SSL/TLS. It's intended for testing
262 purposes only and provides only rudimentary interface functionality but
263 internally uses mostly all functionality of the OpenSSL B<ssl> library.
264
265 =item B<s_server>
266
267 This implements a generic SSL/TLS server which accepts connections from remote
268 clients speaking SSL/TLS. It's intended for testing purposes only and provides
269 only rudimentary interface functionality but internally uses mostly all
270 functionality of the OpenSSL B<ssl> library.  It provides both an own command
271 line oriented protocol for testing SSL functions and a simple HTTP response
272 facility to emulate an SSL/TLS-aware webserver.
273
274 =item B<s_time>
275
276 SSL Connection Timer.
277
278 =item B<sess_id>
279
280 SSL Session Data Management.
281
282 =item B<smime>
283
284 S/MIME mail processing.
285
286 =item B<speed>
287
288 Algorithm Speed Measurement.
289
290 =item B<spkac>
291
292 SPKAC printing and generating utility.
293
294 =item B<srp>
295
296 Maintain SRP password file.
297
298 =item B<storeutl>
299
300 Utility to list and display certificates, keys, CRLs, etc.
301
302 =item B<ts>
303
304 Time Stamping Authority tool (client/server).
305
306 =item B<verify>
307
308 X.509 Certificate Verification.
309
310 =item B<version>
311
312 OpenSSL Version Information.
313
314 =item B<x509>
315
316 X.509 Certificate Data Management.
317
318 =back
319
320 =head2 Message Digest Commands
321
322 =over 4
323
324 =item B<blake2b512>
325
326 BLAKE2b-512 Digest
327
328 =item B<blake2s256>
329
330 BLAKE2s-256 Digest
331
332 =item B<md2>
333
334 MD2 Digest
335
336 =item B<md4>
337
338 MD4 Digest
339
340 =item B<md5>
341
342 MD5 Digest
343
344 =item B<mdc2>
345
346 MDC2 Digest
347
348 =item B<rmd160>
349
350 RMD-160 Digest
351
352 =item B<sha1>
353
354 SHA-1 Digest
355
356 =item B<sha224>
357
358 SHA-2 224 Digest
359
360 =item B<sha256>
361
362 SHA-2 256 Digest
363
364 =item B<sha384>
365
366 SHA-2 384 Digest
367
368 =item B<sha512>
369
370 SHA-2 512 Digest
371
372 =item B<sha3-224>
373
374 SHA-3 224 Digest
375
376 =item B<sha3-256>
377
378 SHA-3 256 Digest
379
380 =item B<sha3-384>
381
382 SHA-3 384 Digest
383
384 =item B<sha3-512>
385
386 SHA-3 512 Digest
387
388 =item B<shake128>
389
390 SHA-3 SHAKE128 Digest
391
392 =item B<shake256>
393
394 SHA-3 SHAKE256 Digest
395
396 =item B<sm3>
397
398 SM3 Digest
399
400 =back
401
402 =head2 Encryption, Decryption, and Encoding Commands
403
404 The following aliases provide convenient access to the most used encodings
405 and ciphers.
406
407 Depending on how OpenSSL was configured and built, not all ciphers listed
408 here may be present. See L<openssl-enc(1)> for more information.
409
410 =over 4
411
412 =item B<aes128>, B<aes-128-cbc>, B<aes-128-cfb>, B<aes-128-ctr>, B<aes-128-ecb>, B<aes-128-ofb>
413
414 AES-128 Cipher
415
416 =item B<aes192>, B<aes-192-cbc>, B<aes-192-cfb>, B<aes-192-ctr>, B<aes-192-ecb>, B<aes-192-ofb>
417
418 AES-192 Cipher
419
420 =item B<aes256>, B<aes-256-cbc>, B<aes-256-cfb>, B<aes-256-ctr>, B<aes-256-ecb>, B<aes-256-ofb>
421
422 AES-256 Cipher
423
424 =item B<aria128>, B<aria-128-cbc>, B<aria-128-cfb>, B<aria-128-ctr>, B<aria-128-ecb>, B<aria-128-ofb>
425
426 Aria-128 Cipher
427
428 =item B<aria192>, B<aria-192-cbc>, B<aria-192-cfb>, B<aria-192-ctr>, B<aria-192-ecb>, B<aria-192-ofb>
429
430 Aria-192 Cipher
431
432 =item B<aria256>, B<aria-256-cbc>, B<aria-256-cfb>, B<aria-256-ctr>, B<aria-256-ecb>, B<aria-256-ofb>
433
434 Aria-256 Cipher
435
436 =item B<base64>
437
438 Base64 Encoding
439
440 =item B<bf>, B<bf-cbc>, B<bf-cfb>, B<bf-ecb>, B<bf-ofb>
441
442 Blowfish Cipher
443
444 =item B<camellia128>, B<camellia-128-cbc>, B<camellia-128-cfb>, B<camellia-128-ctr>, B<camellia-128-ecb>, B<camellia-128-ofb>
445
446 Camellia-128 Cipher
447
448 =item B<camellia192>, B<camellia-192-cbc>, B<camellia-192-cfb>, B<camellia-192-ctr>, B<camellia-192-ecb>, B<camellia-192-ofb>
449
450 Camellia-192 Cipher
451
452 =item B<camellia256>, B<camellia-256-cbc>, B<camellia-256-cfb>, B<camellia-256-ctr>, B<camellia-256-ecb>, B<camellia-256-ofb>
453
454 Camellia-256 Cipher
455
456 =item B<cast>, B<cast-cbc>
457
458 CAST Cipher
459
460 =item B<cast5-cbc>, B<cast5-cfb>, B<cast5-ecb>, B<cast5-ofb>
461
462 CAST5 Cipher
463
464 =item B<chacha20>
465
466 Chacha20 Cipher
467
468 =item B<des>, B<des-cbc>, B<des-cfb>, B<des-ecb>, B<des-ede>, B<des-ede-cbc>, B<des-ede-cfb>, B<des-ede-ofb>, B<des-ofb>
469
470 DES Cipher
471
472 =item B<des3>, B<desx>, B<des-ede3>, B<des-ede3-cbc>, B<des-ede3-cfb>, B<des-ede3-ofb>
473
474 Triple-DES Cipher
475
476 =item B<idea>, B<idea-cbc>, B<idea-cfb>, B<idea-ecb>, B<idea-ofb>
477
478 IDEA Cipher
479
480 =item B<rc2>, B<rc2-cbc>, B<rc2-cfb>, B<rc2-ecb>, B<rc2-ofb>
481
482 RC2 Cipher
483
484 =item B<rc4>
485
486 RC4 Cipher
487
488 =item B<rc5>, B<rc5-cbc>, B<rc5-cfb>, B<rc5-ecb>, B<rc5-ofb>
489
490 RC5 Cipher
491
492 =item B<seed>, B<seed-cbc>, B<seed-cfb>, B<seed-ecb>, B<seed-ofb>
493
494 SEED Cipher
495
496 =item B<sm4>, B<sm4-cbc>, B<sm4-cfb>, B<sm4-ctr>, B<sm4-ecb>, B<sm4-ofb>
497
498 SM4 Cipher
499
500 =back
501
502 =head1 OPTIONS
503
504 Details of which options are available depend on the specific command.
505 This section describes some common options with common behavior.
506
507 =head2 Common Options
508
509 =over 4
510
511 =item B<-help>
512
513 Provides a terse summary of all options.
514 If an option takes an argument, the "type" of argument is also given.
515
516 =item B<-->
517
518 This terminates the list of options. It is mostly useful if any filename
519 parameters start with a minus sign:
520
521  openssl verify [flags...] -- -cert1.pem...
522
523 =back
524
525 =head2 Format Options
526
527 Several OpenSSL commands can take input or generate output in a variety
528 of formats. The list of acceptable formats, and the default, is
529 described in each command documentation.  The list of formats is
530 described below. Both uppercase and lowercase are accepted.
531
532 =over 4
533
534 =item B<DER>
535
536 A binary format, encoded or parsed according to Distinguished Encoding Rules
537 (DER) of the ASN.1 data language.
538
539 =item B<ENGINE>
540
541 Used to specify that the cryptographic material is in an OpenSSL B<engine>.
542 An engine must be configured or specified using the B<-engine> option.
543 In addition, the B<-input> flag can be used to name a specific object in
544 the engine.
545 A password, such as the B<-passin> flag often must be specified as well.
546
547 =item B<P12>
548
549 A DER-encoded file containing a PKCS#12 object.
550 It might be necessary to provide a decryption password to retrieve
551 the private key.
552
553 =item B<PEM>
554
555 A text format defined in IETF RFC 1421 and IETF RFC 7468. Briefly, this is
556 a block of base-64 encoding (defined in IETF RFC 4648), with specific
557 lines used to mark the start and end:
558
559  Text before the BEGIN line is ignored.
560  ----- BEGIN object-type -----
561  OT43gQKBgQC/2OHZoko6iRlNOAQ/tMVFNq7fL81GivoQ9F1U0Qr+DH3ZfaH8eIkX
562  xT0ToMPJUzWAn8pZv0snA0um6SIgvkCuxO84OkANCVbttzXImIsL7pFzfcwV/ERK
563  UM6j0ZuSMFOCr/lGPAoOQU0fskidGEHi1/kW+suSr28TqsyYZpwBDQ==
564  ----- END object-type -----
565  Text after the END line is also ignored
566
567 The I<object-type> must match the type of object that is expected.
568 For example a C<BEGIN X509 CERTIFICATE> will not match if the command
569 is trying to read a private key. The types supported include:
570
571  ANY PRIVATE KEY
572  CERTIFICATE
573  CERTIFICATE REQUEST
574  CMS
575  DH PARAMETERS
576  DSA PARAMETERS
577  DSA PUBLIC KEY
578  EC PARAMETERS
579  EC PRIVATE KEY
580  ECDSA PUBLIC KEY
581  ENCRYPTED PRIVATE KEY
582  PARAMETERS
583  PKCS #7 SIGNED DATA
584  PKCS7
585  PRIVATE KEY
586  PUBLIC KEY
587  RSA PRIVATE KEY
588  SSL SESSION PARAMETERS
589  TRUSTED CERTIFICATE
590  X509 CRL
591  X9.42 DH PARAMETERS
592
593 The following legacy I<object-type>'s are also supported for compatibility
594 with earlier releases:
595
596  DSA PRIVATE KEY
597  NEW CERTIFICATE REQUEST
598  RSA PUBLIC KEY
599  X509 CERTIFICATE
600
601 =item B<SMIME>
602
603 An S/MIME object as described in IETF RFC 8551.
604 Earlier versions were known as CMS and are compatible.
605 Note that the parsing is simple and might fail to parse some legal data.
606
607 =back
608
609 The options to specify the format are as follows. Refer to the individual
610 manpage to see which options are accepted.
611
612 =over 4
613
614 =item B<-inform> I<format>, B<-outform> I<format>
615
616 The format of the input or output streams.
617
618 =item B<-keyform> I<format>
619
620 Format of a private key input source.
621
622 =item B<-CRLform> I<format>
623
624 Format of a CRL input source.
625
626 =back
627
628 =head2 Pass Phrase Options
629
630 Several commands accept password arguments, typically using B<-passin>
631 and B<-passout> for input and output passwords respectively. These allow
632 the password to be obtained from a variety of sources. Both of these
633 options take a single argument whose format is described below. If no
634 password argument is given and a password is required then the user is
635 prompted to enter one: this will typically be read from the current
636 terminal with echoing turned off.
637
638 Note that character encoding may be relevant, please see
639 L<passphrase-encoding(7)>.
640
641 =over 4
642
643 =item B<pass:>I<password>
644
645 The actual password is I<password>. Since the password is visible
646 to utilities (like 'ps' under Unix) this form should only be used
647 where security is not important.
648
649 =item B<env:>I<var>
650
651 Obtain the password from the environment variable I<var>. Since
652 the environment of other processes is visible on certain platforms
653 (e.g. ps under certain Unix OSes) this option should be used with caution.
654
655 =item B<file:>I<pathname>
656
657 The first line of I<pathname> is the password. If the same I<pathname>
658 argument is supplied to B<-passin> and B<-passout> arguments then the first
659 line will be used for the input password and the next line for the output
660 password. I<pathname> need not refer to a regular file: it could for example
661 refer to a device or named pipe.
662
663 =item B<fd:>I<number>
664
665 Read the password from the file descriptor I<number>. This can be used to
666 send the data via a pipe for example.
667
668 =item B<stdin>
669
670 Read the password from standard input.
671
672 =back
673
674 =head2 Trusted Certificate Options
675
676 Part of validating a certificate includes verifying that the chain of CA's
677 can be traced up to an existing trusted root.  The following options specify
678 how to list the trusted roots, also known as trust anchors.  A collection
679 of trusted roots is called a I<trust store>.
680
681 Note that OpenSSL does not provide a default set of trust anchors.  Many
682 Linux distributions include a system default and configure OpenSSL to point
683 to that.  Mozilla maintains an influential trust store that can be found at
684 L<https://www.mozilla.org/en-US/about/governance/policies/security-group/certs/>.
685
686 =over 4
687
688 =item B<-CAfile> I<file>
689
690 Load the specified file which contains one or more PEM-format certificates
691 of CA's that are trusted.
692
693 =item B<-no-CAfile>
694
695 Do not load the default file of trusted certificates.
696
697 =item B<-CApath> I<dir>
698
699 Use the specified directory as a list of trust certificates. That is,
700 files should be named with the hash of the X.509 SubjectName of each
701 certificate. This is so that the library can extract the IssuerName,
702 hash it, and directly lookup the file to get the issuer certificate.
703 See L<openssl-rehash(1)> for information on creating this type of directory.
704
705 =item B<-no-CApath>
706
707 Do not use the default directory of trusted certificates.
708
709 =item B<-CAstore> I<uri>
710
711 Use I<uri> as a store of trusted CA certificates.  The URI may
712 indicate a single certificate, as well as a collection of them.
713 With URIs in the C<file:> scheme, this acts as B<-CAfile> or
714 B<-CApath>, depending on if the URI indicates a single file or
715 directory.
716 See L<ossl_store-file(7)> for more information on the C<file:> scheme.
717
718 These certificates are also used when building the server certificate
719 chain (for example with L<openssl-s_server(1)>) or client certificate
720 chain (for example with L<openssl-s_time(1)>).
721
722 =item B<-no-CAstore>
723
724 Do not use the default store.
725
726 =back
727
728 =head2 Random State Options
729
730 Prior to OpenSSL 3.0, it was common for applications to store information
731 about the state of the random-number generator in a file that was loaded
732 at startup and rewritten upon exit. On modern operating systems, this is
733 generally no longer necessary as OpenSSL will seed itself from the
734 appropriate CPU flags, device files, and so on. These flags are still
735 supported for special platforms or circumstances that might require them.
736
737 It is generally an error to use the same seed file more than once and
738 every use of B<-rand> should be paired with B<-writerand>.
739
740 =over 4
741
742 =item B<-rand> I<files>
743
744 A file or files containing random data used to seed the random number
745 generator.
746 Multiple files can be specified separated by an OS-dependent character.
747 The separator is C<;> for MS-Windows, C<,> for OpenVMS, and C<:> for
748 all others. Another way to specify multiple files is to repeat this flag
749 with different filenames.
750
751 =item B<-writerand> I<file>
752
753 Writes the seed data to the specified I<file> upon exit.
754 This file can be used in a subsequent command invocation.
755
756 =back
757
758 =head2 Extended Verification Options
759
760 Sometimes there may be more than one certificate chain leading to an
761 end-entity certificate.
762 This usually happens when a root or intermediate CA signs a certificate
763 for another a CA in other organization.
764 Another reason is when a CA might have intermediates that use two different
765 signature formats, such as a SHA-1 and a SHA-256 digest.
766
767 The following options can be used to provide data that will allow the
768 OpenSSL command to generate an alternative chain.
769
770 =over 4
771
772 =item B<-xchain_build>
773
774 Specify whether the application should build the certificate chain to be
775 provided to the server for the extra certificates via the B<-xkey>,
776 B<-xcert>, and B<-xchain> options.
777
778 =item B<-xkey> I<infile>, B<-xcert> I<infile>, B<-xchain>
779
780 Specify an extra certificate, private key and certificate chain. These behave
781 in the same manner as the B<-cert>, B<-key> and B<-cert_chain> options.  When
782 specified, the callback returning the first valid chain will be in use by the
783 client.
784
785 =item B<-xcertform> B<DER>|B<PEM>, B<-xkeyform> B<DER>|B<PEM>
786
787 The input format for the extra certificate and key, respectively.
788 See L<openssl(1)/Format Options> for details.
789
790 =item B<-xchain_build>
791
792 Specify whether the application should build the certificate chain to be
793 provided to the server for the extra certificates via the B<-xkey>,
794 B<-xcert>, and B<-xchain> options.
795
796 =item B<-xcertform> B<DER>|B<PEM>, B<-xkeyform> B<DER>|B<PEM>
797
798 The input format for the extra certifcate and key, respectively.
799 See L<openssl(1)/Format Options> for details.
800
801 =back
802
803 =head2 Verification Options
804
805 Many OpenSSL commands verify certificates. The details of how each
806 command handles errors are documented on the specific command page.
807
808 Verification is a complicated process, consisting of a number of separate
809 steps that are detailed in the following paragraphs.
810
811 First, a certificate chain is built up starting from the supplied certificate
812 and ending in a root CA.  It is an error if the whole chain cannot be
813 built up.  The chain is built up by looking up the certificate that
814 signed (or issued) the certificate. It then repeats the process, until
815 it gets to a certificate that is self-issued.
816
817 The process of looking up the issuer's certificate itself involves a number
818 of steps.  After all certificates whose subject name matches the issuer
819 name of the current certificate are subject to further tests.  The relevant
820 authority key identifier components of the current certificate (if present)
821 must match the subject key identifier (if present) and issuer and serial
822 number of the candidate issuer, in addition the keyUsage extension of the
823 candidate issuer (if present) must permit certificate signing.
824
825 The lookup first looks in the list of untrusted certificates and if no match
826 is found the remaining lookups are from the trusted certificates. The root CA
827 is always looked up in the trusted certificate list: if the certificate to
828 verify is a root certificate then an exact match must be found in the trusted
829 list.
830
831 The second step is to check every untrusted certificate's extensions
832 for consistency with the supplied purpose. If the B<-purpose> option is
833 not included then no checks are done. The supplied or "leaf" certificate
834 must have extensions compatible with the supplied purpose and all other
835 certificates must also be valid CA certificates. The precise extensions
836 required are described in more detail in
837 L<openssl-x509(1)/CERTIFICATE EXTENSIONS>.
838
839 The third step is to check the trust settings on the root CA. The root
840 CA should be trusted for the supplied purpose.  For compatibility with
841 previous versions of OpenSSL, a certificate with no trust settings is
842 considered to be valid for all purposes.
843
844 The fourth, and final, step is to check the validity of the certificate
845 chain. The validity period is checked against the system time
846 and the C<notBefore> and C<notAfter> dates in the certificate. The certificate
847 signatures are also checked at this point. The B<-attime> flag may be
848 used to specify a time other than "now."
849
850 If all operations complete successfully then certificate is considered
851 valid. If any operation fails then the certificate is not valid.
852
853 The details of the processing steps can be fine-tuned with the
854 following flags.
855
856 =over 4
857
858 =item B<-verbose>
859
860 Print extra information about the operations being performed.
861
862 =item B<-attime> I<timestamp>
863
864 Perform validation checks using time specified by I<timestamp> and not
865 current system time. I<timestamp> is the number of seconds since
866 January 1, 1970 (i.e., the Unix Epoch).
867
868 =item B<-no_check_time>
869
870 This option suppresses checking the validity period of certificates and CRLs
871 against the current time. If option B<-attime> is used to specify
872 a verification time, the check is not suppressed.
873
874 =item B<-x509_strict>
875
876 This disables non-compliant workarounds for broken certificates.
877
878 =item B<-ignore_critical>
879
880 Normally if an unhandled critical extension is present which is not
881 supported by OpenSSL the certificate is rejected (as required by RFC5280).
882 If this option is set critical extensions are ignored.
883
884 =item B<-issuer_checks>
885
886 Ignored.
887
888 =item B<-crl_check>
889
890 Checks end entity certificate validity by attempting to look up a valid CRL.
891 If a valid CRL cannot be found an error occurs.
892
893 =item B<-crl_check_all>
894
895 Checks the validity of B<all> certificates in the chain by attempting
896 to look up valid CRLs.
897
898 =item B<-use_deltas>
899
900 Enable support for delta CRLs.
901
902 =item B<-extended_crl>
903
904 Enable extended CRL features such as indirect CRLs and alternate CRL
905 signing keys.
906
907 =item B<-suiteB_128_only>, B<-suiteB_128>, B<-suiteB_192>
908
909 Enable the Suite B mode operation at 128 bit Level of Security, 128 bit or
910 192 bit, or only 192 bit Level of Security respectively.
911 See RFC6460 for details. In particular the supported signature algorithms are
912 reduced to support only ECDSA and SHA256 or SHA384 and only the elliptic curves
913 P-256 and P-384.
914
915 =item B<-auth_level> I<level>
916
917 Set the certificate chain authentication security level to I<level>.
918 The authentication security level determines the acceptable signature and
919 public key strength when verifying certificate chains.  For a certificate
920 chain to validate, the public keys of all the certificates must meet the
921 specified security I<level>.  The signature algorithm security level is
922 enforced for all the certificates in the chain except for the chain's
923 I<trust anchor>, which is either directly trusted or validated by means
924 other than its signature.  See L<SSL_CTX_set_security_level(3)> for the
925 definitions of the available levels.  The default security level is -1,
926 or "not set".  At security level 0 or lower all algorithms are acceptable.
927 Security level 1 requires at least 80-bit-equivalent security and is broadly
928 interoperable, though it will, for example, reject MD5 signatures or RSA
929 keys shorter than 1024 bits.
930
931 =item B<-partial_chain>
932
933 Allow verification to succeed even if a I<complete> chain cannot be built to a
934 self-signed trust-anchor, provided it is possible to construct a chain to a
935 trusted certificate that might not be self-signed.
936
937 =item B<-check_ss_sig>
938
939 Verify the signature on the self-signed root CA. This is disabled by default
940 because it doesn't add any security.
941
942 =item B<-allow_proxy_certs>
943
944 Allow the verification of proxy certificates.
945
946 =item B<-trusted_first>
947
948 As of OpenSSL 1.1.0 this option is on by default and cannot be disabled.
949
950 =item B<-no_alt_chains>
951
952 As of OpenSSL 1.1.0, since B<-trusted_first> always on, this option has no
953 effect.
954
955 =item B<-trusted> I<file>
956
957 Parse I<file> as a set of one or more certificates in PEM format.
958 All certificates must be self-signed, unless the
959 B<-partial_chain> option is specified.
960 This option implies the B<-no-CAfile> and B<-no-CApath> options and it
961 cannot be used with either the B<-CAfile> or B<-CApath> options, so
962 only certificates in the file are trust anchors.
963 This option may be used multiple times.
964
965 =item B<-untrusted> I<file>
966
967 Parse I<file> as a set of one or more certificates in PEM format.
968 All certificates are untrusted certificates that may be used to
969 construct a certificate chain from the subject certificate to a trust anchor.
970 This option may be used multiple times.
971
972 =item B<-policy> I<arg>
973
974 Enable policy processing and add I<arg> to the user-initial-policy-set (see
975 RFC5280). The policy I<arg> can be an object name an OID in numeric form.
976 This argument can appear more than once.
977
978 =item B<-explicit_policy>
979
980 Set policy variable require-explicit-policy (see RFC5280).
981
982 =item B<-policy_check>
983
984 Enables certificate policy processing.
985
986 =item B<-policy_print>
987
988 Print out diagnostics related to policy processing.
989
990 =item B<-inhibit_any>
991
992 Set policy variable inhibit-any-policy (see RFC5280).
993
994 =item B<-inhibit_map>
995
996 Set policy variable inhibit-policy-mapping (see RFC5280).
997
998 =item B<-purpose> I<purpose>
999
1000 The intended use for the certificate. If this option is not specified, this
1001 command will not consider certificate purpose during chain verification.
1002 Currently accepted uses are B<sslclient>, B<sslserver>, B<nssslserver>,
1003 B<smimesign>, B<smimeencrypt>.
1004
1005 =item B<-verify_depth> I<num>
1006
1007 Limit the certificate chain to I<num> intermediate CA certificates.
1008 A maximal depth chain can have up to I<num>+2 certificates, since neither the
1009 end-entity certificate nor the trust-anchor certificate count against the
1010 B<-verify_depth> limit.
1011
1012 =item B<-verify_email> I<email>
1013
1014 Verify if I<email> matches the email address in Subject Alternative Name or
1015 the email in the subject Distinguished Name.
1016
1017 =item B<-verify_hostname> I<hostname>
1018
1019 Verify if I<hostname> matches DNS name in Subject Alternative Name or
1020 Common Name in the subject certificate.
1021
1022 =item B<-verify_ip> I<ip>
1023
1024 Verify if I<ip> matches the IP address in Subject Alternative Name of
1025 the subject certificate.
1026
1027 =item B<-verify_name> I<name>
1028
1029 Use default verification policies like trust model and required certificate
1030 policies identified by I<name>.
1031 The trust model determines which auxiliary trust or reject OIDs are applicable
1032 to verifying the given certificate chain.
1033 See the B<-addtrust> and B<-addreject> options for L<openssl-x509(1)>.
1034 Supported policy names include: B<default>, B<pkcs7>, B<smime_sign>,
1035 B<ssl_client>, B<ssl_server>.
1036 These mimics the combinations of purpose and trust settings used in SSL, CMS
1037 and S/MIME.
1038 As of OpenSSL 1.1.0, the trust model is inferred from the purpose when not
1039 specified, so the B<-verify_name> options are functionally equivalent to the
1040 corresponding B<-purpose> settings.
1041
1042 =back
1043
1044 =head2 Name Format Options
1045
1046 OpenSSL provides fine-grain control over how the subject and issuer DN's are
1047 displayed.
1048 This is specified by using the B<-nameopt> option, which takes a
1049 comma-separated list of options from the following set.
1050 An option may be preceeded by a minus sign, C<->, to turn it off.
1051 The default value is C<oneline>.
1052 The first four are the most commonly used.
1053
1054 =over 4
1055
1056 =item B<compat>
1057
1058 Display the name using an old format from previous OpenSSL versions.
1059
1060 =item B<RFC2253>
1061
1062 Display the name using the format defined in RFC 2253.
1063 It is equivalent to B<esc_2253>, B<esc_ctrl>, B<esc_msb>, B<utf8>,
1064 B<dump_nostr>, B<dump_unknown>, B<dump_der>, B<sep_comma_plus>, B<dn_rev>
1065 and B<sname>.
1066
1067 =item B<oneline>
1068
1069 Display the name in one line, using a format that is more readable
1070 RFC 2253.
1071 It is equivalent to B<esc_2253>, B<esc_ctrl>, B<esc_msb>, B<utf8>,
1072 B<dump_nostr>, B<dump_der>, B<use_quote>, B<sep_comma_plus_space>,
1073 B<space_eq> and B<sname> options.
1074
1075 =item B<multiline>
1076
1077 Display the name using multiple lines.
1078 It is equivalent to B<esc_ctrl>, B<esc_msb>, B<sep_multiline>, B<space_eq>,
1079 B<lname> and B<align>.
1080
1081 =item B<esc_2253>
1082
1083 Escape the "special" characters in a field, as required by RFC 2253.
1084 That is, any of the characters C<,+"E<lt>E<gt>;>, C<#> at the beginning of
1085 a string and leading or trailing spaces.
1086
1087 =item B<esc_2254>
1088
1089 Escape the "special" characters in a field as required by RFC 2254 in a field.
1090 That is, the B<NUL> character and and of C<()*>.
1091
1092 =item B<esc_ctrl>
1093
1094 Escape non-printable ASCII characters, codes less than 0x20 (space)
1095 or greater than 0x7F (DELETE). They are displayed using RFC 2253 C<\XX>
1096 notation where B<XX> are the two hex digits representing the character value.
1097
1098 =item B<esc_msb>
1099
1100 Escape any characters with the most significant bit set, that is with
1101 values larger than 127, as described in B<esc_ctrl>.
1102
1103 =item B<use_quote>
1104
1105 Escapes some characters by surrounding the entire string with quotation
1106 marks, C<">.
1107 Without this option, individual special characters are preceeded with
1108 a backslash character, C<\>.
1109
1110 =item B<utf8>
1111
1112 Convert all strings to UTF-8 format first as required by RFC 2253.
1113 If the output device is UTF-8 compatible, then using this option (and
1114 not setting B<esc_msb>) may give the correct display of multibyte
1115 characters.
1116 If this option is not set, then multibyte characters larger than 0xFF
1117 will be output as C<\UXXXX> for 16 bits or C<\WXXXXXXXX> for 32 bits.
1118 In addition, any UTF8Strings will be converted to their character form first.
1119
1120 =item B<ignore_type>
1121
1122 This option does not attempt to interpret multibyte characters in any
1123 way. That is, the content octets are merely dumped as though one octet
1124 represents each character. This is useful for diagnostic purposes but
1125 will result in rather odd looking output.
1126
1127 =item B<show_type>
1128
1129 Display the type of the ASN1 character string before the value,
1130 such as C<BMPSTRING: Hello World>.
1131
1132 =item B<dump_der>
1133
1134 Any fields that would be output in hex format are displayed using
1135 the DER encoding of the field.
1136 If not set, just the content octets are displayed.
1137 Either way, the B<#XXXX...> format of RFC 2253 is used.
1138
1139 =item B<dump_nostr>
1140
1141 Dump non-character strings, such as ASN.1 B<OCTET STRING>.
1142 If this option is not set, then non character string types will be displayed
1143 as though each content octet represents a single character.
1144
1145 =item B<dump_all>
1146
1147 Dump all fields. When this used with B<dump_der>, this allows the
1148 DER encoding of the structure to be unambiguously determined.
1149
1150 =item B<dump_unknown>
1151
1152 Dump any field whose OID is not recognised by OpenSSL.
1153
1154 =item B<sep_comma_plus>, B<sep_comma_plus_space>, B<sep_semi_plus_space>,
1155 B<sep_multiline>
1156
1157 Specify the field separators. The first word is used between the
1158 Relative Distinguished Names (RDNs) and the second is between
1159 multiple Attribute Value Assertions (AVAs). Multiple AVAs are
1160 very rare and their use is discouraged.
1161 The options ending in "space" additionally place a space after the separator to make it more readable.
1162 The B<sep_multiline> starts each field on its own line, and uses "plus space"
1163 for the AVA separator.
1164 It also indents the fields by four characters.
1165 The default value is B<sep_comma_plus_space>.
1166
1167 =item B<dn_rev>
1168
1169 Reverse the fields of the DN as required by RFC 2253.
1170 This also reverses the order of multiple AVAs in a field, but this is
1171 permissible as there is no ordering on values.
1172
1173 =item B<nofname>, B<sname>, B<lname>, B<oid>
1174
1175 Specify how the field name is displayed.
1176 B<nofname> does not display the field at all.
1177 B<sname> uses the "short name" form (CN for commonName for example).
1178 B<lname> uses the long form.
1179 B<oid> represents the OID in numerical form and is useful for
1180 diagnostic purpose.
1181
1182 =item B<align>
1183
1184 Align field values for a more readable output. Only usable with
1185 B<sep_multiline>.
1186
1187 =item B<space_eq>
1188
1189 Places spaces round the equal sign, C<=>, character which follows the field
1190 name.
1191
1192 =back
1193
1194 =head2 TLS Version Options
1195
1196 Several commands use SSL, TLS, or DTLS. By default, the commands use TLS and
1197 clients will offer the lowest and highest protocol version they support,
1198 and servers will pick the highest version that the client offers that is also
1199 supported by the server.
1200
1201 The options below can be used to limit which protocol versions are used,
1202 and whether TCP (SSL and TLS) or UDP (DTLS) is used.
1203 Note that not all protocols and flags may be available, depending on how
1204 OpenSSL was built.
1205
1206 =over 4
1207
1208 =item B<-ssl3>, B<-tls1>, B<-tls1_1>, B<-tls1_2>, B<-tls1_3>, B<-no_ssl3>, B<-no_tls1>, B<-no_tls1_1>, B<-no_tls1_2>, B<-no_tls1_3>
1209
1210 These options require or disable the use of the specified SSL or TLS protocols.
1211 When a specific TLS version is required, only that version will be offered or
1212 accepted.
1213 Only one specific protocol can be given and it cannot be combined with any of
1214 the B<no_> options.
1215
1216 =item B<-dtls>, B<-dtls1>, B<-dtls1_2>
1217
1218 These options specify to use DTLS instead of DLTS.
1219 With B<-dtls>, clients will negotiate any supported DTLS protocol version.
1220 Use the B<-dtls1> or B<-dtls1_2> options to support only DTLS1.0 or DTLS1.2,
1221 respectively.
1222
1223 =back
1224
1225 =head2 Engine Options
1226
1227 =over 4
1228
1229 =item B<-engine> I<id>
1230
1231 Use the engine identified by I<id> and use all the methods it
1232 implements (algorithms, key storage, etc.), unless specified otherwise in
1233 the command-specific documentation or it is configured to do so, as described
1234 in L<config(5)/Engine Configuration Module>.
1235
1236 =back
1237
1238 =head1 ENVIRONMENT
1239
1240 The OpenSSL library can be take some configuration parameters from the
1241 environment.  Some of these variables are listed below.  For information
1242 about specific commands, see L<openssl-engine(1)>, L<openssl-provider(1)>,
1243 L<openssl-rehash(1)>, and L<tsget(1)>.
1244
1245 For information about the use of environment variables in configuration,
1246 see L<config(5)/ENVIRONMENT>.
1247
1248 For information about querying or specifying CPU architecture flags, see
1249 L<OPENSSL_ia32cap(3)>, and L<OPENSSL_s390xcap(3)>.
1250
1251 For information about all environment variables used by the OpenSSL libraries,
1252 see L<openssl-env(7)>.
1253
1254 =over 4
1255
1256 =item B<OPENSSL_TRACE=>I<name>[,...]
1257
1258 Enable tracing output of OpenSSL library, by name.
1259 This output will only make sense if you know OpenSSL internals well.
1260 Also, it might not give you any output at all, depending on how
1261 OpenSSL was built.
1262
1263 The value is a comma separated list of names, with the following
1264 available:
1265
1266 =over 4
1267
1268 =item B<TRACE>
1269
1270 The tracing functionality.
1271
1272 =item B<TLS>
1273
1274 General SSL/TLS.
1275
1276 =item B<TLS_CIPHER>
1277
1278 SSL/TLS cipher.
1279
1280 =item B<ENGINE_CONF>
1281
1282 ENGINE configuration.
1283
1284 =item B<ENGINE_TABLE>
1285
1286 The function that is used by RSA, DSA (etc) code to select registered
1287 ENGINEs, cache defaults and functional references (etc), will generate
1288 debugging summaries.
1289
1290 =item B<ENGINE_REF_COUNT>
1291
1292 Reference counts in the ENGINE structure will be monitored with a line
1293 of generated for each change.
1294
1295 =item B<PKCS5V2>
1296
1297 PKCS#5 v2 keygen.
1298
1299 =item B<PKCS12_KEYGEN>
1300
1301 PKCS#12 key generation.
1302
1303 =item B<PKCS12_DECRYPT>
1304
1305 PKCS#12 decryption.
1306
1307 =item B<X509V3_POLICY>
1308
1309 Generates the complete policy tree at various point during X.509 v3
1310 policy evaluation.
1311
1312 =item B<BN_CTX>
1313
1314 BIGNUM context.
1315
1316 =back
1317
1318 =back
1319
1320 =head1 SEE ALSO
1321
1322 L<openssl-asn1parse(1)>,
1323 L<openssl-ca(1)>,
1324 L<openssl-ciphers(1)>,
1325 L<openssl-cms(1)>,
1326 L<openssl-crl(1)>,
1327 L<openssl-crl2pkcs7(1)>,
1328 L<openssl-dgst(1)>,
1329 L<openssl-dhparam(1)>,
1330 L<openssl-dsa(1)>,
1331 L<openssl-dsaparam(1)>,
1332 L<openssl-ec(1)>,
1333 L<openssl-ecparam(1)>,
1334 L<openssl-enc(1)>,
1335 L<openssl-engine(1)>,
1336 L<openssl-errstr(1)>,
1337 L<openssl-gendsa(1)>,
1338 L<openssl-genpkey(1)>,
1339 L<openssl-genrsa(1)>,
1340 L<openssl-kdf(1)>,
1341 L<openssl-mac(1)>,
1342 L<openssl-nseq(1)>,
1343 L<openssl-ocsp(1)>,
1344 L<openssl-passwd(1)>,
1345 L<openssl-pkcs12(1)>,
1346 L<openssl-pkcs7(1)>,
1347 L<openssl-pkcs8(1)>,
1348 L<openssl-pkey(1)>,
1349 L<openssl-pkeyparam(1)>,
1350 L<openssl-pkeyutl(1)>,
1351 L<openssl-prime(1)>,
1352 L<openssl-rand(1)>,
1353 L<openssl-rehash(1)>,
1354 L<openssl-req(1)>,
1355 L<openssl-rsa(1)>,
1356 L<openssl-rsautl(1)>,
1357 L<openssl-s_client(1)>,
1358 L<openssl-s_server(1)>,
1359 L<openssl-s_time(1)>,
1360 L<openssl-sess_id(1)>,
1361 L<openssl-smime(1)>,
1362 L<openssl-speed(1)>,
1363 L<openssl-spkac(1)>,
1364 L<openssl-srp(1)>,
1365 L<openssl-storeutl(1)>,
1366 L<openssl-ts(1)>,
1367 L<openssl-verify(1)>,
1368 L<openssl-version(1)>,
1369 L<openssl-x509(1)>,
1370 L<config(5)>,
1371 L<crypto(7)>,
1372 L<openssl-env(7)>.
1373 L<ssl(7)>,
1374 L<x509v3_config(5)>
1375
1376
1377 =head1 HISTORY
1378
1379 The B<list> -I<XXX>B<-algorithms> options were added in OpenSSL 1.0.0;
1380 For notes on the availability of other commands, see their individual
1381 manual pages.
1382
1383 The B<-issuer_checks> option is deprecated as of OpenSSL 1.1.0 and
1384 is silently ignored.
1385
1386 =head1 COPYRIGHT
1387
1388 Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
1389
1390 Licensed under the Apache License 2.0 (the "License").  You may not use
1391 this file except in compliance with the License.  You can obtain a copy
1392 in the file LICENSE in the source distribution or at
1393 L<https://www.openssl.org/source/license.html>.
1394
1395 =cut