1=pod 2 3=head1 NAME 4 5openssl - OpenSSL command line program 6 7=head1 SYNOPSIS 8 9B<openssl> 10I<command> 11[ I<options> ... ] 12[ I<parameters> ... ] 13 14B<openssl> 15B<list> 16B<standard-commands> | 17B<digest-commands> | 18B<cipher-commands> | 19B<cipher-algorithms> | 20B<digest-algorithms> | 21B<mac-algorithms> | 22B<public-key-algorithms> 23 24B<openssl> B<no->I<XXX> [ I<options> ] 25 26=head1 DESCRIPTION 27 28OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL 29v2/v3) and Transport Layer Security (TLS v1) network protocols and related 30cryptography standards required by them. 31 32The B<openssl> program is a command line program for using the various 33cryptography functions of OpenSSL's B<crypto> library from the shell. 34It 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 47The B<openssl> program provides a rich variety of commands (I<command> in 48the L</SYNOPSIS> above). 49Each command can have many options and argument parameters, shown above as 50I<options> and I<parameters>. 51 52Detailed documentation and use cases for most standard subcommands are available 53(e.g., L<openssl-x509(1)>). 54 55The list options B<-standard-commands>, B<-digest-commands>, 56and B<-cipher-commands> output a list (one entry per line) of the names 57of all standard commands, message digest commands, or cipher commands, 58respectively, that are available. 59 60The list parameters B<-cipher-algorithms>, B<-digest-algorithms>, 61and B<-mac-algorithms> list all cipher, message digest, and message 62authentication code names, one entry per line. Aliases are listed as: 63 64 from => to 65 66The list parameter B<-public-key-algorithms> lists all supported public 67key algorithms. 68 69The command B<no->I<XXX> tests whether a command of the 70specified name is available. If no command named I<XXX> exists, it 71returns 0 (success) and prints B<no->I<XXX>; otherwise it returns 1 72and prints I<XXX>. In both cases, the output goes to B<stdout> and 73nothing is printed to B<stderr>. Additional command line arguments 74are always ignored. Since for each cipher there is a command of the 75same name, this provides an easy way for shell scripts to test for the 76availability of ciphers in the B<openssl> program. (B<no->I<XXX> is 77not able to detect pseudo-commands such as B<quit>, 78B<list>, or B<no->I<XXX> itself.) 79 80=head2 Configuration Option 81 82Many commands use an external configuration file for some or all of their 83arguments and have a B<-config> option to specify that file. 84The default name of the file is F<openssl.cnf> in the default certificate 85storage area, which can be determined from the L<openssl-version(1)> 86command using the B<-d> or B<-a> option. 87The environment variable B<OPENSSL_CONF> can be used to specify a different 88file location or to disable loading a configuration (using the empty string). 89 90Among others, the configuration file can be used to load modules 91and to specify parameters for generating certificates and random numbers. 92See L<config(5)> for details. 93 94=head2 Standard Commands 95 96=over 4 97 98=item B<asn1parse> 99 100Parse an ASN.1 sequence. 101 102=item B<ca> 103 104Certificate Authority (CA) Management. 105 106=item B<ciphers> 107 108Cipher Suite Description Determination. 109 110=item B<cms> 111 112CMS (Cryptographic Message Syntax) command. 113 114=item B<crl> 115 116Certificate Revocation List (CRL) Management. 117 118=item B<crl2pkcs7> 119 120CRL to PKCS#7 Conversion. 121 122=item B<dgst> 123 124Message Digest calculation. MAC calculations are superseded by 125L<openssl-mac(1)>. 126 127=item B<dhparam> 128 129Generation and Management of Diffie-Hellman Parameters. Superseded by 130L<openssl-genpkey(1)> and L<openssl-pkeyparam(1)>. 131 132=item B<dsa> 133 134DSA Data Management. 135 136=item B<dsaparam> 137 138DSA Parameter Generation and Management. Superseded by 139L<openssl-genpkey(1)> and L<openssl-pkeyparam(1)>. 140 141=item B<ec> 142 143EC (Elliptic curve) key processing. 144 145=item B<ecparam> 146 147EC parameter manipulation and generation. 148 149=item B<enc> 150 151Encryption, decryption, and encoding. 152 153=item B<engine> 154 155Engine (loadable module) information and manipulation. 156 157=item B<errstr> 158 159Error Number to Error String Conversion. 160 161=item B<fipsinstall> 162 163FIPS configuration installation. 164 165=item B<gendsa> 166 167Generation of DSA Private Key from Parameters. Superseded by 168L<openssl-genpkey(1)> and L<openssl-pkey(1)>. 169 170=item B<genpkey> 171 172Generation of Private Key or Parameters. 173 174=item B<genrsa> 175 176Generation of RSA Private Key. Superseded by L<openssl-genpkey(1)>. 177 178=item B<help> 179 180Display information about a command's options. 181 182=item B<info> 183 184Display diverse information built into the OpenSSL libraries. 185 186=item B<kdf> 187 188Key Derivation Functions. 189 190=item B<list> 191 192List algorithms and features. 193 194=item B<mac> 195 196Message Authentication Code Calculation. 197 198=item B<nseq> 199 200Create or examine a Netscape certificate sequence. 201 202=item B<ocsp> 203 204Online Certificate Status Protocol command. 205 206=item B<passwd> 207 208Generation of hashed passwords. 209 210=item B<pkcs12> 211 212PKCS#12 Data Management. 213 214=item B<pkcs7> 215 216PKCS#7 Data Management. 217 218=item B<pkcs8> 219 220PKCS#8 format private key conversion command. 221 222=item B<pkey> 223 224Public and private key management. 225 226=item B<pkeyparam> 227 228Public key algorithm parameter management. 229 230=item B<pkeyutl> 231 232Public key algorithm cryptographic operation command. 233 234=item B<prime> 235 236Compute prime numbers. 237 238=item B<rand> 239 240Generate pseudo-random bytes. 241 242=item B<rehash> 243 244Create symbolic links to certificate and CRL files named by the hash values. 245 246=item B<req> 247 248PKCS#10 X.509 Certificate Signing Request (CSR) Management. 249 250=item B<rsa> 251 252RSA key management. 253 254=item B<rsautl> 255 256RSA command for signing, verification, encryption, and decryption. Superseded 257by L<openssl-pkeyutl(1)>. 258 259=item B<s_client> 260 261This implements a generic SSL/TLS client which can establish a transparent 262connection to a remote server speaking SSL/TLS. It's intended for testing 263purposes only and provides only rudimentary interface functionality but 264internally uses mostly all functionality of the OpenSSL B<ssl> library. 265 266=item B<s_server> 267 268This implements a generic SSL/TLS server which accepts connections from remote 269clients speaking SSL/TLS. It's intended for testing purposes only and provides 270only rudimentary interface functionality but internally uses mostly all 271functionality of the OpenSSL B<ssl> library. It provides both an own command 272line oriented protocol for testing SSL functions and a simple HTTP response 273facility to emulate an SSL/TLS-aware webserver. 274 275=item B<s_time> 276 277SSL Connection Timer. 278 279=item B<sess_id> 280 281SSL Session Data Management. 282 283=item B<smime> 284 285S/MIME mail processing. 286 287=item B<speed> 288 289Algorithm Speed Measurement. 290 291=item B<spkac> 292 293SPKAC printing and generating command. 294 295=item B<srp> 296 297Maintain SRP password file. This command is deprecated. 298 299=item B<storeutl> 300 301Command to list and display certificates, keys, CRLs, etc. 302 303=item B<ts> 304 305Time Stamping Authority command. 306 307=item B<verify> 308 309X.509 Certificate Verification. 310See also the L<openssl-verification-options(1)> manual page. 311 312=item B<version> 313 314OpenSSL Version Information. 315 316=item B<x509> 317 318X.509 Certificate Data Management. 319 320=back 321 322=head2 Message Digest Commands 323 324=over 4 325 326=item B<blake2b512> 327 328BLAKE2b-512 Digest 329 330=item B<blake2s256> 331 332BLAKE2s-256 Digest 333 334=item B<md2> 335 336MD2 Digest 337 338=item B<md4> 339 340MD4 Digest 341 342=item B<md5> 343 344MD5 Digest 345 346=item B<mdc2> 347 348MDC2 Digest 349 350=item B<rmd160> 351 352RMD-160 Digest 353 354=item B<sha1> 355 356SHA-1 Digest 357 358=item B<sha224> 359 360SHA-2 224 Digest 361 362=item B<sha256> 363 364SHA-2 256 Digest 365 366=item B<sha384> 367 368SHA-2 384 Digest 369 370=item B<sha512> 371 372SHA-2 512 Digest 373 374=item B<sha3-224> 375 376SHA-3 224 Digest 377 378=item B<sha3-256> 379 380SHA-3 256 Digest 381 382=item B<sha3-384> 383 384SHA-3 384 Digest 385 386=item B<sha3-512> 387 388SHA-3 512 Digest 389 390=item B<keccak-224> 391 392KECCAK 224 Digest 393 394=item B<keccak-256> 395 396KECCAK 256 Digest 397 398=item B<keccak-384> 399 400KECCAK 384 Digest 401 402=item B<keccak-512> 403 404KECCAK 512 Digest 405 406=item B<shake128> 407 408SHA-3 SHAKE128 Digest 409 410=item B<shake256> 411 412SHA-3 SHAKE256 Digest 413 414=item B<sm3> 415 416SM3 Digest 417 418=back 419 420=head2 Encryption, Decryption, and Encoding Commands 421 422The following aliases provide convenient access to the most used encodings 423and ciphers. 424 425Depending on how OpenSSL was configured and built, not all ciphers listed 426here may be present. See L<openssl-enc(1)> for more information. 427 428=over 4 429 430=item B<aes128>, B<aes-128-cbc>, B<aes-128-cfb>, B<aes-128-ctr>, B<aes-128-ecb>, B<aes-128-ofb> 431 432AES-128 Cipher 433 434=item B<aes192>, B<aes-192-cbc>, B<aes-192-cfb>, B<aes-192-ctr>, B<aes-192-ecb>, B<aes-192-ofb> 435 436AES-192 Cipher 437 438=item B<aes256>, B<aes-256-cbc>, B<aes-256-cfb>, B<aes-256-ctr>, B<aes-256-ecb>, B<aes-256-ofb> 439 440AES-256 Cipher 441 442=item B<aria128>, B<aria-128-cbc>, B<aria-128-cfb>, B<aria-128-ctr>, B<aria-128-ecb>, B<aria-128-ofb> 443 444Aria-128 Cipher 445 446=item B<aria192>, B<aria-192-cbc>, B<aria-192-cfb>, B<aria-192-ctr>, B<aria-192-ecb>, B<aria-192-ofb> 447 448Aria-192 Cipher 449 450=item B<aria256>, B<aria-256-cbc>, B<aria-256-cfb>, B<aria-256-ctr>, B<aria-256-ecb>, B<aria-256-ofb> 451 452Aria-256 Cipher 453 454=item B<base64> 455 456Base64 Encoding 457 458=item B<bf>, B<bf-cbc>, B<bf-cfb>, B<bf-ecb>, B<bf-ofb> 459 460Blowfish Cipher 461 462=item B<camellia128>, B<camellia-128-cbc>, B<camellia-128-cfb>, B<camellia-128-ctr>, B<camellia-128-ecb>, B<camellia-128-ofb> 463 464Camellia-128 Cipher 465 466=item B<camellia192>, B<camellia-192-cbc>, B<camellia-192-cfb>, B<camellia-192-ctr>, B<camellia-192-ecb>, B<camellia-192-ofb> 467 468Camellia-192 Cipher 469 470=item B<camellia256>, B<camellia-256-cbc>, B<camellia-256-cfb>, B<camellia-256-ctr>, B<camellia-256-ecb>, B<camellia-256-ofb> 471 472Camellia-256 Cipher 473 474=item B<cast>, B<cast-cbc> 475 476CAST Cipher 477 478=item B<cast5-cbc>, B<cast5-cfb>, B<cast5-ecb>, B<cast5-ofb> 479 480CAST5 Cipher 481 482=item B<chacha20> 483 484Chacha20 Cipher 485 486=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> 487 488DES Cipher 489 490=item B<des3>, B<desx>, B<des-ede3>, B<des-ede3-cbc>, B<des-ede3-cfb>, B<des-ede3-ofb> 491 492Triple-DES Cipher 493 494=item B<idea>, B<idea-cbc>, B<idea-cfb>, B<idea-ecb>, B<idea-ofb> 495 496IDEA Cipher 497 498=item B<rc2>, B<rc2-cbc>, B<rc2-cfb>, B<rc2-ecb>, B<rc2-ofb> 499 500RC2 Cipher 501 502=item B<rc4> 503 504RC4 Cipher 505 506=item B<rc5>, B<rc5-cbc>, B<rc5-cfb>, B<rc5-ecb>, B<rc5-ofb> 507 508RC5 Cipher 509 510=item B<seed>, B<seed-cbc>, B<seed-cfb>, B<seed-ecb>, B<seed-ofb> 511 512SEED Cipher 513 514=item B<sm4>, B<sm4-cbc>, B<sm4-cfb>, B<sm4-ctr>, B<sm4-ecb>, B<sm4-ofb> 515 516SM4 Cipher 517 518=back 519 520=head1 OPTIONS 521 522Details of which options are available depend on the specific command. 523This section describes some common options with common behavior. 524 525=head2 Common Options 526 527=over 4 528 529=item B<-help> 530 531Provides a terse summary of all options. 532If an option takes an argument, the "type" of argument is also given. 533 534=item B<--> 535 536This terminates the list of options. It is mostly useful if any filename 537parameters start with a minus sign: 538 539 openssl verify [flags...] -- -cert1.pem... 540 541=back 542 543=head2 Format Options 544 545See L<openssl-format-options(1)> for manual page. 546 547=head2 Pass Phrase Options 548 549See the L<openssl-passphrase-options(1)> manual page. 550 551=head2 Random State Options 552 553Prior to OpenSSL 1.1.1, it was common for applications to store information 554about the state of the random-number generator in a file that was loaded 555at startup and rewritten upon exit. On modern operating systems, this is 556generally no longer necessary as OpenSSL will seed itself from a trusted 557entropy source provided by the operating system. These flags are still 558supported for special platforms or circumstances that might require them. 559 560It is generally an error to use the same seed file more than once and 561every use of B<-rand> should be paired with B<-writerand>. 562 563=over 4 564 565=item B<-rand> I<files> 566 567A file or files containing random data used to seed the random number 568generator. 569Multiple files can be specified separated by an OS-dependent character. 570The separator is C<;> for MS-Windows, C<,> for OpenVMS, and C<:> for 571all others. Another way to specify multiple files is to repeat this flag 572with different filenames. 573 574=item B<-writerand> I<file> 575 576Writes the seed data to the specified I<file> upon exit. 577This file can be used in a subsequent command invocation. 578 579=back 580 581=head2 Certificate Verification Options 582 583See the L<openssl-verification-options(1)> manual page. 584 585=head2 Name Format Options 586 587See the L<openssl-namedisplay-options(1)> manual page. 588 589=head2 TLS Version Options 590 591Several commands use SSL, TLS, or DTLS. By default, the commands use TLS and 592clients will offer the lowest and highest protocol version they support, 593and servers will pick the highest version that the client offers that is also 594supported by the server. 595 596The options below can be used to limit which protocol versions are used, 597and whether TCP (SSL and TLS) or UDP (DTLS) is used. 598Note that not all protocols and flags may be available, depending on how 599OpenSSL was built. 600 601=over 4 602 603=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> 604 605These options require or disable the use of the specified SSL or TLS protocols. 606When a specific TLS version is required, only that version will be offered or 607accepted. 608Only one specific protocol can be given and it cannot be combined with any of 609the B<no_> options. 610 611=item B<-dtls>, B<-dtls1>, B<-dtls1_2> 612 613These options specify to use DTLS instead of DLTS. 614With B<-dtls>, clients will negotiate any supported DTLS protocol version. 615Use the B<-dtls1> or B<-dtls1_2> options to support only DTLS1.0 or DTLS1.2, 616respectively. 617 618=back 619 620=head2 Engine Options 621 622=over 4 623 624=item B<-engine> I<id> 625 626Load the engine identified by I<id> and use all the methods it implements 627(algorithms, key storage, etc.), unless specified otherwise in the 628command-specific documentation or it is configured to do so, as described in 629L<config(5)/Engine Configuration>. 630 631The engine will be used for key ids specified with B<-key> and similar 632options when an option like B<-keyform engine> is given. 633 634A special case is the C<loader_attic> engine, which 635is meant just for internal OpenSSL testing purposes and 636supports loading keys, parameters, certificates, and CRLs from files. 637When this engine is used, files with such credentials are read via this engine. 638Using the C<file:> schema is optional; a plain file (path) name will do. 639 640=back 641 642Options specifying keys, like B<-key> and similar, can use the generic 643OpenSSL engine key loading URI scheme C<org.openssl.engine:> to retrieve 644private keys and public keys. The URI syntax is as follows, in simplified 645form: 646 647 org.openssl.engine:{engineid}:{keyid} 648 649Where C<{engineid}> is the identity/name of the engine, and C<{keyid}> is a 650key identifier that's acceptable by that engine. For example, when using an 651engine that interfaces against a PKCS#11 implementation, the generic key URI 652would be something like this (this happens to be an example for the PKCS#11 653engine that's part of OpenSC): 654 655 -key org.openssl.engine:pkcs11:label_some-private-key 656 657As a third possibility, for engines and providers that have implemented 658their own L<OSSL_STORE_LOADER(3)>, C<org.openssl.engine:> should not be 659necessary. For a PKCS#11 implementation that has implemented such a loader, 660the PKCS#11 URI as defined in RFC 7512 should be possible to use directly: 661 662 -key pkcs11:object=some-private-key;pin-value=1234 663 664=head2 Provider Options 665 666=over 4 667 668=item B<-provider> I<name> 669 670Load and initialize the provider identified by I<name>. The I<name> 671can be also a path to the provider module. In that case the provider name 672will be the specified path and not just the provider module name. 673Interpretation of relative paths is platform specific. The configured 674"MODULESDIR" path, B<OPENSSL_MODULES> environment variable, or the path 675specified by B<-provider-path> is prepended to relative paths. 676See L<provider(7)> for a more detailed description. 677 678=item B<-provider-path> I<path> 679 680Specifies the search path that is to be used for looking for providers. 681Equivalently, the B<OPENSSL_MODULES> environment variable may be set. 682 683=item B<-propquery> I<propq> 684 685Specifies the I<property query clause> to be used when fetching algorithms 686from the loaded providers. 687See L<property(7)> for a more detailed description. 688 689=back 690 691=head1 ENVIRONMENT 692 693The OpenSSL library can be take some configuration parameters from the 694environment. Some of these variables are listed below. For information 695about specific commands, see L<openssl-engine(1)>, 696L<openssl-rehash(1)>, and L<tsget(1)>. 697 698For information about the use of environment variables in configuration, 699see L<config(5)/ENVIRONMENT>. 700 701For information about querying or specifying CPU architecture flags, see 702L<OPENSSL_ia32cap(3)>, and L<OPENSSL_s390xcap(3)>. 703 704For information about all environment variables used by the OpenSSL libraries, 705see L<openssl-env(7)>. 706 707=over 4 708 709=item B<OPENSSL_TRACE=>I<name>[,...] 710 711Enable tracing output of OpenSSL library, by name. 712This output will only make sense if you know OpenSSL internals well. 713Also, it might not give you any output at all, depending on how 714OpenSSL was built. 715 716The value is a comma separated list of names, with the following 717available: 718 719=over 4 720 721=item B<TRACE> 722 723The tracing functionality. 724 725=item B<TLS> 726 727General SSL/TLS. 728 729=item B<TLS_CIPHER> 730 731SSL/TLS cipher. 732 733=item B<CONF> 734 735Show details about provider and engine configuration. 736 737=item B<ENGINE_TABLE> 738 739The function that is used by RSA, DSA (etc) code to select registered 740ENGINEs, cache defaults and functional references (etc), will generate 741debugging summaries. 742 743=item B<ENGINE_REF_COUNT> 744 745Reference counts in the ENGINE structure will be monitored with a line 746of generated for each change. 747 748=item B<PKCS5V2> 749 750PKCS#5 v2 keygen. 751 752=item B<PKCS12_KEYGEN> 753 754PKCS#12 key generation. 755 756=item B<PKCS12_DECRYPT> 757 758PKCS#12 decryption. 759 760=item B<X509V3_POLICY> 761 762Generates the complete policy tree at various point during X.509 v3 763policy evaluation. 764 765=item B<BN_CTX> 766 767BIGNUM context. 768 769=back 770 771=back 772 773=head1 SEE ALSO 774 775L<openssl-asn1parse(1)>, 776L<openssl-ca(1)>, 777L<openssl-ciphers(1)>, 778L<openssl-cms(1)>, 779L<openssl-crl(1)>, 780L<openssl-crl2pkcs7(1)>, 781L<openssl-dgst(1)>, 782L<openssl-dhparam(1)>, 783L<openssl-dsa(1)>, 784L<openssl-dsaparam(1)>, 785L<openssl-ec(1)>, 786L<openssl-ecparam(1)>, 787L<openssl-enc(1)>, 788L<openssl-engine(1)>, 789L<openssl-errstr(1)>, 790L<openssl-gendsa(1)>, 791L<openssl-genpkey(1)>, 792L<openssl-genrsa(1)>, 793L<openssl-kdf(1)>, 794L<openssl-mac(1)>, 795L<openssl-nseq(1)>, 796L<openssl-ocsp(1)>, 797L<openssl-passwd(1)>, 798L<openssl-pkcs12(1)>, 799L<openssl-pkcs7(1)>, 800L<openssl-pkcs8(1)>, 801L<openssl-pkey(1)>, 802L<openssl-pkeyparam(1)>, 803L<openssl-pkeyutl(1)>, 804L<openssl-prime(1)>, 805L<openssl-rand(1)>, 806L<openssl-rehash(1)>, 807L<openssl-req(1)>, 808L<openssl-rsa(1)>, 809L<openssl-rsautl(1)>, 810L<openssl-s_client(1)>, 811L<openssl-s_server(1)>, 812L<openssl-s_time(1)>, 813L<openssl-sess_id(1)>, 814L<openssl-smime(1)>, 815L<openssl-speed(1)>, 816L<openssl-spkac(1)>, 817L<openssl-srp(1)>, 818L<openssl-storeutl(1)>, 819L<openssl-ts(1)>, 820L<openssl-verify(1)>, 821L<openssl-version(1)>, 822L<openssl-x509(1)>, 823L<config(5)>, 824L<crypto(7)>, 825L<openssl-env(7)>. 826L<ssl(7)>, 827L<x509v3_config(5)> 828 829 830=head1 HISTORY 831 832The B<list> -I<XXX>B<-algorithms> options were added in OpenSSL 1.0.0; 833For notes on the availability of other commands, see their individual 834manual pages. 835 836The B<-issuer_checks> option is deprecated as of OpenSSL 1.1.0 and 837is silently ignored. 838 839The B<-xcertform> and B<-xkeyform> options 840are obsolete since OpenSSL 3.0 and have no effect. 841 842The interactive mode, which could be invoked by running C<openssl> 843with no further arguments, was removed in OpenSSL 3.0, and running 844that program with no arguments is now equivalent to C<openssl help>. 845 846=head1 COPYRIGHT 847 848Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. 849 850Licensed under the Apache License 2.0 (the "License"). You may not use 851this file except in compliance with the License. You can obtain a copy 852in the file LICENSE in the source distribution or at 853L<https://www.openssl.org/source/license.html>. 854 855=cut 856