Re: [Cbor] What's your opinion of using CDDL to simultaneously define CBOR and JSON?

Laurence Lundblade <lgl@island-resort.com> Wed, 08 September 2021 19:05 UTC

Return-Path: <lgl@island-resort.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9A6183A3309 for <cbor@ietfa.amsl.com>; Wed, 8 Sep 2021 12:05:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ishtvxwki0EL for <cbor@ietfa.amsl.com>; Wed, 8 Sep 2021 12:05:34 -0700 (PDT)
Received: from p3plsmtpa07-10.prod.phx3.secureserver.net (p3plsmtpa07-10.prod.phx3.secureserver.net [173.201.192.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4D0AA3A3300 for <cbor@ietf.org>; Wed, 8 Sep 2021 12:05:34 -0700 (PDT)
Received: from [192.168.1.3] ([75.80.148.243]) by :SMTPAUTH: with ESMTPSA id O2t3m4EpHTJ8VO2t3m5UAt; Wed, 08 Sep 2021 12:05:33 -0700
X-CMAE-Analysis: v=2.4 cv=eIjWMFl1 c=1 sm=1 tr=0 ts=6139097d a=VPU1mRQhDhA4uSX60JRRww==:117 a=VPU1mRQhDhA4uSX60JRRww==:17 a=48vgC7mUAAAA:8 a=U9YQAQB-PmrJyhV5AjMA:9 a=QEXdDO2ut3YA:10 a=mPqY2FlVzv4rTBL7qewA:9 a=RLyOrqhBwisoi-Yf:21 a=_W_S_7VecoQA:10 a=w1C3t2QeGrPiZgrLijVG:22
X-SECURESERVER-ACCT: lgl@island-resort.com
From: Laurence Lundblade <lgl@island-resort.com>
Message-Id: <4BD93D61-1668-4AE8-B59B-ABC2D3F5C455@island-resort.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_56092726-F681-4CD6-A0D3-AB0760D42F04"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\))
Date: Wed, 08 Sep 2021 12:05:33 -0700
In-Reply-To: <0d4b6a9a-dc26-ee31-725b-3689dfdce041@sit.fraunhofer.de>
Cc: cbor@ietf.org
To: Henk Birkholz <henk.birkholz@sit.fraunhofer.de>
References: <51537C68-F495-4750-9376-A637BD0E78DD@island-resort.com> <0d4b6a9a-dc26-ee31-725b-3689dfdce041@sit.fraunhofer.de>
X-Mailer: Apple Mail (2.3608.120.23.2.1)
X-CMAE-Envelope: MS4xfGg9uBjSARAMF8aobmhqLgRN2KG7x6TXY+I+o0bc6WAAuJdWGzA7Nb8WFqDCsU4g+XaGEPKlt/6V/LPaGGf6x0TiTbJZY/q3Wj6CC0oDdMyg7ZxoVVlM xo7zlpVxDPk0P40GfRYVp7grhQIugvlbhZ2s32vUn7TV2dPGB3Bmy+GMJ734YMXy/RUoInZscYJy0RlSujuYdVQ0qfCWXFC6a/+x/fzEJcUVXVZjrd3k0Xxx
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/tVh94xY-MsQgw9-nk_l019IKuWc>
Subject: Re: [Cbor] What's your opinion of using CDDL to simultaneously define CBOR and JSON?
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 08 Sep 2021 19:05:40 -0000

Hi Henk,

I don’t mean this to be a loaded question. I really do want to hear what people have to say about this even if it is negative. 

As far as I know, no I-D or standard has defined a protocol solely, directly, and abstractly in CDDL such that it simultaneously specifies CBOR, JSON and other encoding except EAT.

Thanks for the SenML reference. It mostly answers my question. It is a standards track document that specifies a protocol that is to be encoded in CBOR, JSON, XML and EXI. That means a lot of people think it is a good idea to define protocols with multiple encodings and it went through a last call and IESG review.

However, it doesn’t entirely answer the question, because the primary definition of SenML is in prose, not in CDDL. For EAT, the primary definition of the protocol is in CDDL. There is no prose that says what the CDDL says in many cases. 

Note also that while the CDDL RFC does mention use with JSON (https://datatracker.ietf.org/doc/html/rfc8610#appendix-E), it doesn’t quite say that it is for the simultaneous definition of CBOR and JSON.

I’ll ask my CWT/JWT question another way.  What if we had some brand new protocol to define and wanted it to encode in CBOR and JSON, would we use CDDL as the primary expression of it?

Another way to ask this is to ask why SenML didn’t use CDDL as the primary representation. What is some limits in CDDL? Was it easier to do in prose? Lack of a convention to go from CDDl to XML? Didn’t think of it at the time?

The other answer I’m getting is here is the lack of anyone saying “Laurence, you dummy, didn’t you know about the xxx problem with doing that?” :-)

LL



> On Sep 7, 2021, at 1:16 PM, Henk Birkholz <henk.birkholz@sit.fraunhofer.de> wrote:
> 
> Hi Laurence,
> 
>> If we set out to define JWT plus CWT today from scratch, would we use CDDL?
> 
> that reads a bit like a loaded question. While CDDL can do what is intended to do (e.g., https://datatracker.ietf.org/doc/html/rfc8428#section-11), I am not sure what that has to do with defining "JWT plus CWT today from scratch". Could you elaborate on your motivation a little bit (excluding the can of worms that is the association with YANG modeled data and ASN.1 modeled data very deliberately for now).
> 
> Viele Grüße,
> 
> Henk
> 
> 
> On 07.09.21 19:45, Laurence Lundblade wrote:
>> Right now, the EAT draft is using CDDL to simultaneously define the EAT protocol such that it can be encoded in either CBOR or JSON. This also gives transcoding of the protocol between CBOR and JSON which is useful at the Verifier. There is also some interest in expanding to ASN.1. That seems doable. Then maybe on to YANG, but that seems harder.
>> The goal here is NOT to be able to translate any arbitrary CBOR to/from any arbitrary JSON. It is just for the protocol messages defined by EAT.
>> Mostly this has been straight forward in EAT: base64 encoding of binary data and a few other little items. See here <https://datatracker.ietf.org/doc/html/draft-ietf-rats-eat#section-6.3>. That CBOR has tags and JSON doesn’t is the biggest mismatch and has to be compensated for in other ways.
>> I personally think this is working pretty well and is a good idea. The main text for each claim is described only in CDDL. A few little general rules, like b64 of binary data, say how to handle the encoding for JSON.
>> This kind of all started when CWT was created out of JWT, but that was all before CDDL. If we set out to define JWT plus CWT today from scratch, would we use CDDL?
>> Other comments?
>> Thx,
>> LL
>> _______________________________________________
>> CBOR mailing list
>> CBOR@ietf.org
>> https://www.ietf.org/mailman/listinfo/cbor
> 
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor