Hi Steve et. al.

The situation is as you say.  However, RFC 7049 is deprecated.
To further clarify the situation, the CBOR WG is just about to publish a 
document where deterministic encoding is defined as in RFC 8949.
In the online reference implementation (https://cbor.me) by the principal 
architect of CBOR (Carsten Bormann), RFC 7049 map sorting is no longer 
supported.

There are of course some unmaintained CBOR implementations that stick to RFC 
7049.

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.

However, adding a COSE header for this doesn't hurt.

Thanx,
Anders

On 2026-11-12 02:06, Steven Mih wrote:
Amaury, Henk, Anders, all,

Thank you for the support and the pointers.


The -00 is deliberately CBOR-only. The problem is

narrow. With a COSE Hash Envelope (RFC 9995) over a CBOR preimage, a

verifier that holds the value but not the hashed bytes must re-encode

it exactly as the producer did. RFC 8949 defines more than one

deterministic encoding (Sections 4.2.1 and 4.2.3), and nothing in the

envelope says which one was used. The draft adds one protected-header

parameter that names it, plus a registry for CBOR deterministic

encodings. More detail below.


Encoder complexity isn't the issue. The verifier just needs to be told

which rule applies, instead of assuming it.


We appreciate the 10 minute slot and looking forward seeing you next week!

Best

Steven Mih


A minimal case: the map {100: 0, -1: 0}.


RFC 8949 4.2.1 (core deterministic): A2 18 64 00 20 00

RFC 8949 4.2.3 (length-first, RFC 7049): A2 20 00 18 64 00


Each satisfies its own named rule set, and their SHA-256 digests

differ (418c1467... vs 4e27c8fd...).


Python cbor2's canonical mode emits the second, Node cborg's

default emits the first. A verifier that re-encodes with the other

rule rejects a valid Hash Envelope, and nothing in the envelope

today says which rule the producer used.


On Wed, Nov 11, 2026 at 12:13 PM, Anders Rundgren <[email protected] 
<mailto:[email protected]>> wrote:

    On 2026-11-11 20:17, Henk Birkholz wrote:

        Hi Anders,

    Hi Henk,

        long time no reply!

        As we cannot predict the results of the CBOR subsets experiment
        (basically some unpredictable middle ground between a "framework protocol must require 
deterministic serialization" and "COSE imposes no serialization restrictions on it at 
all"), it seems prudent to install some safeguards close by; at least when the payload is 
actually some CBOR. How such safeguards could actually look like in the COSE space is for the COSE 
WG to decide - this is a start. The least we can do is to help CBOR now as best as we can.

    Let's backtrack a bit. My take on the matter started with RFC 8785 
(canonicalized JSON) [*]. Although working, current solutions using RFC 8785 
depend on external canonicalizer libraries.

    This led me into CBOR. Since a full-blown deterministic encoder for CBOR can be 
expressed with a mere 300 lines of pure JavaScript, this is hardly a show-stopper: 
https://github.com/cyberphone/simple-cbor-encoder.js/blob/main/cde.js 
<https://github.com/cyberphone/simple-cbor-encoder.js/blob/main/cde.js>

    However, my particular work-item (Embedded Signatures), also requires a "transform" to work. This 
has been mentioned as a potential hurdle, probably by comparing it with its TWO MAGNITUDES more complex cousin, 
XML DSig. The "transform" takes exactly one line to accomplish: Using a high-level CBOR JavaScript 
API: https://github.com/cyberphone/cbor-core/blob/main/internet-drafts/hmac.mjs#L55 
<https://github.com/cyberphone/cbor-core/blob/main/internet-drafts/hmac.mjs#L55> Using a low-level 
constrained system written in C: 
https://github.com/cyberphone/ultra-simple-csf-sample/blob/main/src/demo.c#L190 
<https://github.com/cyberphone/ultra-simple-csf-sample/blob/main/src/demo.c#L190>

    Exactly where this leaves the COSE WG, I don't know. It's your call!

    Regards,
    Anders

    *] now even adopted by the W3C: 
https://www.w3.org/TR/vc-data-integrity/#canonicalization-method-privacy 
<https://www.w3.org/TR/vc-data-integrity/#canonicalization-method-privacy>

        Viele Grüße,

        Henk

        On 11.11.2026 19:40, Anders Rundgren wrote:

            On 2026-11-11 17:45, Amaury Chamayou wrote:

                It would be great to see this on the agenda, there's no 
explicit way to signal deterministic encoding of COSE payloads when they are 
captured by digest at the moment. For applications where the data is already 
available in other formats and can be materialised quickly, it would be useful!

            Hi WG,

            It was cool to see that I'm not alone combining cryptographic 
operations with Deterministically Encoded CBOR!
            The basics: https://www.ietf.org/archive/id/draft-rundgren-cbor- 
<https://www.ietf.org/archive/id/draft-rundgren-cbor-> 
core-25.html#name-embedded-signatures

            Advanced example including encryption: https://cyberphone.github.io/doc/ 
<https://cyberphone.github.io/doc/> 
defensive-publications/partial-encryption-full-signature.pdf

            Anders
            Online signature service: https://test.webpki.org/csf-lab/home 
<https://test.webpki.org/csf-lab/home>

                Amaury

                
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                *From:*  Steven Mih <[email protected] 
<mailto:[email protected]>>
                *Sent:* 29 October 2026 07:03
                *To:* [email protected] <mailto:[email protected]> <[email protected] 
<mailto:[email protected]>>
                *Cc:* [email protected] <mailto:[email protected]> 
<[email protected] <mailto:[email protected]>>; Anton Sokolov
                <[email protected] 
<mailto:[email protected]>>; Amaury Chamayou
                <[email protected] 
<mailto:[email protected]>>; Henk Birkholz
                <[email protected] 
<mailto:[email protected]>>; Dick Brooks
                <[email protected] 
<mailto:[email protected]>>
                *Subject:* [EXTERNAL] Agenda request for IETF 127: 
draft-mih-sokolov- cose-deterministic-encodings-00

                |Mike, Ivo, all, We posted draft-mih-sokolov-cose-deterministic- encodings-00: 
https://datatracker.ietf.org/doc/draft-mih-sokolov-cose- 
<https://datatracker.ietf.org/doc/draft-mih-sokolov-cose-> deterministic-encodings/ 
<https://datatracker.ietf.org/doc/draft-mih- 
<https://datatracker.ietf.org/doc/draft-mih-> sokolov-cose-deterministic-encodings/> A 
COSE Hash Envelope (RFC 9995) signs the digest of a preimage, so a verifier that holds the value 
but not the bytes that were hashed has to re-encode it exactly as the producer did. RFC 8949 
describes more than one deterministic encoding
                (Sections 4.2.1 and 4.2.3), and the preimage content type (259) 
does not say which one was applied. The draft adds a protected-header parameter, 
deterministic-encodings, that identifies the encoding, and an IANA registry whose 
first entry is RFC 8949 Core Deterministic Encoding Requirements 
(core-deterministic). Agenda request for IETF 127: - Presenters: Steven Mih & 
Anton Sokolov (both in-person) - Topic: Deterministic Encodings for COSE - Draft: 
draft-mih-sokolov- cose-deterministic-encodings-00 - Time: 10 minutes Comments on 
the list are welcome before then.|

                Steven Mih

                _______________________________________________
                COSE mailing list -- [email protected] <mailto:[email protected]>
                To unsubscribe send an email to [email protected] 
<mailto:[email protected]>

            _______________________________________________
            COSE mailing list -- [email protected] <mailto:[email protected]>
            To unsubscribe send an email to [email protected] 
<mailto:[email protected]>



_______________________________________________
COSE mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to