
Openssl x509 -in root.pem -hash -issuer_hash -noout Openssl x509 -in intermediate.pem -hash -issuer_hash -noout Openssl x509 -in entity.pem -hash -issuer_hash -noout Openssl x509 -hash -issuer_hash -noout -in certificate Run the following OpenSSL command to get the hash sequence for each certificate in the chain from entity to root and verify that they form a proper certificate chain. It is always a good practice to verify the hash sequence of certificates as it can help in identifying issues such as the Common Name (CN) of the certificate having unwanted space or special characters. Issuer=/C=US/O=IdenTrust/CN=IdenTrust Commercial Root CA 1Ĭheck Certificate Chain subject and issuer hash Subject=/C=US/O=IdenTrust/CN=IdenTrust Commercial Root CA 1 Issuer=/C=US/O=IdenTrust/CN=IdenTrust Commercial Root CA tmp]# openssl crl2pkcs7 -nocrl -certfile idtrca.cer | openssl pkcs7 -print_certs -noout Subject=/C=US/O=IdenTrust/OU=HydrantID Trusted Certificate Service/CN=HydrantID Server CA O1 Issuer=/C=US/O=HydrantID (Avalanche Cloud Corporation)/CN=HydrantID SSL ICA tmp]# openssl crl2pkcs7 -nocrl -certfile hydssl.cer | openssl pkcs7 -print_certs -noout Subject=/C=US/ST=California/L=San Jose/O=test Systems, Inc./CN= The Subject and Issuer are the same in the root tmp]# openssl crl2pkcs7 -nocrl -certfile test | openssl pkcs7 -print_certs -noout.The Subject of the root certificate matches the Issuer of the intermediate certificate.The Subject of the intermediate certificate matches the Issuer of the entity certificate.Check Certificate Chain Subject and Issuer We can see that there are four certificates in this certificate chain. Openssl s_client -connect :443 -showcertsĭepth=3 C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CAĭepth=2 C = US, O = Google Trust Services LLC, CN = GTS Root R1ĭepth=1 C = US, O = Google Trust Services LLC, CN = GTS CA 1C3 port is the port where SSL is listening, normally 443.Openssl s_client -connect server_name:port -showcerts We can use the following command to shows the certificate chain. If it can’t be chained back to a trusted root, the browser will issue a warning about the certificate. If the certificate is valid and can be chained back to a trusted root, it will be trusted. It will begin by following the chain to the intermediate that has been installed, from there it continues tracing backwards until it arrives at a trusted root certificate. When a browser downloads our website’s TLS certificate upon arriving at our homepage, it begins chaining that certificate back to its root.
OPENSSL VERIFY INSTALL
When we install our TLS certificate, we also be sent an intermediate root certificate or bundle. The server certificate is the one issued to the specific domain the user is needing coverage for. There will always be at least one intermediate certificate in a chain, but there can be more than one. They act as middle-men between the protected root certificates and the server certificates issued out to the public. Intermediate certificates branch off root certificates like branches of trees. It comes pre-downloaded in most browsers and is stored in what is called a “ trust store.” The root certificates are closely guarded by CAs. A root certificate is a digital certificate that belongs to the issuing Certificate Authority. Understanding Root Intermediate Server Certificate


In order for an TLS certificate to be trusted, it has to be traceable back to the trust root it was signed off, meaning all certificates in the chain-server, intermediate and root-need to be properly trusted. The certificate chain refers to our TLS/SSL certificate and how it is linked back to a trusted Certificate Authority. The chain or path begins with the SSL/TLS certificate, and each certificate in the chain is signed by the entity identified by the next certificate in the chain. The following is from Hostname validation and shows how you could use OpenSSL's built-in hostname validation.Certificate chain is an ordered list of certificates, containing an SSL/TLS Certificate and Certificate Authority (CA) Certificates, that enable the receiver to verify that the sender and all CA’s are trustworthy. Version 1.0.2 and up contain support for hostname validation, but they still require the user to call a few functions to set it up.Ī man page on hostname validation has been available since 1.0.2. Versions prior to 1.0.2 did not perform hostname validation.

One common mistake made by users of OpenSSL is to assume that OpenSSL will validate the hostname in the server's certificate.
OPENSSL VERIFY CODE
The code is beginning to see widespread testing as the release of OpenSSL 1.1.0 approaches. Its been available in Master since that time. Viktor Dukhovni provided the implementation in January, 2015. OpenSSL 1.1.0 provides built-in functionality for hostname checking and validation.
