2

I'm trying to understand how to read the output of OpenSSL commands.

Currently, I am trying to understand how Certificate Chains work.

When I give the command (using a standard ca bundle)

openssl s_client -connect www.google.com:443 -CAfile ca-bundle.crt

I get

CONNECTED(00000003)IzJZ5dQUbs0pjW3tAgTAMBgNVHRMBAf8EAjAAMB8GA1Ud
depth=3 /C=US/O=Equifax/OU=Equifax Secure Certificate AuthorityW
verify return:1BAgIwMAYDVR0fBCkwJzAloCOgIYYfaHR0cDovL3BraS5nb29n
depth=2 /C=US/O=GeoTrust Inc./CN=GeoTrust Global CAyd2eyQKKxh3vJ
verify return:11cY/EIksH6hXF6EFnS+8vWZs8Ka8FyQi76cUOSqk2ed2DvOeT
depth=1 /C=US/O=Google Inc/CN=Google Internet Authority G2Bii82d
verify return:1UuiFeti7EjUXr0E58NMnBw39Zv6nZaSbppvlLR/jRBKCRB7jB
depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
verify return:1sfjYdq1K94yLkfe6mUR7Go6JUkD/eB/Aq9KKoSJbJEvvjGIiJ
---MkQ==
Certificate chainATE-----
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.comcom
   i:/C=US/O=Google Inc/CN=Google Internet Authority G2G2
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
 2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---
Server certificateCipher is AES128-SHA
-----BEGIN CERTIFICATE-----it
MIIEgDCCA2igAwIBAgIIMPM39zVrKUkwDQYJKoZIhvcNAQELBQAwSTELMAkGA1UE
BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl
cm5ldCBBdXRob3JpdHkgRzIw....
.....

My question is in regard to the Certificate Chain section.

Which is the Root Certificate? The first one listed or the last? Why are they all reported? Isn't one validation enough to move on with?

3
 0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=www.google.com
   i:/C=US/O=Google Inc/CN=Google Internet Authority G2
 1 s:/C=US/O=Google Inc/CN=Google Internet Authority G2
   i:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
 2 s:/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA
   i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority

... Which is the Root Certificate? The first one listed or the last?

None of these. It only shows which certificates are sent by the server, i.e. the leaf certificate and the intermediate (chain) certificates. The root certificate is usually not sent (and would be ignored if sent) since the whole idea of trusted path validation is that the root is trusted because it is locally known.

In this case the trust path can be validated if the user has the certificate for 'Equifax Secure Certificate Authority' as a local trusted certificate and if this certificate can be used to validate the signature of certificate#2 (GeoTrust Global CA), then certificate#2 can be used to verify signature of certificate#1 and certificate#1 to verify signature of certificate#0. Note that trust path is only one part of the certificate validation. You also need to add validation of the subject (i.e. matches the subject www.google.com the URL you've tried you access) and checks for expiration and revocation.

  • Does that make 0 and 1 "Intermediate Certificates", in the technical sense? – CodyBugstein Dec 4 '15 at 6:50
  • @Imray: 0 is the leaf certificate, 1 and 2 are the intermediates and the root is not shown since it is not sent. by the server as explained. – Steffen Ullrich Dec 4 '15 at 6:52
0

Why are they all reported? Isn't one validation enough to move on with?

This is explained in this answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.