是否可以使用openssl验证证书链,同时跳过到期日期

问题描述 投票:0回答:4

我们正在与 AWS Nitro 合作,它仅提供 3 小时的证书。

我们正在寻找一种方法,可以跳过验证中的过期部分,并仍然确认证书链有效。

openssl x509certificate
4个回答
1
投票

根据 openssl-verify 文档

       -attime timestamp
           Perform validation checks using time specified by timestamp and not current system time. timestamp is the number of seconds since 01.01.1970 (UNIX time).

如果您将标志的值指定为到期前的某个时间,它将帮助您跳过到期检查,因为它将始终返回 true。


0
投票

您可以将

-days
选项与
x509
命令一起使用。

例如:

openssl x509 -days

我不确定 - 天与

openssl req
一起工作,因为有效性决定
x509


0
投票

要禁止检查证书上的到期日期,请使用

X509_V_FLAG_NO_CHECK_TIME
标志:

X509_STORE_set_flags (store, other_flags | X509_V_FLAG_NO_CHECK_TIME);

X509_V_FLAG_NO_CHECK_TIME
标志禁止根据当前时间检查证书和 CRL 的有效期。

似乎没有办法在命令行上设置此选项。


0
投票

对于

openssl
,标志是
-no_check_time

例如要验证 certA.pem 是否由您通常使用的 certB.pem 颁发:

不使用标志:

openssl verify -no-CAfile -no-CApath -partial_chain -trusted "certA.pem" "certB.pem"

输出:

error 10 at 0 depth lookup: certificate has expired  
error certA.pem: verification failed

使用标志:

openssl verify -no_check_time -no-CAfile -no-CApath -partial_chain -trusted "certA.pem" "certB.pem"

输出带有标志:

certA.pem: OK
© www.soinside.com 2019 - 2024. All rights reserved.