openssl commands
27 commands, each with a one-line explanation. Click a command to copy it, or its title for details.
Commands 27 shown
-
openssl genrsa -out private.key 4096Generate a 4096-bit RSA private key
-
openssl genpkey -algorithm ed25519 -out private.key && openssl pkey -in private.key -pubout -out public.keyModern Ed25519 key (smaller, faster than RSA)
-
openssl req -new -key private.key -out request.csr -subj '/CN=example.com/O=MyOrg/C=RU'Certificate Signing Request for CA submission
-
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj '/CN=localhost'Generate self-signed cert + key in one command
-
openssl x509 -in cert.pem -noout -text | grep -E 'Subject:|Issuer:|Not (Before|After)|DNS:'Show subject, issuer, validity dates, SANs
-
openssl x509 -in cert.pem -noout -datesPrint notBefore and notAfter dates
-
openssl verify -CAfile ca.pem cert.pemCheck certificate chain against a CA bundle
-
diff <(openssl x509 -pubkey -noout -in cert.pem) <(openssl pkey -pubout -in key.pem) && echo 'MATCH'Confirm the cert and private key are a pair
-
openssl pkcs12 -export -in cert.pem -inkey key.pem -certfile ca.pem -out bundle.p12 -name myaliasPackage cert + key + CA into a .p12 file
-
openssl pkcs12 -in bundle.p12 -nokeys -out cert.pem && openssl pkcs12 -in bundle.p12 -nocerts -nodes -out key.pemSplit .p12 into separate cert and key PEM files
-
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -dates -subject -issuerShow expiry and issuer of a live TLS certificate
-
openssl s_client -connect example.com:443 -showcerts 2>/dev/null | openssl crl2pkcs7 -nocrl | openssl pkcs7 -print_certs -noout -text | grep -E 'Subject:|Issuer:'Display full chain: leaf → intermediate → root
-
openssl enc -aes-256-cbc -pbkdf2 -in secret.txt -out secret.encPassword-encrypt a file with AES-256-CBC + PBKDF2
-
openssl enc -d -aes-256-cbc -pbkdf2 -in secret.enc -out secret.txtDecrypt a file encrypted with the enc command above
-
openssl rand -hex 32Generate a 64-char hex random string (e.g. for API keys)
-
openssl x509 -in cert.pem -noout -textDump all cert fields: subject, issuer, validity, extensions, SANs, key usage
-
openssl x509 -in cert.pem -noout -checkend 86400 && echo OK || echo EXPIRINGExit 0 if cert valid >24h; perfect for monitoring/CI alerts on expiry
-
openssl s_client -connect <host>:443 -servername <host> -showcerts </dev/null 2>/dev/nullFetch full chain with SNI; -servername is mandatory for vhosts/SNI backends
-
openssl x509 -in cert.pem -noout -ext subjectAltNameShow only SAN entries; modern browsers ignore CN, so SAN is what matters
-
openssl verify -CAfile ca-chain.pem cert.pemValidate trust chain; note: -CAfile must hold intermediates+root in order
-
diff <(openssl x509 -in cert.pem -noout -modulus | md5sum) <(openssl rsa -in key.pem -noout -modulus | md5sum)Equal modulus hashes prove key matches cert; empty diff = match
-
openssl req -new -newkey rsa:2048 -nodes -keyout key.pem -out req.csr -subj "/CN=<host>" -addext "subjectAltName=DNS:<host>"Generate key+CSR with SAN inline; -addext avoids editing openssl.cnf
-
openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 365 -subj "/CN=<host>" -addext "subjectAltName=DNS:<host>"One-liner self-signed cert valid 1y; SAN required or TLS clients reject it
-
openssl pkcs12 -export -in cert.pem -inkey key.pem -certfile ca-chain.pem -out bundle.p12 -name <name>Bundle cert+key+chain into .p12 for Java keystores / Windows imports
-
openssl s_client -connect <host>:5432 -starttls postgres -showcerts </dev/null 2>/dev/nullInspect TLS on STARTTLS services; swap postgres for smtp/imap/mysql/ldap
-
openssl genpkey -algorithm ed25519 -out ed25519.pemModern: Ed25519 keys are tiny and fast vs RSA; use for signing/mTLS
-
openssl s_client -connect <host>:443 -tls1_2 </dev/null 2>&1 | grep -E 'Protocol|Cipher'Force a version to confirm support; use -tls1_3 / -no_tls1_2 to test policy
no commands match — try a different search