Description
openedon Sep 14, 2023
RFC 8949 obsoletes RFC 7049, and the latter is what System.Formats.Cbor is built from.
The revised RFC changes, subtly, the sorting of map keys. The new RFC uses lexicographic sorting, as noted in section 4.2.1.
Section 4.2.3 goes on to say:
The core deterministic encoding requirements (Section 4.2.1) sort map keys in a different order from the one suggested by Section 3.9 of [RFC7049] (called "Canonical CBOR" there). Protocols that need to be compatible with the order specified in [RFC7049] can instead be specified in terms of this specification's "length-first core deterministic encoding requirements"
I would propose a new CborConformanceMode
called Rfc8949Deterministic
. The new RFC tries to avoid the word "canonical" and instead use "deterministic", which is reflected in the suggested mode's name.