To determine the SSL certificate expiration date from a PEM-encoded certificate, you can use the openssl
command-line tool. Here's how to do it:
Step 1: View the Certificate Information
Use the openssl x509
command to display the details of the certificate, including the expiration date.
openssl x509 -in your_certificate.pem -noout -dates
in your_certificate.pem
: Specifies the input PEM file containing the certificate.noout
: Preventsopenssl
from outputting the entire certificate.dates
: Outputs the certificate's start (notBefore
) and end (notAfter
) dates.
Example
If your PEM-encoded certificate is named certificate.pem
, the command would be:
openssl x509 -in certificate.pem -noout -dates
Expected Output
The command will output something like:
notBefore=Mar 20 12:00:00 2023 GMT
notAfter=Mar 20 12:00:00 2024 GMT
- notBefore: The date and time when the certificate becomes valid.
- notAfter: The date and time when the certificate expires.
Step 2: Interpret the Dates
- The notAfter date tells you when the certificate will expire.
- Ensure that your system time is correctly set to avoid misinterpretation of the expiration date.
Summary
By using the openssl x509 -in your_certificate.pem -noout -dates
command, you can easily find the expiration date of your SSL certificate from a PEM-encoded certificate file.
Make your mark
Join the writer's program
Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.
Write for usBuild on top of Better Stack
Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.
community@betterstack.comor submit a pull request and help us build better products for everyone.
See the full list of amazing projects on github