Subject: [COSE] Help with RFC8152 encryption example

From: Anders Rundgren <[email-masked]>
Date: Mon, 10 May 2021 11:24:19 +0200

Hi COSE gurus,

I took this simple sample:
https://datatracker.ietf.org/doc/html/rfc8152#appendix-C.4.1

and adjusted it to fit Carsten's http://cbor.me/

16(
      [
         {
             1:10
          } ,
        {
           5:h'89f52f65a1c580933b5261a78c'
        },
         h'5974e1b99a3a4cc09a659aa2e9e7fff161d38ce71cb45ce460ffb569'
      ]

It returns 51 bytes but the RFC says 52 bytes.

What am I doing wrong?

Thanx,
Anders

---

From: Carsten Bormann <[email-masked]>
Date: Mon, 10 May 2021 12:35:16 +0200

Hi Anders,

> On 10. May 2021, at 11:24, Anders Rundgren <[email-masked]> wrote:

The example in the RFC is (comments removed)

16([h'A1010A', {5: h'89F52F65A1C580933B5261A78C'}, h'5974E1B99A3A4CC09A659AA2E9E7FFF161D38CE71CB45CE460FFB569’])

Or, if you enable cbor.me to show embedded CBOR [1],

16([<< {1: 10} >>, {5: h'89F52F65A1C580933B5261A78C'}, h'5974E1B99A3A4CC09A659AA2E9E7FFF161D38CE71CB45CE460FFB569’])

http://cbor.me/?bytes=D0(83(43(A1010A)-A1(05-4D(89F52F65A1C580933B5261A78C))-58.1C(5974E1B99A3A4CC09A659AA2E9E7FFF161D38CE71CB45CE460FFB569)))

Your example however is missing the 43 byte: The map {1:10} needs to be, CBOR encoded, kept in a byte string.

Grüße, Carsten

[1]: https://datatracker.ietf.org/doc/html/rfc8610#appendix-G.3

---

From: Anders Rundgren <[email-masked]>
Date: Mon, 10 May 2021 13:59:06 +0200

Wunderbar!

I obviously have a few things to learn about CDDL ;)

Regards,
Anders

On 2021-05-10 12:35, Carsten Bormann wrote:
> _______________________________________________
> COSE mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/cose
>

---

From: Carsten Bormann <[email-masked]>
Date: Mon, 10 May 2021 16:36:05 +0200

> I obviously have a few things to learn about CDDL ;)

That is always good, but the example was in CBOR Diagnostic Notation, which is almost but not entirely unlike CDDL…
(CBOR Extended Diagnostic Notation (EDN) is defined in the CDDL RFC 8610. 
Economies of process…
But 8152 predates that document, so it uses basic DN, which doesn’t have <</>> yet, which is part of the problem you had.)

Grüße, Carsten

---

From: Carsten Bormann <[email-masked]>
Date: Mon, 10 May 2021 17:03:08 +0200

> But 8152 predates that document, so it uses basic DN, which doesn’t have <</>> yet, which is part of the problem you had.)

… and I should have added that this is fixed in draft-ietf-cose-rfc8152bis-struct-15, which is really what you should be using anyway.

BTW, it’s in the RFC editor queue, but I don’t understand its status:
https://www.rfc-editor.org/cluster_info.php?cid=C416

Grüße, Carsten

---

From: Benjamin Kaduk <[email-masked]>
Date: Thu, 13 May 2021 21:00:17 -0700

> https://www.rfc-editor.org/cluster_info.php?cid=C416

Interestingly, a few hours after your note, all three transitioned from
"REF*R" to "RFC-EDITOR*R", which is only slightly less confusing...

(I would have assumed that their systems have loop detection if the REF
state was just from mutual dependencies...)

-Ben