1
在OpenSSL中,我可以使用以下命令驗證證書。GnuTLS驗證證書:任何易於使用的東西?
$ openssl verify -CApath /etc/ssl/certs cert_to_be_verified.pem
我不知道在GnuTLS中是否有類似的命令。我能找到的最接近的是「certtool」。但是「certtool」需要指定CA文件,與OpenSSL相比,這非常不方便。非常感謝小費!
在OpenSSL中,我可以使用以下命令驗證證書。GnuTLS驗證證書:任何易於使用的東西?
$ openssl verify -CApath /etc/ssl/certs cert_to_be_verified.pem
我不知道在GnuTLS中是否有類似的命令。我能找到的最接近的是「certtool」。但是「certtool」需要指定CA文件,與OpenSSL相比,這非常不方便。非常感謝小費!
其實certtool不要求你指定CA文件。它將使用您的系統的證書列表。
受信任的證書列表可以用--load-CA證書加載。如果未提供證書列表,則使用系統的證書列表。請注意,在驗證過程中,可能會探索多條路徑。在 一個成功的驗證成功的道路將是最後一個。它可以與--verify-purpose或--verify-hostname結合使用。
$ certtool --verify --infile google.com.crt
Loaded system trust (168 CAs available)
Loaded 3 certificates, 168 CAs and 0 CRLs
Subject: CN=GeoTrust Global CA,O=GeoTrust Inc.,C=US
Issuer: OU=Equifax Secure Certificate Authority,O=Equifax,C=US
Checked against: OU=Equifax Secure Certificate Authority,O=Equifax,C=US
Output: Verified. The certificate is trusted.
Subject: CN=Google Internet Authority G2,O=Google Inc,C=US
Issuer: CN=GeoTrust Global CA,O=GeoTrust Inc.,C=US
Checked against: CN=GeoTrust Global CA,O=GeoTrust Inc.,C=US
Output: Verified. The certificate is trusted.
Subject: CN=*.google.com,O=Google Inc,L=Mountain View,ST=California,C=US
Issuer: CN=Google Internet Authority G2,O=Google Inc,C=US
Checked against: CN=Google Internet Authority G2,O=Google Inc,C=US
Output: Verified. The certificate is trusted.
Chain verification output: Verified. The certificate is trusted.