首页 > 解决方案 > CRL 有效性 openssl

问题描述

我需要验证下载的 crl 实际上是 CA 生成的,并且没有被潜在的攻击者修改。有没有办法用来自 linux os 的 openssl 命令来验证这一点?

换句话说,我需要根据其根 CA 验证 CRL 签名,我已经找到了这个链接,但对我没有多大帮助。 针对其根 CA 验证 CRL 签名

标签: linuxopensslclient-certificatespublic-keycertificate-revocation

解决方案


openssl 有一个命令来验证下载的 crl 对颁发证书颁发机构的签名。

openssl crl -verify -in <crl file> -CAfile < issue certificate or cert chain>

这是根据 Google 颁发者 CA 证书验证 GOOGLE CRL 的 hello-world 示例

  1. 使用 wget 下载谷歌 crl

    wget http://crl.pki.goog/GTS1O1core.crl

  2. 下载的 CRL 是 DER 格式,转换成 PEM 格式

    openssl crl -inform DER -in GTS1O1core.crl -outform PEM -out google_crl.pem

  3. 下载谷歌证书链

    OLDIFS=$IFS; IFS=':' certificates=$(openssl s_client -connect google.com:443 -showcerts -tlsextdebug -tls1 2>&1 </dev/null | sed -n '/-----BEGIN/,/-----END/ {/-----BEGIN/ s/^/:/; p}'); for certificate in ${certificates#:}; do echo $certificate | tee -a google-cert-chain.pem ; done; IFS=$OLDIFS

  4. 根据颁发证书验证下载的 CRL(在 3 中下载的证书链中可用)

    openssl crl -verify -in google_crl.pem -CAfile google-cert-chain.pem


推荐阅读