s3c*_*s3c 6 openssl certificates
我正在尝试下载证书链并在本地验证它,因为新的 CA 证书被推送到客户端,基本上是了解哪些站点可以在任何给定时间工作。我使用以下命令下载链:
echo -n | openssl s_client -showcerts -connect example.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > mycert.pem
Run Code Online (Sandbox Code Playgroud)
但是在使用时openssl verify
我收到一条错误消息:
root@host:~# openssl version
OpenSSL 1.1.0e 16 Feb 2017
root@host:~# echo -n | openssl s_client -showcerts -connect example.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > mycert.pem
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, CN = DigiCert SHA2 Secure Server CA
verify return:1
depth=0 C = US, ST = California, L = Los Angeles, O = Internet Corporation for Assigned Names and Numbers, OU = Technology, CN = www.example.org
verify return:1
DONE
root@host:~# openssl verify mycert.pem
C = US, ST = California, L = Los Angeles, O = Internet Corporation for Assigned Names and Numbers, OU = Technology, CN = www.example.org
error 20 at 0 depth lookup: unable to get local issuer certificate
error mycert.pem: verification failed
Run Code Online (Sandbox Code Playgroud)
离线验证这样的证书链的正确方法是什么?
小智 2
您应该将要验证的证书放在一个文件中,并将链放在另一个文件中:
openssl verify -CAfile chain.pem mycert.pem
Run Code Online (Sandbox Code Playgroud)
当然,openssl
了解如何查找根证书(如果未包含在 chain.pem 中)也很重要。如果您需要执行此操作(如果您使用自己的 CA),那么您也可以指定一个替代目录来查找它-CApath
归档时间: |
|
查看次数: |
13727 次 |
最近记录: |