mdoc: tolerate legacy MSO payload and ValidityInfo date encodings#1641
Open
dmascord wants to merge 1 commit intoopenwallet-foundation:mainfrom
Open
mdoc: tolerate legacy MSO payload and ValidityInfo date encodings#1641dmascord wants to merge 1 commit intoopenwallet-foundation:mainfrom
dmascord wants to merge 1 commit intoopenwallet-foundation:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds controlled tolerance for two non-compliant but real-world MSO encoding patterns, guarded by
MdocCompatibilityOptions(defaults to strict).1. MSO payload wrapping tolerance (
MsoPayloadDecoder)Some issuers emit the MSO payload as a raw CBOR map rather than the spec-required encoded-CBOR byte string (tag 24 wrapped). A new
MsoPayloadDecoderutility accepts both forms and is used consistently acrossMdocCredential,MobileSecurityObjectParser,DeviceResponseParser, andMdocDocument.2. ValidityInfo timestamp tolerance (
allowLegacyMsoValidityTimestamps = falseby default)Some issuers emit
ValidityInfotimestamps as plaintstrvalues without the required CBOR tag 0 (tdate). WhenMdocCompatibilityOptions.allowLegacyMsoValidityTimestampsis explicitly set totrue, the parser accepts and logs these with a warning.The leniency is currently needed for interop with a specific deployment where the SITA issuer emits untagged timestamps for compatibility with the NEC verifier at Hong Kong International Airport (HKG). The flag is expected to be removed after 2026-07-01 once the NEC verifier is updated to accept canonical
tdate-tagged timestamps per ISO/IEC 18013-5 §9.1.2.Validation
Related
Extracted from #1564 per reviewer request to split into per-commit PRs.