xutil.dev
Login

OpenSSL Cheatsheet

OpenSSL command cheatsheet covering certificate inspection, generation, format conversion, key operations, SSL/TLS connection testing, hashing, signing, and encryption organized by category

Related Categories:SSL/TLSSecurity

70 commands

x509 -text

View certificate details

x509 -enddate

Check certificate expiry date

x509 -startdate

Check certificate start date

x509 -ext SAN

Extract Subject Alternative Names

x509 -subject

Show certificate subject

x509 -issuer

Show certificate issuer

x509 -serial

Show certificate serial number

x509 -fingerprint SHA256

Get SHA256 fingerprint

x509 -fingerprint SHA1

Get SHA1 fingerprint

verify

Verify certificate chain

x509 -purpose

Check certificate purpose

req -x509 (self-signed)

Generate self-signed certificate

req -new (CSR)

Generate Certificate Signing Request

x509 -x509toreq

Create CSR from existing certificate

req -new -newkey

Generate CSR with new key

x509 -req (CA sign)

Sign CSR with CA certificate

req -x509 -addext SAN

Generate self-signed certificate with SAN

req -x509 EC

Generate EC certificate

pkcs12 -export

Create PKCS12 file

x509 PEM→DER

Convert PEM to DER format

x509 DER→PEM

Convert DER to PEM format

pkcs12 PEM→PKCS12

Convert PEM to PKCS12 format

pkcs12 PKCS12→PEM

Convert PKCS12 to PEM format

pkcs12 extract key

Extract private key from PKCS12

pkcs12 extract cert

Extract certificate from PKCS12

pkcs7 PKCS7→PEM

Convert PKCS7 to PEM format

crl2pkcs7 PEM→PKCS7

Convert PEM to PKCS7 format

genrsa

Generate RSA private key

ecparam P-256

Generate EC key (P-256)

ecparam P-384

Generate EC key (P-384)

genpkey Ed25519

Generate Ed25519 key

rsa -text

View RSA key details

ec -text

View EC key details

rsa -pubout

Extract public key

rsa (remove passphrase)

Remove passphrase from key

rsa -aes256

Add passphrase to key

key-cert match

Check if key matches certificate

req -text (CSR)

Check CSR details

s_client

Test SSL/TLS connection

s_client -showcerts

Show certificate chain

s_client -tls1_2

Test connection with TLS 1.2

s_client -tls1_3

Test connection with TLS 1.3

s_client -cipher

Connect with specific cipher suite

s_client -servername

Connect with SNI

s_client STARTTLS SMTP

Connect with STARTTLS (SMTP)

s_client STARTTLS IMAP

Connect with STARTTLS (IMAP)

s_client STARTTLS FTP

Connect with STARTTLS (FTP)

s_client → x509

Get and display server certificate only

s_client -status

Check OCSP stapling

dgst -sha256

Calculate SHA256 digest

dgst -sha512

Calculate SHA512 digest

dgst -md5

Calculate MD5 digest

dgst -sign

Sign a file

dgst -verify

Verify a signature

dgst -hmac

Calculate HMAC-SHA256

list -digest-algorithms

List available digest algorithms

base64

Base64 encode a file

enc -aes-256-cbc

Encrypt file with AES-256-CBC

enc -d (decrypt)

Decrypt an encrypted file

enc -a (Base64)

Encrypt with Base64 output

rand -hex

Generate random hex bytes

rand -base64

Generate random Base64 bytes

rand (password)

Generate random password

list -cipher-algorithms

List available cipher algorithms

verify (chain)

Verify certificate with intermediate

crl -text

Check Certificate Revocation List

speed

Benchmark cryptographic operations

speed -multi

Multi-threaded benchmark

version -a

Show OpenSSL version information

ciphers -v

List available cipher suites