AbstractBrain Answers About us →

How to see a certificate expiration with OpenSSL

Question

How can I see a certificate expiration with OpenSSL?

I have an SSL/TLS certificate and I would like to see when it expires.

Is there any way to see the expiration from command line (e.g. OpenSSL)?

Answer

You can use this command to display the certificate expiration:

$ openssl x509 -enddate -noout -in cert.pem

In case the certificate is stored in a format different from PEM, you first need to convert it. For example you can convert .cer to .pem with this command:

$ openssl x509 -inform der -in cert.cer -out cert.pem