小编use*_*637的帖子

"openssl verify"可以为错误的证书链提供帮助

有一个自签名的根CA证书rootcert.pem,具有以下V3扩展:

X509v3 extensions:
    X509v3 Key Usage: 
       Certificate Sign
    X509v3 Basic Constraints: 
       CA:TRUE
Run Code Online (Sandbox Code Playgroud)

rootcert.pem将CA标志设置为true,其密钥用法允许证书签名.rootcert.pem使用以下V3扩展名签署证书foocert.pem:

X509v3 extensions:
    X509v3 Basic Constraints: 
        CA:FALSE
    X509v3 Key Usage: 
        Digital Signature, Non Repudiation, Key Encipherment
Run Code Online (Sandbox Code Playgroud)

foocert.pem将CA标志设置为false,其密钥用法不允许证书签名.但是,让我们说,foocert.pem签署了一个rougecert.pem.

形成foocert&roguecert的证书链:

cat foocert.pem roguecert.pem > roguechain.pem
Run Code Online (Sandbox Code Playgroud)

使用openssl验证进行验证.验证成功:

$ openssl verify  -CAfile rootcert.pem roguechain.pem 
roguechain.pem: OK
Run Code Online (Sandbox Code Playgroud)

使用x509_strict验证,仍然成功:

$ openssl verify -x509_strict -CAfile rootcert.pem badchain.pem 
badchain.pem: OK
Run Code Online (Sandbox Code Playgroud)

假设系统只信任根CA证书.对等体提供其证书链,其中一个中间证书不应该是CA(CA设置为false并且密钥用法不允许证书签名),仍然openssl标记链是好的吗?

我如何让openssl不信任这样的链?

verification openssl certificate

8
推荐指数
3
解决办法
8721
查看次数

标签 统计

certificate ×1

openssl ×1

verification ×1