← Cheatsheets
Linux
openssl
openssl commands for generating keys, inspecting certificates, converting formats and testing TLS.
Key Generation
openssl genrsa -out key.pem 4096openssl ecparam -genkey -name prime256v1 -out key.pemopenssl genpkey -algorithm ed25519 -out key.pemopenssl rand -hex 32CSR & Self-Signed Certs
openssl req -new -key key.pem -out cert.csropenssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodesopenssl req -x509 -key key.pem -in cert.csr -out cert.pem -days 365Inspecting Certificates
openssl x509 -in cert.pem -text -nooutopenssl x509 -in cert.pem -subject -nooutopenssl x509 -in cert.pem -issuer -nooutopenssl x509 -in cert.pem -dates -nooutopenssl x509 -in cert.pem -fingerprint -nooutopenssl req -in cert.csr -text -nooutTesting & Verification
openssl s_client -connect host:443openssl s_client -connect host:443 -servername hostopenssl verify -CAfile ca.pem cert.pemopenssl s_client -connect host:443 2>/dev/null | openssl x509 -noout -datesFormat Conversion
openssl pkcs12 -export -in cert.pem -inkey key.pem -out bundle.p12openssl pkcs12 -in bundle.p12 -out cert.pem -nodesopenssl x509 -in cert.pem -outform DER -out cert.deropenssl x509 -in cert.der -inform DER -out cert.pemEncryption & Hashing
openssl dgst -sha256 file.txtopenssl enc -aes-256-cbc -in file.txt -out file.encopenssl enc -d -aes-256-cbc -in file.enc -out file.txtopenssl passwd -6 mypassword