Get certificate fingerprint of HTTPS server from command line?
this is also enough:
openssl x509 -fingerprint -in server.crt
This is an old thread but there is an easier way I found. Assuming you have the crt file:
$ cat server.crt|openssl x509 -fingerprint
MD5 Fingerprint=D1:BA:B0:17:66:6D:7F:42:7B:91:1E:22:7E:3A:27:D2
The page at http://wiki.debuntu.org/wiki/OpenSSL#Retrieving_certificate_informations lists the command lines for that (and printing out the relevant information). From that page and some of the man pages, it seems like what you want is (for bash):
openssl s_client -connect <host>:<port> < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout -in /dev/stdin
If you want the whole certificate, leave off the |
symbol and everything after it.