Displaying a remote SSL certificate details using CLI tools

You should be able to use OpenSSL for your purpose:

echo | openssl s_client -showcerts -servername gnupg.org -connect gnupg.org:443 2>/dev/null | openssl x509 -inform pem -noout -text

That command connects to the desired website and pipes the certificate in PEM format on to another openssl command that reads and parses the details.

(Note that “redundant” -servername parameter is necessary to make openssl do a request with SNI support.)

Leave a Comment