Skip to content

Conversation

@leifj
Copy link
Contributor

@leifj leifj commented Jan 2, 2026

…r W3C spec

This commit fixes ECDSA-SD-2023 BASE proof verification for real-world credentials (such as Singapore Academy of Law eApostille) by implementing W3C VC-DI-ECDSA spec Section 3.4.11 createInitialSelection correctly.

The Problem:

  • SAL eApostille credentials failed verification despite W3C test vectors (59/59) passing
  • Root cause: mandatory hash mismatch between Go and reference implementation (Digital Bazaar di-sd-primitives)

The Fix:
Per W3C spec Section 3.4.11: 'The selection MUST include all types in the path of any JSON Pointer, including any root document type.'

Changes:

  • sd_helpers.go: Updated selectMandatoryNQuads to track container paths and include root document rdf:type quads when any pointer touches the root
  • sd_helpers.go: Added helper functions parseJSONPointer, getValueAtPointer, parseEphemeralPublicKey, ellipticMarshalCompressed, applyHMACLabelReplacement
  • sd_suite.go: Updated verifyBaseProof to use the fixed mandatory selection logic and properly validate BASE proofs

Test Results:

  • All 24 ECDSA tests pass (go test -tags vc20 ./pkg/vc20/crypto/ecdsa/)
  • SAL eApostille verification now succeeds
  • W3C test vectors continue to pass (59/59)

leifj added 2 commits January 2, 2026 17:55
…r W3C spec

This commit fixes ECDSA-SD-2023 BASE proof verification for real-world
credentials (such as Singapore Academy of Law eApostille) by implementing
W3C VC-DI-ECDSA spec Section 3.4.11 createInitialSelection correctly.

The Problem:
- SAL eApostille credentials failed verification despite W3C test vectors
  (59/59) passing
- Root cause: mandatory hash mismatch between Go and reference implementation
  (Digital Bazaar di-sd-primitives)

The Fix:
Per W3C spec Section 3.4.11: 'The selection MUST include all types in the
path of any JSON Pointer, including any root document type.'

Changes:
- sd_helpers.go: Updated selectMandatoryNQuads to track container paths and
  include root document rdf:type quads when any pointer touches the root
- sd_helpers.go: Added helper functions parseJSONPointer, getValueAtPointer,
  parseEphemeralPublicKey, ellipticMarshalCompressed, applyHMACLabelReplacement
- sd_suite.go: Updated verifyBaseProof to use the fixed mandatory selection
  logic and properly validate BASE proofs

Test Results:
- All 24 ECDSA tests pass (go test -tags vc20 ./pkg/vc20/crypto/ecdsa/)
- SAL eApostille verification now succeeds
- W3C test vectors continue to pass (59/59)
ADR-10: Mandatory N-Quad selection must include type quads per W3C spec 3.4.11
ADR-11: Real-world test vectors required beyond W3C conformance tests
ADR-12: Support both BASE and DERIVED proof verification
ADR-13: Align with Digital Bazaar reference implementation for interop
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.

1 participant