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

Laurence Lundblade <lgl@island-resort.com> Tue, 07 September 2021 17:45 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 1D7283A0837 for <cbor@ietfa.amsl.com>; Tue, 7 Sep 2021 10:45:26 -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 88IROBgNgitO for <cbor@ietfa.amsl.com>; Tue, 7 Sep 2021 10:45:21 -0700 (PDT)
Received: from p3plsmtpa07-02.prod.phx3.secureserver.net (p3plsmtpa07-02.prod.phx3.secureserver.net [173.201.192.231]) (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 1723B3A0831 for <cbor@ietf.org>; Tue, 7 Sep 2021 10:45:21 -0700 (PDT)
Received: from [192.168.1.3] ([75.80.148.243]) by :SMTPAUTH: with ESMTPSA id Nf9sm5AoaTm4nNf9smHUO1; Tue, 07 Sep 2021 10:45:20 -0700
X-CMAE-Analysis: v=2.4 cv=K4bnowaI c=1 sm=1 tr=0 ts=6137a530 a=VPU1mRQhDhA4uSX60JRRww==:117 a=VPU1mRQhDhA4uSX60JRRww==:17 a=48vgC7mUAAAA:8 a=dMqLbz_MZFCRIxCxhpoA:9 a=QEXdDO2ut3YA:10 a=msuQUs5773bqrR9_u4MA:9 a=OOZgSlhwgAfs43jR:21 a=_W_S_7VecoQA:10 a=w1C3t2QeGrPiZgrLijVG:22
X-SECURESERVER-ACCT: lgl@island-resort.com
From: Laurence Lundblade <lgl@island-resort.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_A4D34CA7-AEDF-47EA-8825-A6CE88AE05C2"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\))
Message-Id: <51537C68-F495-4750-9376-A637BD0E78DD@island-resort.com>
Date: Tue, 07 Sep 2021 10:45:19 -0700
To: cbor@ietf.org
X-Mailer: Apple Mail (2.3608.120.23.2.1)
X-CMAE-Envelope: MS4xfGwKb/LDgIU4/Px/jHxkArkm/QWvQLvFzGnSm3M2mi6Ns6uxw7dZG6q5irJ+Py1w3EFHxKmRIKFpL/LmA6XTU+zVpT3OtrEP+cxwPIJOjZo1A53Bqgxw 9W7GovLE2PPZEp0Pgqz2JKZ9yfh9C5rTPUWr49tgs3qMiEAjBbMvk1yGYZNcKF/yPH+PgkJzcvh5LA==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/bDK1GhdsI5lGtAol0DUsB4bfhIU>
Subject: [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: Tue, 07 Sep 2021 17:45:27 -0000

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