我要核实一下Yubico颁发的CA证书。我复制了整个证书
-----BEGIN CERTIFICATE-----到-----END CERTIFICATE-----的文件中有结尾的.pem。然后,我想在命令行中使用openssl verify test.pem验证这一点(test.pem是我的证书文件)。我得到了
test.pem: CN = Yubico U2F Root CA Serial 457200631
error 18 at 0 depth lookup:self signed certificate
OK我对openssl和openSUSE非常陌生,所以我不知道如何解决这个问题。我的目的是根据此CA文件验证证书。但首先我想消除这个错误。
发布于 2015-12-02 22:47:24
嗯,他们说他们使用gpg对文件(yubico-utf-ca-certs.txt)进行签名,签名在链接的文件中。所以
gpg --verify yubico-u2f-ca-certs.txt.sig yubico-u2f-ca-certs.txt
gpg: Signature made Tue Sep 2 11:18:24 2014 CEST using RSA key ID 32F8119D
gpg: requesting key 32F8119D from hkp server keys.gnupg.net
gpg: key 54265E8C: public key "Simon Josefsson <simon@josefsson.org>" imported
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: next trustdb check due at 2019-08-28
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
gpg: Good signature from "Simon Josefsson <simon@josefsson.org>"
gpg: aka "Simon Josefsson <simon@yubico.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 9AA9 BDB1 1BB1 B99A 2128 5A33 0664 A769 5426 5E8C
Subkey fingerprint: 9941 5CE1 905D 0E55 A9F8 8026 860B 7FBB 32F8 119D好的。这表明该文件是由Yubico的某人(有效地)签署的,所以看起来是这样的。
证书本身(some_cert.pem)是自签名的,因此必须告诉openssl信任它:“验证”检查证书链,但在这里,链立即结束:证书标识本身。在这种情况下,您需要检查签名(但这并没有说明证书的来源,任何人都可以使用名为Yubico的自签名证书!),因此我们可以这样做。
openssl verify -trusted some_cert.pem -check_ss_sig some_cert.pem它确实表示OK (它说要检查最后一个(仅在这里)链接,即自签名的链接,并显式地信任签名者;通常,openssl知道或需要在命令行参数中了解一个可信证书目录。
检查证书(您现在信任证书的来源,因为它是由gpg等签署的)的签名,例如do
openssl x509 -in some_cert.pem -noout -text它输出所有字段,包括串行字段,该字段也在签名的文本文件中。所以现在你看到了一切本身都是一致的。但是您必须相信gpg密钥(来自密钥服务器)和文件托管在站点上的事实等等。根据我的gpg安装,gpg密钥是不可信的。
希望这能有所帮助。
https://crypto.stackexchange.com/questions/30993
复制相似问题