On 2026 Nov 12, at 07:08, Anders Rundgren <[email protected]> wrote: > > Hi Steve et. al. > > The situation is as you say. However, RFC 7049 is deprecated.
Translation into English: RFC 7049 Section 3.9 defined what it called “Canonical CBOR”, a serialization constraint that is a form of deterministic serialization. The “length-first” feature of that turned out to be surprising to implementers, so RFC 8949 (which obsoletes RFC 7049) defined an less surprising serialization constraint, which it calls "Core Deterministic Encoding Requirements” (Section 4.2.1). RFC 8949 but also retains the alternative "Length-First Map Key Ordering” (Section 4.2.3) for backwards compatibility, so you never need to reference the obsolete RFC 7049. The intention is that protocols that already opted for RFC 7049 Section 3.9 can continue to use the length-first principle unchanged by referencing Section 4.2.3 of RFC 8949. (Do not reference RFC 7049 any more; this is obsoleted by RFC 8949.) New protocols should go for Section 4.2.1. > To further clarify the situation, the CBOR WG is just about to publish a > document where deterministic encoding is defined as in RFC 8949. Well that would be great; we aren’t there yet. > In the online reference implementation (https://cbor.me) by the principal > architect of CBOR (Carsten Bormann), RFC 7049 map sorting is no longer > supported. Well, this is a playground, not exactly a reference implementation, and it doesn’t cover all nooks and crannies of serialization choices. I probably should add a checkmark to choose what Section 4.2.3 calls “Old Canonical CBOR” in an aside... > There are of course some unmaintained CBOR implementations that stick to RFC > 7049. As far as I can see, Python’s cbor2 is the main culprit here; I haven’t run into any other > The only issue I'm aware of is FIDO which still builds on RFC 7049. > However, they selected string keys that have the same map order as in RFC > 8949. Luck or foresight? I don't know. We considered FIDO when we introduced Section 4.2.1 map sorting: If your data model does not have maps with more than one entry, 4.2.1 and 4.2.3 are equivalent. (If you don’t have maps at all, as is the case with deployed FIDO, this is trivially true.) > However, adding a COSE header for this doesn't hurt. It can be designed to be confusing, in which case it *would* hurt. Note that Laurence’s draft expresses a preference for what is essentially Section 4.2.1 deterministic encoding, with unrelated data model subsetting thrown in. It tries to ignore the Section 4.2.3 constraints or other quite popular 4.2.1 variants such as always using binary64 for floating point values, going to the extreme of not even providing a registry for these variants. That will hurt in the long run, because these deterministic encodings are not going to go away simply by not talking about them. Recommendations: * The CBOR WG needs to get its act together and acknowledge that these other deterministic serialization constraint sets are out there and may need to be named; registries are the right way to do this. * The provenance draft should make a conscious decision to use Section 4.2.1 deterministic encoding, not the Section 4.2.3 length-first variant (“Old Canonical”). Grüße, Carsten _______________________________________________ COSE mailing list -- [email protected] To unsubscribe send an email to [email protected]
