Jon*_*Bor 19 certificate openssl
我在链中拥有三个证书:
当我使用openssl x509 -in [filename] -text -noout
它们检查它们时,它们看起来不错,root.pem 看起来像是自签名的(Issuer == Subject),并且正如预期的那样,每个证书的主题是下一个证书的颁发者。
事实上,我可以验证直到中间证书的链:
$ openssl verify -CAfile root.pem root.pem
root.pem: OK
$ openssl verify -CAfile root.pem intermediate.pem
intermediate.pem: OK
Run Code Online (Sandbox Code Playgroud)
但是, john.pem 失败了:
$ openssl verify -CAfile root.pem -CAfile intermediate.pem john.pem
john.pem: C = CL, [...redacted data...]
error 2 at 1 depth lookup:unable to get issuer certificate
Run Code Online (Sandbox Code Playgroud)
据我所知,这意味着openssl 无法找到intermediate.pem 的发行者。这没有意义,因为 root.pem 确实是中间件.pem 的发行者。
我错过了什么?
编辑:我最初发布了一个答案,说 root.pem 和 middle.pem 应该连接在一个文件中,然后应该使用这个文件作为-CAfile
. 这是错误的,因为正如Johannes Pille指出的那样,这隐含地信任middle.pem。阅读他在我删除的答案中发布的链接:https : //mail.python.org/pipermail/cryptography-dev/2016-August/000676.html
小智 18
您不必将两个证书放在一起来验证它们。
如果你有以下三个证书:
并且您只信任 root.pem,然后您将john.pem
使用以下命令进行验证:
openssl verify -CAfile root.pem -untrusted intermediate.pem john.pem
Run Code Online (Sandbox Code Playgroud)
如果你有很多中间体,你可以链接 -untrusted intermediate2.pem -untrusted intermediate3.pem ...
归档时间: |
|
查看次数: |
32518 次 |
最近记录: |