cheat-fork-echo/cheatsheets/openssl
Jörg Thalheim b848b2a607 openssl: command to show certificate infos
Did you ever was on a server, but did not remember, what the certificate is for?
2013-10-28 13:16:01 +01:00

21 lines
783 B
Text

# To create a 2048-bit private key:
openssl genrsa -out server.key 2048
# To create the Certificate Signing Request (CSR):
openssl req -new -key server.key -out server.csr
# To sign a certificate using a private key and CSR:
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
# To show certificate information for a certificate signing request
openssl req -text -noout -in server.csr
# To show certificate information for generated certificate
openssl x509 -text -noout -in server.crt
# (The above commands may be run in sequence to generate a self-signed SSL certificate.)
# To view certificate expiration:
echo | openssl s_client -connect <hostname>:443 2> /dev/null | \
awk '/-----BEGIN/,/END CERTIFICATE-----/' | \
openssl x509 -noout -enddate