Quantcast
Channel: get certificate expiry date in unix time (or any other numeric) format - Super User
Viewing all articles
Browse latest Browse all 2

Answer by Cpt.Whale for get certificate expiry date in unix time (or any other numeric) format

$
0
0

-enddate outputs in rfc_822 standard by default, so GNU date command can read it if you cut notAfter= characters:

$ openssl x509 -enddate -noout -in cert.pem | cut -c10- | date +%s -f -1868282453

Newer versions of OpenSSL support printing in -dateopt iso_8601 format, which is at least alphabetically sortable


OpenSSL does have a seconds-till-expired check built in, but it's a true/false output:

$ openssl x509 -checkend 2592000 -noout -in cert.pem || echo "cert expires in 30 days!"

Viewing all articles
Browse latest Browse all 2

Trending Articles