如何从PEM EN codeD证书确定SSL证书到期日期?
问题描述:
如果我有实际的文件,并在Mac或Linux的Bash shell中,我怎么可以查询何时会过期证书文件?不是一个网站,但实际上该证书文件本身,假设我有社会责任,重点,PEM和链文件。
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, assuming I have the csr, key, pem and chain files.
答
通过的OpenSSL
:
openssl x509 -enddate -noout -in file.pem
输出的是形式:
notAfter=Nov 3 22:23:50 2014 GMT
另请参见 MikeW对如何轻松地检查证书是否过期与否,或者是否会在一个答案一定的时间段,而不必解析上方的日期
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.