OpenSSL "verify" - Verify or Validate Certificate


How to verify or validate a certificate using OpenSSL "verify" command? I got a certificate from the Web site server and want to see if it is valid.



If you have a certificate stored in a file, you can try to validate it or verify it with the OpenSSL "verify" command as shown below:


OpenSSL> verify twitter.pem

twitter.pem: /
   / Organization/serialNumber=4337446/C=US/postalCode=94107
   /ST=California/L=San Francisco/streetAddress=795 Folsom St, Suite 600
   /O=Twitter, Inc./OU=Twitter Security/
error 20 at 0 depth lookup:unable to get local issuer certificate

twitter.pem: businessCategory = Private Organization, jurisdictionC = US, 
   jurisdictionST = Delaware, serialNumber = 4337446, street = Suite 900, 
   street = 1355 Market St, postalCode = 94103, C = US, ST = California, 
   L = San Francisco, O = "Twitter, Inc.", OU = Twitter Security, CN =
error 20 at 0 depth lookup:unable to get local issuer certificate
error in verify

OpenSSL> x509 -in twitter.pem -noout -issuer
issuer= /C=US/O=DigiCert Inc/ SHA2 Extended Validation Server CA

The certification validation failed with the error message: "unable to get local issuer certificate". Based on the OpenSSL documentation, the cause of the error is the issuer certificate could not be found: this occurs if the issuer certificate of an untrusted certificate cannot be found.

The output of the "x509 -in twitter.pem -noout -issuer" command tells us that the issuer of the certificate in "twitter.pem" is "DigiCert SHA2 Extended Validation Server CA". We need to find a way to provide the certificate of "DigiCert SHA2 Extended Validation Server CA" to pass the validation.

If you don't have "twitter.pem" certificate file this tutorial, you can create one using "openssl -s_client -connect > twitter.pem" command.


OpenSSL "verify -untrusted" - Specify Untrusted Certificate

OpenSSL Fulgan Binary Crash on Windows 7

OpenSSL "verify" Command

⇑⇑ OpenSSL Tutorials

2012-07-24, 10151🔥, 0💬