Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the Root CA Certificate Fingerprint using openssl

By using the following command, I can verify the sha1 fingerprint of the presented certificate:

$ openssl s_client -connect hooks.slack.com:443 -showcerts < /dev/null 2>/dev/null   | openssl x509 -in /dev/stdin -sha1 -noout -fingerprint
SHA1 Fingerprint=AB:F0:5B:A9:1A:E0:AE:5F:CE:32:2E:7C:66:67:49:EC:DD:6D:6A:38

But what if I want to get the fingerprint of the Top Level Signing Authority?

$ openssl s_client -connect hooks.slack.com:443 < /dev/null 2>/dev/null
CONNECTED(00000003)
---
Certificate chain
 0 s:/C=US/ST=California/L=San Francisco/O=Slack Technologies, Inc/CN=*.slack.com
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust SSL CA - G3
 1 s:/C=US/O=GeoTrust Inc./CN=GeoTrust SSL CA - G3
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA <- **I WANT THIS SHA1**

In the case that I want to verify this against a Java keystore, to check definitively if it contains the same CA.

geotrustglobalca, 18-Jul-2003, trustedCertEntry,
Certificate fingerprint (SHA1): DE:28:F4:A4:FF:E5:B9:2F:A3:C5:03:D1:A3:49:A7:F9:96:2A:82:12

Since "geotrustglobalca" and "/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA" aren't really comparable.

like image 858
PhaedrusTheGreek Avatar asked Sep 01 '25 18:09

PhaedrusTheGreek


1 Answers

In a similar situation with a let's encrypt certificate on a shared hosting solution I had success with specifying the servername parameter:

openssl s_client -connect hooks.slack.com:443 -servername hooks.slack.com -showcerts < /dev/null 2>/dev/null   | openssl x509 -in /dev/stdin -sha1 -noout -fingerprint
like image 139
Tobias Beuving Avatar answered Sep 06 '25 08:09

Tobias Beuving