大网数据广告活动
服务器运维问答

Cross-signed (Let's Encrypt) SSL chain validation

· 52CE 我爱测

Note: I spent like 30 minutes writing/formulating this question, and it turned out into a rubber ducking session. Realised what I was doing wrong, but posting this anyway as it might by useful for other people as well. For contex…

问题原文

原帖链接 · Tom Cannaerts · CC BY-SA 4.0

Note: I spent like 30 minutes writing/formulating this question, and it turned out into a rubber ducking session. Realised what I was doing wrong, but posting this anyway as it might by useful for other people as well.

For context, I work with SSL certificates on a daily base and considder myself having a rather good understanding of how they work (or at least I though so :p ). I'm currently writing a script to monitor/test SSL chain issues of websites we host, but I'm having trouble matching the chain to a root certificate. Specifically Let's Encrypt certificates with the cross-signed certificates. If I follow the chain, it takes this path:

Subject: mywebsite.tld
Issuer: /C=US/O=Let's Encrypt/CN=E1

Subject: /C=US/O=Let's Encrypt/CN=E1
Serial: B3BDDFF8A7845BBCE903A04135B34A45
Issuer: /C=US/O=Internet Security Research Group/CN=ISRG Root X2

Subject: /C=US/O=Internet Security Research Group/CN=ISRG Root X2
Serial: 079E492886376FD40848C23FC631E463
Issuer: /C=US/O=Internet Security Research Group/CN=ISRG Root X1

Subject: /C=US/O=Internet Security Research Group/CN=ISRG Root X1
Serial: 4001772137D4E942B8EE76AA3C640AB7
Issuer: /O=Digital Signature Trust Co./CN=DST Root CA X3

So pretty much the expected path as documented on the LE website.

However, my system (using the mozilla ca certificates https://wiki.mozilla.org/CA/Included_Certificates) , does not trust DST Root CA X3. It does however trust both an ISRG X2 and ISRG X1 certificates. But the certificates in that store are not the cross-signed certificates used in the above chain, but instead are the self-signed certificates.

Subject: /C=US, O=Internet Security Research Group, CN=ISRG Root X2
Serial: 41D29DD172EAEEA780C12C6CE92F8752
Issuer: /C=US, O=Internet Security Research Group, CN=ISRG Root X2

Subject: /C=US/O=Internet Security Research Group/CN=ISRG Root X1
Serial: 8210CFB0D240E3594463E0BB63828B00
Issuer: /C=US/O=Internet Security Research Group/CN=ISRG Root X1

So how does my computer/browser actually do the matching, if not by following the chain and checking if that certificate matches the trusted store? In my logic, the E1, X2 and X1 certificates refered to in the chain of the website are intermediates that point to an untrusted root, rather than root certificates themselves. So what am I not seeing?

已采纳解答

原帖链接 · Tom Cannaerts · CC BY-SA 4.0

So to anwser my own question, the matching between a certificate and a trusted root certificate isn't done on a certificate level, but on the key that was used to create (not sign) the certificate.

In this case, both the cross-signed as the self-signed ISRG Root X2 certificates have been created from the same key with subject key identifier 7C:42:96:AE:DE:4B:48:3B:FA:92:F8:9E:8C:CF:6D:8B:A9:72:37:95. The Let's Encrypt E1 certificate does not point to a specific issuer certificate, but rather to a certificate with that specific name, and that is issued by a specific key. The system will search the trusted store to see if it contains a certificate with that name and that key. Since the self-signed certificate has the same name, and it is created with the same key, it can be chained to the E1 certificate and thus a link is made to a trusted root certificate.

If the trust can't be established, the process continues with the chain that is sent by the server and the same check will be done for the X1 certificate. This repeats until either a matching certificate is found in the trusted store, or until there are no more certificates in the chain (at which point the validation fails)

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2023-01-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。