How to determine SSL cert expiration date from a PEM encoded certificate?

前端 未结 9 2106
感动是毒
感动是毒 2020-11-30 16:21

If I have the actual file and a Bash shell in Mac or Linux, how can I query the cert file for when it will expire? Not a web site, but actually the certificate file itself,

9条回答
  •  我在风中等你
    2020-11-30 16:59

    With openssl:

    openssl x509 -enddate -noout -in file.pem
    

    The output is on the form:

    notAfter=Nov  3 22:23:50 2014 GMT
    

    Also see MikeW's answer for how to easily check whether the certificate has expired or not, or whether it will within a certain time period, without having to parse the date above.

提交回复
热议问题