openssl s_client -connect <host>:<port>Opens a TLS connection and prints the certificate chain and negotiated parameters.
Example
openssl s_client -connect example.com:443The ubiquitous toolkit for TLS and general cryptography: inspect certificates, generate keys and CSRs, convert formats, hash, encrypt and create random secrets.
sudo apt install opensslopenssl s_client -connect <host>:<port>Opens a TLS connection and prints the certificate chain and negotiated parameters.
Example
openssl s_client -connect example.com:443openssl s_client -connect <host>:443 -servername <host> </dev/null 2>/dev/null | openssl x509 -noout -textFetches and fully decodes a server certificate, SNI included.
Example
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -textopenssl x509 -in <file> -noout -textDecodes a certificate file to human-readable form.
Example
openssl x509 -in cert.pem -noout -textopenssl x509 -in <file> -noout -datesJust the validity dates — handy for expiry checks.
Example
openssl x509 -in cert.pem -noout -datesopenssl x509 -in <file> -noout -fingerprint -sha256The SHA-256 fingerprint of a certificate.
openssl genrsa -out <file> <bits>Generates an RSA private key.
Example
openssl genrsa -out key.pem 4096openssl ecparam -genkey -name prime256v1 -out <file>Generates an elliptic-curve private key.
Example
openssl ecparam -genkey -name prime256v1 -out ec-key.pemopenssl req -new -key <key> -out <csr>Creates a certificate signing request.
Example
openssl req -new -key key.pem -out req.csropenssl req -x509 -newkey rsa:4096 -keyout <key> -out <cert> -days <n> -nodesCreates a self-signed certificate and key in one step.
Example
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodesopenssl rsa -in <key> -noout -checkValidates an RSA private key.
Example
openssl rsa -in key.pem -noout -checkopenssl pkcs12 -export -out <p12> -inkey <key> -in <cert>Bundles a key and certificate into a PKCS#12 file.
Example
openssl pkcs12 -export -out bundle.p12 -inkey key.pem -in cert.pemopenssl pkcs12 -in <p12> -nodes -out <pem>Extracts a key and certificate from a .p12.
Example
openssl pkcs12 -in bundle.p12 -nodes -out all.pemopenssl x509 -in <der> -inform der -out <pem> -outform pemConverts DER to PEM.
Example
openssl x509 -in cert.der -inform der -out cert.pem -outform pemopenssl dgst -sha256 <file>SHA-256 digest of a file.
Example
openssl dgst -sha256 payload.binopenssl rand -base64 <n>Generates cryptographically random bytes — a quick password or token.
Example
openssl rand -base64 24openssl rand -hex <n>Random bytes as hex.
Example
openssl rand -hex 16openssl enc -aes-256-cbc -salt -pbkdf2 -in <in> -out <out>Encrypts a file with AES; add -d to decrypt. Always use -pbkdf2.
Example
openssl enc -aes-256-cbc -salt -pbkdf2 -in secret.txt -out secret.encopenssl passwd -6 <password>Generates a SHA-512 crypt hash suitable for /etc/shadow.
Example
openssl passwd -6 Summer2026echo -n "<text>" | openssl base64Base64-encodes input; add -d to decode.
Example
echo -n "admin:pass" | openssl base64The free implementation of OpenPGP: generate keys, encrypt and decrypt files, and create and verify digital signatures — used everywhere from email to release verification.
Encodes and decodes Base64, the standard way to carry binary data over text channels — common in tokens, config files and shell file-transfer tricks.
Transfers data with URLs over HTTP, FTP and many other protocols. Indispensable for testing APIs, headers and authentication.