Skip to content

Fix trust anchor matching for cross-signed certificates#175

Open
BernhardK91 wants to merge 1 commit into
holodeck-b2b:masterfrom
BernhardK91:fix-cross-signed-cert-trust-anchor
Open

Fix trust anchor matching for cross-signed certificates#175
BernhardK91 wants to merge 1 commit into
holodeck-b2b:masterfrom
BernhardK91:fix-cross-signed-cert-trust-anchor

Conversation

@BernhardK91

Copy link
Copy Markdown

When a TLS server includes a cross-signed root CA certificate in the chain (e.g. GTS Root R4 signed by GlobalSign), the current exact byte comparison via .equals() fails to match it against the self-signed version in the truststore. Both certificates represent the same CA with the same subject and public key, but have different issuers and signatures.

This causes "Trust anchor for certification path not found" errors for servers that include cross-signed root certificates in their TLS chain, which is common with Google Trust Services certificates.

The fix matches trust anchors by subject DN + public key instead of exact certificate equality, consistent with RFC 5280 trust anchor identification.

When a TLS server sends a cross-signed root CA certificate in the
chain (e.g. GTS Root R4 signed by GlobalSign), the previous exact
byte comparison via .equals() fails to match it against the
self-signed version in the truststore, even though both certificates
represent the same CA with the same subject and public key.

This causes "Trust anchor for certification path not found" errors
for servers that include cross-signed root certificates in their
TLS chain, which is common with Google Trust Services certificates.

Match trust anchors by subject DN + public key instead of exact
certificate equality, consistent with RFC 5280 trust anchor
identification.
@sfieten

sfieten commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

Hi @BernhardK91,
we have detected more issues in the certificate path building, like out-of-order certificates. Therefore I have refactored this part of the certificate validation to use the Bouncy Castle CertPathBuilder to construct the path. This should also resolve the issue with the cross-signed certs. The refactored version is available in the next branch. Please check if this indeed solves this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants