[Cbor] CDDL for CBOR+JSON, JC<> and CDDL tool

Laurence Lundblade <lgl@island-resort.com> Tue, 08 March 2022 17:59 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 0F48E3A067A for <cbor@ietfa.amsl.com>; Tue, 8 Mar 2022 09:59:07 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.906
X-Spam-Level:
X-Spam-Status: No, score=-1.906 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, 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 3myR5yStNISy for <cbor@ietfa.amsl.com>; Tue, 8 Mar 2022 09:59:05 -0800 (PST)
Received: from p3plsmtpa08-04.prod.phx3.secureserver.net (p3plsmtpa08-04.prod.phx3.secureserver.net [173.201.193.105]) (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 412E83A0657 for <cbor@ietf.org>; Tue, 8 Mar 2022 09:59:04 -0800 (PST)
Received: from [192.168.1.4] ([75.80.148.139]) by :SMTPAUTH: with ESMTPA id Re6ynym43zOrWRe6ynNxq9; Tue, 08 Mar 2022 10:59:04 -0700
X-CMAE-Analysis: v=2.4 cv=IszbzJzg c=1 sm=1 tr=0 ts=62279968 a=qS/Wyu6Nw1Yro6yF1S+Djg==:117 a=qS/Wyu6Nw1Yro6yF1S+Djg==:17 a=48vgC7mUAAAA:8 a=NEAV23lmAAAA:8 a=uDgndKlFUhH4xVEa_HgA:9 a=QEXdDO2ut3YA:10 a=0HkSP64zIfmhazx-: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=_25648FA9-4D95-4D75-817D-27F39E22DB3D"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\))
Message-Id: <2D99B5A6-5B19-4601-9BC3-D50FD1EFCDD4@island-resort.com>
Date: Tue, 08 Mar 2022 09:59:03 -0800
To: cbor@ietf.org
X-Mailer: Apple Mail (2.3445.104.17)
X-CMAE-Envelope: MS4xfABpsiLxPxuMzoBaBpndXJu5JRumpieD6n5oMEcsCn4fbykbd0bL3JvyqQWVELAcbLnVLtiXvakqmVdNFzy1uI4bKGPw2onErFTy696flcDaAfcZ4pf7 y/qQVcAJ0CIQ0CceMk9WwHNYEzQ6Y/gfyeY7sqwQlLN8+hAYvcydHTGXMbXju24jUlFi2/Q+UeuQXA==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/JFfhXMMxqIVwp6WDMrVZKqmDLOQ>
Subject: [Cbor] CDDL for CBOR+JSON, JC<> and CDDL tool
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, 08 Mar 2022 17:59:07 -0000

I’ve been playing with the CDDL in rats-uccs-02 <https://datatracker.ietf.org/doc/html/draft-ietf-rats-uccs-02#appendix-A> and the cddl tool hoping it to validate both JSON and CBOR format tokens.

It looks to me like the CDDL, in particular the JC<> generic, is a workable way to handle variances between JSON and CBOR serialization. For example, I think it works for integer labels vs string labels and for enumerated values.  See below.

Use of the JC<> generic is both simplifying and improving the CDDL for EAT.  Makes it easier to read. So it seems to be a good thing. (PR <https://github.com/ietf-rats-wg/eat/pull/173> here if interested)


However, the cddl tool doesn’t seem to be doing very well with JC<>:
 - It seems to generate only JSON when you say “cddl uccs.cddl generate”.
 - It can’t verify JSON that it itself has generated. From the error messages it seems like its trying to decode the JSON as if were CBOR

I would be happy if you could explicitly tell the cddl tool the serialization to work with is either JSON or CBOR. It seems to auto-detect now and get it wrong sometimes.

I don’t mean to complain about the cddl tool too much. It’s very nice that it can do what it does and I can work around the issues.


I am curious about other folks experience with JC<>. It seems to be a good thing to me.

LL


   iss-claim-label = JC<"iss", 1>


   JSON-ONLY<J> = J .feature "json"
   CBOR-ONLY<C> = C .feature "cbor"
   JC<J,C> = JSON-ONLY<J> / CBOR-ONLY<C>