openssl - OpenSSL command line tool

As of 6/4/12 on Mac OS X OpenSSL 0.9.8r 8 Feb 2011
As of 01/11/21 on Mac OS OpenSSH_8.1p1, LibreSSL 2.7.3
added commands:
certhash
dhparam
ec
ecparam
genpkey
nseq
pks8
pkey
pkeyparm
pkeyutil
prime
spkac
ts

openssl command [ command_opts ] [ command_args ]

openssl [ list-standard-commands | list-message-digest-commands | list-cipher-commands ]

openssl no-command

Cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them. Uses various cryptography functions crypto library to:

Enters command mode prompting with OPENSSL> if no options are give.

The pseudo-command no-command tests if a command is available returns 0 (success, i.e. "Yes, no command like that is available") and prints no-command; otherwise it returns 1 and prints command.

Since for each cipher there is a command of the same name, this provides an easy way for shell scripts to test for the availability of ciphers.
(no-command is not able to detect pseudo-commands such as quit, list-…-commands .)

> openssl no-speed
speed
> echo $?
1
> openssl no-x509
x509
> openssl no-x508
no-x508
> echo $?
0

Standard commands

asn1parse Parse an ASN.1 sequence.
ca Certificate Authority (CA) Management.
ciphers Cipher Suite Description Determination.
crl Certificate Revocation List (CRL) Management.
crl2pkcs7 CRL to PKCS#7 Conversion.
dgst Message Digest Calculation.
dh Diffie-Hellman Parameter Management. Obsoleted by dhparam.
dsa DSA Data Management.
dsaparam DSA Parameter Generation.
enc Encoding with Ciphers.
errstr Error Number to Error String Conversion.
dhparam Generation and Management of Diffie-Hellman Parameters.
gendh Generation of Diffie-Hellman Parameters. Obsoleted by dhparam.
gendsa Generation of DSA Parameters.
genrsa Generation of RSA Parameters.
ocsp Online Certificate Status Protocol utility.
passwd Generation of hashed passwords.
pkcs12 PKCS#12 Data Management.
pkcs7 PKCS#7 Data Management.
rand Generate pseudo-random bytes.
req X.509 Certificate Signing Request (CSR) Management.
rsa RSA Data Management.
rsautl RSA utility for signing, verification, encryption, and decryption.
s_client generic SSL/TLS client which can establish a transparent connection to a remote server speaking SSL/TLS. It's intended for testing purposes only and provides only rudimentary interface functionality but internally uses mostly all functionality of the OpenSSL ssl library.
s_server generic SSL/TLS server which accepts connections from remote clients speaking SSL/TLS. It's intended for testing purposes only and provides only rudimentary interface functionality but internally uses mostly all functionality of the OpenSSL ssl library. It provides both an own command line oriented protocol for testing SSL functions and a simple HTTP response facility to emulate an SSL/TLS-aware webserver.
s_time SSL Connection Timer.
sess_id SSL Session Data Management.
smime S/MIME mail processing.
speed Algorithm Speed Measurement. sample output
runs many tests for 3 seconds.
version on mac book pro , mac os big sur LibreSSL 2.8.3
old OpenSSL Version Information. (6/4/12 on Mac OS X OpenSSL 0.9.8r 8 Feb 2011)
verify X.509 Certificate Verification.
x509 X.509 Certificate Data Management.

Message digest commands

ghost-mac md4 md_gost94 ripemd160 whirpool
md2 md5 mdc2 rmd160 sha sha1 sha224 sha256 sha384 sha512

Encoding and cipher commands

See the enc command for more details
aes-128-cbc      aes-128-ecb       aes-192-cbc       aes-192-ecb       aes-256-cbc       aes-256-ecb       
base64           bf                bf-cbc            bf-cfb            bf-ecb            bf-ofb            
camellia-128-cbc camellia-128-ecb  camellia-192-cbc  camellia-192-ecb  camellia-256-cbc  camellia-256-ecb  
cast             cast-cbc          cast5-cbc         cast5-cfb         cast5-ecb         cast5-ofb         
chacha
des              des-cbc           des-cfb           des-ecb           des-ede           des-ede-cbc       des-ede-cfb       
des-ede-ofb      des-ede3          des-ede3-cbc      des-ede3-cfb      des-ede3-ofb      des-ofb           des3
desx
rc2              rc2-40-cbc        rc2-64-cbc        rc2-cbc           rc2-cfb           rc2-ecb           rc2-ofb
rc4              rc4-40            

Pass Phrase arguments


-passin and -passout are used for input and output passwords . allowing the password to be obtained from a variety of sources. a single argument .

If a password is required but not provided the user is prompted to enter one, typically from the terminal without echoing

pass:password the actual password is password. Since the password is visible to utilities (like ps ) this form should be avoided.
env:var obtain the password from the environment variable var. Since the environment of other processes is visible on certain platforms (e.g. ps ) this option should be used with caution.
file:pathname the first line of pathname is the password.
If the same pathname argument is supplied to -passin and -passout the first line will be used for the input password and the next line for the output password.

pathname may refer to a device or named pipe.

fd:n read the password from the file descriptor n, used to send the data via a pipe
stdin

Generate MD5 checksum example:
> openssl dgst kav_rescue_10.iso
MD5(kav_rescue_10.iso)= b40962e90183fcbcba89f4183c833405

See Also

asn1parse, ca, config, , crl2pkcs7, dgst, dhparam, dsa, dsaparam, enc, gendsa, genrsa, nseq, openssl, passwd, pkcs12, pkcs7, pkcs8, rand, req, rsa, rsautl, s_client, s_server, s_time, smime, spkac, verify, version, x509, crypto(3), ssl(3)

Message Digest commands

(see the `dgst' command for more details) md2 md4 md5 rmd160 sha sha1