5 openssl - OpenSSL command line tool
11 [ I<command_opts> ... ]
12 [ I<command_args> ... ]
16 B<-standard-commands> |
19 B<-cipher-algorithms> |
20 B<-digest-algorithms> |
22 B<-public-key-algorithms>
24 B<openssl> B<no->I<XXX> [ I<arbitrary options> ]
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.
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.
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
45 =head1 COMMAND SUMMARY
47 The B<openssl> program provides a rich variety of sub-commands (I<command> in
48 the SYNOPSIS above), each of which often has a wealth of options and arguments
49 (I<command_opts> and I<command_args> in the SYNOPSIS).
51 Detailed documentation and use cases for most standard subcommands are available
52 (e.g., L<x509(1)> or L<openssl-x509(1)>).
54 Many commands use an external configuration file for some or all of their
55 arguments and have a B<-config> option to specify that file.
56 The environment variable B<OPENSSL_CONF> can be used to specify
57 the location of the file.
58 If the environment variable is not specified, then the file is named
59 F<openssl.cnf> in the default certificate storage area, whose value
60 depends on the configuration flags specified when the OpenSSL
63 The list options B<-standard-commands>, B<-digest-commands>,
64 and B<-cipher-commands> output a list (one entry per line) of the names
65 of all standard commands, message digest commands, or cipher commands,
66 respectively, that are available.
68 The list parameters B<-cipher-algorithms>, B<-digest-algorithms>,
69 and B<-mac-algorithms> list all cipher, message digest, and message
70 authentication code names, one entry per line. Aliases are listed as:
74 The list parameter B<-public-key-algorithms> lists all supported public
77 The command B<no->I<XXX> tests whether a command of the
78 specified name is available. If no command named I<XXX> exists, it
79 returns 0 (success) and prints B<no->I<XXX>; otherwise it returns 1
80 and prints I<XXX>. In both cases, the output goes to B<stdout> and
81 nothing is printed to B<stderr>. Additional command line arguments
82 are always ignored. Since for each cipher there is a command of the
83 same name, this provides an easy way for shell scripts to test for the
84 availability of ciphers in the B<openssl> program. (B<no->I<XXX> is
85 not able to detect pseudo-commands such as B<quit>,
86 B<list>, or B<no->I<XXX> itself.)
88 =head2 Standard Sub-commands
94 Parse an ASN.1 sequence.
98 Certificate Authority (CA) Management.
102 Cipher Suite Description Determination.
106 CMS (Cryptographic Message Syntax) utility.
110 Certificate Revocation List (CRL) Management.
114 CRL to PKCS#7 Conversion.
118 Message Digest calculation. MAC calculations are superseded by
123 Diffie-Hellman Parameter Management.
124 Obsoleted by L<openssl-dhparam(1)>.
128 Generation and Management of Diffie-Hellman Parameters. Superseded by
129 L<openssl-genpkey(1)> and L<openssl-pkeyparam(1)>.
137 DSA Parameter Generation and Management. Superseded by
138 L<openssl-genpkey(1)> and L<openssl-pkeyparam(1)>.
142 EC (Elliptic curve) key processing.
146 EC parameter manipulation and generation.
150 Encoding with Ciphers.
154 Engine (loadable module) information and manipulation.
158 Error Number to Error String Conversion.
162 Generation of Diffie-Hellman Parameters.
163 Obsoleted by L<openssl-dhparam(1)>.
167 Generation of DSA Private Key from Parameters. Superseded by
168 L<openssl-genpkey(1)> and L<openssl-pkey(1)>.
172 Generation of Private Key or Parameters.
176 Generation of RSA Private Key. Superseded by L<openssl-genpkey(1)>.
180 Display diverse information built into the OpenSSL libraries.
184 Key Derivation Functions.
188 Message Authentication Code Calculation.
192 Create or examine a Netscape certificate sequence.
196 Online Certificate Status Protocol utility.
200 Generation of hashed passwords.
204 PKCS#12 Data Management.
208 PKCS#7 Data Management.
212 PKCS#8 format private key conversion tool.
216 Public and private key management.
220 Public key algorithm parameter management.
224 Public key algorithm cryptographic operation utility.
228 Compute prime numbers.
232 Generate pseudo-random bytes.
236 Create symbolic links to certificate and CRL files named by the hash values.
240 PKCS#10 X.509 Certificate Signing Request (CSR) Management.
248 RSA utility for signing, verification, encryption, and decryption. Superseded
249 by L<openssl-pkeyutl(1)>.
253 This implements a generic SSL/TLS client which can establish a transparent
254 connection to a remote server speaking SSL/TLS. It's intended for testing
255 purposes only and provides only rudimentary interface functionality but
256 internally uses mostly all functionality of the OpenSSL B<ssl> library.
260 This implements a generic SSL/TLS server which accepts connections from remote
261 clients speaking SSL/TLS. It's intended for testing purposes only and provides
262 only rudimentary interface functionality but internally uses mostly all
263 functionality of the OpenSSL B<ssl> library. It provides both an own command
264 line oriented protocol for testing SSL functions and a simple HTTP response
265 facility to emulate an SSL/TLS-aware webserver.
269 SSL Connection Timer.
273 SSL Session Data Management.
277 S/MIME mail processing.
281 Algorithm Speed Measurement.
285 SPKAC printing and generating utility.
289 Maintain SRP password file.
293 Utility to list and display certificates, keys, CRLs, etc.
297 Time Stamping Authority tool (client/server).
301 X.509 Certificate Verification.
305 OpenSSL Version Information.
309 X.509 Certificate Data Management.
313 =head2 Message Digest Commands
383 SHA-3 SHAKE128 Digest
387 SHA-3 SHAKE256 Digest
395 =head2 Encoding and Cipher Commands
397 The following aliases provide convenient access to the most used encodings
400 Depending on how OpenSSL was configured and built, not all ciphers listed
401 here may be present. See L<openssl-enc(1)> for more information and command
406 =item B<aes128>, B<aes-128-cbc>, B<aes-128-cfb>, B<aes-128-ctr>, B<aes-128-ecb>, B<aes-128-ofb>
410 =item B<aes192>, B<aes-192-cbc>, B<aes-192-cfb>, B<aes-192-ctr>, B<aes-192-ecb>, B<aes-192-ofb>
414 =item B<aes256>, B<aes-256-cbc>, B<aes-256-cfb>, B<aes-256-ctr>, B<aes-256-ecb>, B<aes-256-ofb>
418 =item B<aria128>, B<aria-128-cbc>, B<aria-128-cfb>, B<aria-128-ctr>, B<aria-128-ecb>, B<aria-128-ofb>
422 =item B<aria192>, B<aria-192-cbc>, B<aria-192-cfb>, B<aria-192-ctr>, B<aria-192-ecb>, B<aria-192-ofb>
426 =item B<aria256>, B<aria-256-cbc>, B<aria-256-cfb>, B<aria-256-ctr>, B<aria-256-ecb>, B<aria-256-ofb>
434 =item B<bf>, B<bf-cbc>, B<bf-cfb>, B<bf-ecb>, B<bf-ofb>
438 =item B<camellia128>, B<camellia-128-cbc>, B<camellia-128-cfb>, B<camellia-128-ctr>, B<camellia-128-ecb>, B<camellia-128-ofb>
442 =item B<camellia192>, B<camellia-192-cbc>, B<camellia-192-cfb>, B<camellia-192-ctr>, B<camellia-192-ecb>, B<camellia-192-ofb>
446 =item B<camellia256>, B<camellia-256-cbc>, B<camellia-256-cfb>, B<camellia-256-ctr>, B<camellia-256-ecb>, B<camellia-256-ofb>
450 =item B<cast>, B<cast-cbc>
454 =item B<cast5-cbc>, B<cast5-cfb>, B<cast5-ecb>, B<cast5-ofb>
462 =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>
466 =item B<des3>, B<desx>, B<des-ede3>, B<des-ede3-cbc>, B<des-ede3-cfb>, B<des-ede3-ofb>
470 =item B<idea>, B<idea-cbc>, B<idea-cfb>, B<idea-ecb>, B<idea-ofb>
474 =item B<rc2>, B<rc2-cbc>, B<rc2-cfb>, B<rc2-ecb>, B<rc2-ofb>
482 =item B<rc5>, B<rc5-cbc>, B<rc5-cfb>, B<rc5-ecb>, B<rc5-ofb>
486 =item B<seed>, B<seed-cbc>, B<seed-cfb>, B<seed-ecb>, B<seed-ofb>
490 =item B<sm4>, B<sm4-cbc>, B<sm4-cfb>, B<sm4-ctr>, B<sm4-ecb>, B<sm4-ofb>
498 Details of which options are available depend on the specific command.
499 This section describes some common options with common behavior.
501 =head2 Common Options
507 Provides a terse summary of all options.
508 If an option takes an argument, the "type" of argument is also given.
512 This terminates the list of options. It is mostly useful if any filename
513 parameters start with a minus sign:
515 openssl verify [flags...] -- -cert1.pem...
519 =head2 Format Options
521 Several OpenSSL commands can take input or generate output in a variety
522 of formats. The list of acceptable formats, and the default, is
523 described in each command documentation. The list of formats is
524 described below. Both uppercase and lowercase are accepted.
530 A binary format, encoded or parsed according to Distinguished Encoding Rules
531 (DER) of the ASN.1 data language.
535 Used to specify that the cryptographic material is in an OpenSSL B<engine>.
536 An engine must be configured or specified using the B<-engine> option.
537 In addition, the B<-input> flag can be used to name a specific object in
539 A password, such as the B<-passin> flag often must be specified as well.
543 A DER-encoded file containing a PKCS#12 object.
544 It might be necessary to provide a decryption password to retrieve
549 A text format defined in IETF RFC 1421 and IETF RFC 7468. Briefly, this is
550 a block of base-64 encoding (defined in IETF RFC 4648), with specific
551 lines used to mark the start and end:
553 Text before the BEGIN line is ignored.
554 ----- BEGIN object-type -----
555 OT43gQKBgQC/2OHZoko6iRlNOAQ/tMVFNq7fL81GivoQ9F1U0Qr+DH3ZfaH8eIkX
556 xT0ToMPJUzWAn8pZv0snA0um6SIgvkCuxO84OkANCVbttzXImIsL7pFzfcwV/ERK
557 UM6j0ZuSMFOCr/lGPAoOQU0fskidGEHi1/kW+suSr28TqsyYZpwBDQ==
558 ----- END object-type -----
559 Text after the END line is also ignored
561 The I<object-type> must match the type of object that is expected.
562 For example a C<BEGIN X509 CERTIFICATE> will not match if the command
563 is trying to read a private key. The types supported include:
575 ENCRYPTED PRIVATE KEY
582 SSL SESSION PARAMETERS
587 The following legacy I<object-type>'s are also supported for compatibility
588 with earlier releases:
591 NEW CERTIFICATE REQUEST
597 An S/MIME object as described in IETF RFC 8551.
598 Earlier versions were known as CMS and are compatible.
599 Note that the parsing is simple and might fail to parse some legal data.
603 The options to specify the format are as follows. Refer to the individual
604 manpage to see which options are accepted.
608 =item B<-inform> I<format>, B<-outform> I<format>
610 The format of the input or output streams.
612 =item B<-keyform> I<format>
614 Format of a private key input source.
616 =item B<-CRLform> I<fornat>
618 Format of a CRL input source.
622 =head2 Pass Phrase Options
624 Several commands accept password arguments, typically using B<-passin>
625 and B<-passout> for input and output passwords respectively. These allow
626 the password to be obtained from a variety of sources. Both of these
627 options take a single argument whose format is described below. If no
628 password argument is given and a password is required then the user is
629 prompted to enter one: this will typically be read from the current
630 terminal with echoing turned off.
632 Note that character encoding may be relevant, please see
633 L<passphrase-encoding(7)>.
637 =item B<pass:>I<password>
639 The actual password is I<password>. Since the password is visible
640 to utilities (like 'ps' under Unix) this form should only be used
641 where security is not important.
645 Obtain the password from the environment variable I<var>. Since
646 the environment of other processes is visible on certain platforms
647 (e.g. ps under certain Unix OSes) this option should be used with caution.
649 =item B<file:>I<pathname>
651 The first line of I<pathname> is the password. If the same I<pathname>
652 argument is supplied to B<-passin> and B<-passout> arguments then the first
653 line will be used for the input password and the next line for the output
654 password. I<pathname> need not refer to a regular file: it could for example
655 refer to a device or named pipe.
657 =item B<fd:>I<number>
659 Read the password from the file descriptor I<number>. This can be used to
660 send the data via a pipe for example.
664 Read the password from standard input.
668 =head2 Trusted Certificate Options
670 Part of validating a certificate includes verifying that the chain of CA's
671 can be traced up to an existing trusted root. The following options specify
672 how to list the trusted roots, also known as trust anchors. A collection
673 of trusted roots is called a I<trust store>.
675 Note that OpenSSL does not provide a default set of trust anchors. Many
676 Linux distributions include a system default and configure OpenSSL to point
677 to that. Mozilla maintains an influential trust store that can be found at
678 L<https://www.mozilla.org/en-US/about/governance/policies/security-group/certs/>.
682 =item B<-CAfile> I<file>
684 Load the specified file which contains one or more PEM-format certificates
685 of CA's that are trusted.
689 Do not load the default file of trusted certificates.
691 =item B<-CApath> I<dir>
693 Use the specified directory as a list of trust certificates. That is,
694 files should be named with the hash of the X.509 SubjectName of each
695 certificate. This is so that the library can extract the IssuerName,
696 hash it, and directly lookup the file to get the issuer certificate.
697 See L<openssl-rehash(1)> for information on creating this type of directory.
701 Do not use the default directory of trusted certificates.
705 =head2 Random State Options
707 Prior to OpenSSL 3.0, it was common for applications to store information
708 about the state of the random-number generator in a file that was loaded
709 at startup and rewritten upon exit. On modern operating systems, this is
710 generally no longer necessary as OpenSSL will seed itself from the
711 appropriate CPU flags, device files, and so on. These flags are still
712 supported for special platforms or circumstances that might require them.
714 It is generally an error to use the same seed file more than once and
715 every use of B<-rand> should be paired with B<-writerand>.
719 =item B<-rand> I<files>
721 A file or files containing random data used to seed the random number
723 Multiple files can be specified separated by an OS-dependent character.
724 The separator is C<;> for MS-Windows, C<,> for OpenVMS, and C<:> for
725 all others. Another way to specify multiple files is to repeat this flag
726 with different filenames.
728 =item B<-writerand> I<file>
730 Writes the seed data to the specified I<file> upon exit.
731 This file can be used in a subsequent command invocation.
739 =item B<OPENSSL_TRACE=>I<name>[,...]
741 Enable tracing output of OpenSSL library, by name.
742 This output will only make sense if you know OpenSSL internals well.
743 Also, it might not give you any output at all, depending on how
746 The value is a comma separated list of names, with the following
753 The tracing functionality.
765 ENGINE configuration.
767 =item B<ENGINE_TABLE>
769 The function that is used by RSA, DSA (etc) code to select registered
770 ENGINEs, cache defaults and functional references (etc), will generate
773 =item B<ENGINE_REF_COUNT>
775 Reference counts in the ENGINE structure will be monitored with a line
776 of generated for each change.
782 =item B<PKCS12_KEYGEN>
784 PKCS#12 key generation.
786 =item B<PKCS12_DECRYPT>
790 =item B<X509V3_POLICY>
792 Generates the complete policy tree at various point during X.509 v3
805 L<openssl-asn1parse(1)>,
807 L<openssl-ciphers(1)>,
810 L<openssl-crl2pkcs7(1)>,
812 L<openssl-dhparam(1)>,
814 L<openssl-dsaparam(1)>,
816 L<openssl-ecparam(1)>,
818 L<openssl-engine(1)>,
819 L<openssl-errstr(1)>,
820 L<openssl-gendsa(1)>,
821 L<openssl-genpkey(1)>,
822 L<openssl-genrsa(1)>,
827 L<openssl-passwd(1)>,
828 L<openssl-pkcs12(1)>,
832 L<openssl-pkeyparam(1)>,
833 L<openssl-pkeyutl(1)>,
836 L<openssl-rehash(1)>,
839 L<openssl-rsautl(1)>,
840 L<openssl-s_client(1)>,
841 L<openssl-s_server(1)>,
842 L<openssl-s_time(1)>,
843 L<openssl-sess_id(1)>,
848 L<openssl-storeutl(1)>,
850 L<openssl-verify(1)>,
851 L<openssl-version(1)>,
861 The B<list> -I<XXX>B<-algorithms> options were added in OpenSSL 1.0.0;
862 For notes on the availability of other commands, see their individual
867 Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
869 Licensed under the Apache License 2.0 (the "License"). You may not use
870 this file except in compliance with the License. You can obtain a copy
871 in the file LICENSE in the source distribution or at
872 L<https://www.openssl.org/source/license.html>.