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