Skip to content

Wire CryptoExt into WhitelistRegistry for brainpool-curve support - #153

Merged
leifj merged 1 commit into
mainfrom
fix/whitelist-brainpool-cryptoext
Aug 31, 2026
Merged

leifj merged 1 commit into
mainfrom
fix/whitelist-brainpool-cryptoext

Conversation

@leifj

@leifj leifj commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • additional_trusted_roots was parsed via x509.CertPool.AppendCertsFromPEM directly, which can't handle curves stdlib crypto/x509 doesn't recognize (e.g. brainpoolP256r1, used by real ISO 18013-5/eIDAS reader-CA roots) — confirmed live against the Geneva 2026 interop event's OpenID4VP verifier root.
  • Worse, one such root failed the entire registry's CA pool construction, denying every other whitelisted verifier too, not just the one with the unsupported root.
  • WhitelistRegistry now accepts a CryptoExt (WithWhitelistCryptoExt), using the same registry.ParseCertificatesPEM helper mdocrical/vical/etc. already use, and both CLI construction paths in cmd/gt/main.go wire it up.

Test plan

  • go test ./pkg/registry/static/... — full suite green, including new regression tests using the real Geneva root, both with and without CryptoExt wired
  • go build ./... / go vet ./... clean
  • Confirmed live: this exact root previously produced system CA pool unavailable: additional_trusted_roots[N]: failed to parse PEM certificate and denied trust for verifier.multipaz.org too

🤖 Generated with Claude Code

additional_trusted_roots was parsed via x509.CertPool.AppendCertsFromPEM
directly, which can't handle curves stdlib crypto/x509 doesn't
recognize (e.g. brainpoolP256r1, used by real ISO 18013-5/eIDAS reader-
CA roots - confirmed live against the Geneva 2026 interop event's
OpenID4VP verifier root). Worse, one such root failed the *entire*
registry's CA pool construction, denying every other whitelisted
verifier too, not just the one with the unsupported root.

WhitelistRegistry now accepts a CryptoExt (WithWhitelistCryptoExt),
using the same registry.ParseCertificatesPEM helper mdocrical/vical/
etc. already use, and both CLI construction paths in cmd/gt/main.go
wire it up. Regression tests added using the real Geneva root, both
with and without CryptoExt wired, to lock in the fix and document the
original failure mode.
Copilot AI lite review requested due to automatic review settings August 31, 2026 00:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR wires go-cryptoutil CryptoExt support into static.WhitelistRegistry so additional_trusted_roots can be parsed even when certificates use curves unsupported by Go’s stdlib crypto/x509 (e.g., brainpool), and updates the CLI construction paths accordingly. This improves interoperability with real-world ISO 18013-5/eIDAS ecosystems and avoids failing registry CA pool construction due to unsupported-curve roots when CryptoExt is configured.

Changes:

  • Add WithWhitelistCryptoExt option and store cryptoExt in WhitelistRegistry for CryptoExt-aware parsing of AdditionalTrustedRoots.
  • Switch CA pool augmentation from x509.CertPool.AppendCertsFromPEM to registry.ParseCertificatesPEM(..., cryptoExt) + AddCert.
  • Add regression tests using a real brainpool-based root and wire CryptoExt in cmd/gt/main.go whitelist registry setup paths.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/registry/static/whitelist.go Adds CryptoExt plumbing to parse additional trusted roots with non-stdlib curve support.
pkg/registry/static/whitelist_test.go Adds regression coverage for brainpool-root behavior with/without CryptoExt.
cmd/gt/main.go Wires a shared CryptoExt (with brainpool registered) into whitelist registry construction paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +711 to 715
certs, err := registry.ParseCertificatesPEM([]byte(pemCert), r.cryptoExt)
if err != nil || len(certs) == 0 {
r.systemCertPoolErr = fmt.Errorf("additional_trusted_roots[%d]: failed to parse PEM certificate", i)
return
}
@sonarqubecloud

Copy link
Copy Markdown

@leifj
leifj merged commit acd10f8 into main Aug 31, 2026
16 checks passed
@leifj
leifj deleted the fix/whitelist-brainpool-cryptoext branch August 31, 2026 00:59
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