Re: [Cbor] Getting diagnostic notation examples in drafts under control
Wolf McNally <wolf@wolfmcnally.com> Tue, 27 February 2024 00:17 UTC
Return-Path: <wolf@wolfmcnally.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 00503C151996 for <cbor@ietfa.amsl.com>; Mon, 26 Feb 2024 16:17:12 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.905
X-Spam-Level:
X-Spam-Status: No, score=-1.905 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=wolfmcnally-com.20230601.gappssmtp.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AEjRXyrJY08Y for <cbor@ietfa.amsl.com>; Mon, 26 Feb 2024 16:17:09 -0800 (PST)
Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 96C21C15170B for <cbor@ietf.org>; Mon, 26 Feb 2024 16:17:09 -0800 (PST)
Received: by mail-ot1-x334.google.com with SMTP id 46e09a7af769-6e49a5b1bbfso1112124a34.3 for <cbor@ietf.org>; Mon, 26 Feb 2024 16:17:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfmcnally-com.20230601.gappssmtp.com; s=20230601; t=1708993028; x=1709597828; darn=ietf.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dhPchSRedCEX7WqytwNe3ESM3c5921ZU0z/N5BIqsdQ=; b=vQ0ipQafCuan1XyytZNz5CsLCuivm5O6FAT3p9H/zwkIdnRd3/+/kFZr2tGSJFNOOH P4Wqf6GRUvRF4FBkTZCCUtYr5m/b31RS6rbtH2zJA5u3Aag+SHUwYaWYocvJuzU3Nquf oEv9ieU4vR+q/sgPQ05KDQvyO+6O8xZ6lK20XLHpC68MTrc/OklLJHBWS/QiJsiNOrbM cZAjAX0ZuoL68PFOIm6mH3Y/JoLdz+z0MBjYAQgtRHEE0/jfXTv0N+yJlQtjglvFz5iV 91zDDJy6n/eOul0WB0xBfWXyaF0uHqSbWsJQv3vi/hSKmvM8o1kQHEEK4pWCwevyhQH4 F5jA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708993028; x=1709597828; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dhPchSRedCEX7WqytwNe3ESM3c5921ZU0z/N5BIqsdQ=; b=gmvKy9CPxFwL7AB18CuWmqYFcaHAbONqL5XBDSZiNr2hA3xUV1k8FjVPEDd7RDsSlQ XMMNQvnzG0BP8t9lYy5EnHCKrqRZB9fKlUK0JGoaLnQ9LUmCketRG9zwSoDgKaHLMKyM +FC9UgF/jC17WSXnwyvIZE8M11r0DRy479ryGW/l0M2d2dIQKTIqLmqDOedaHoxmOjpS yTYDRc8YYdW67zOME9z54K3I1bFmhPRQp+tpz2R3KWgJqv04osbFjFNBtt4Nb60xWiVX MvP0mWC48hw3MXl9w4iCfWW++n+kWTDZ3kzNZynzVKHjGqusDQhK6UemsI+YVVxAzj6s JBmw==
X-Gm-Message-State: AOJu0YxOUlpUrSzfRqaC+FJbbDuLemGsT1mHDnRLZst4otU6adCxZMdd 93/2BuyxTwuou7OKL8XMO0V1sdVpwvFsBUhaTRCKX8JT7V+AlqmkOdKuxM/q7XOB1Xl8GX0jCdN 4
X-Google-Smtp-Source: AGHT+IF9VJ2gZRmio8HbfMFRILFu9L3r9JJ3DTyhCXvEZDoE8NLLwZOppMOH4mGowBS/Tn72gySuoA==
X-Received: by 2002:a05:6358:6f0c:b0:17b:b532:80be with SMTP id r12-20020a0563586f0c00b0017bb53280bemr2814623rwn.25.1708993028596; Mon, 26 Feb 2024 16:17:08 -0800 (PST)
Received: from smtpclient.apple (ip70-180-193-108.lv.lv.cox.net. [70.180.193.108]) by smtp.gmail.com with ESMTPSA id t30-20020a62d15e000000b006e375ac0d8dsm4842151pfl.138.2024.02.26.16.17.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2024 16:17:08 -0800 (PST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.400.31\))
From: Wolf McNally <wolf@wolfmcnally.com>
In-Reply-To: <FD64709D-2B97-4DED-9915-331FE7188EE8@tzi.org>
Date: Mon, 26 Feb 2024 16:16:56 -0800
Cc: cbor@ietf.org
Content-Transfer-Encoding: quoted-printable
Message-Id: <97D9FAA8-5EEC-4AA8-8307-96BD1A5884BC@wolfmcnally.com>
References: <FD64709D-2B97-4DED-9915-331FE7188EE8@tzi.org>
To: Carsten Bormann <cabo@tzi.org>
X-Mailer: Apple Mail (2.3774.400.31)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/_YnPNrQWswFymj9dvzq1atNmlNM>
Subject: Re: [Cbor] Getting diagnostic notation examples in drafts under control
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
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, 27 Feb 2024 00:17:12 -0000
Carsten, I was wondering about the right way to declare CBOR tag values in a single place and then use them as symbols throughout the rest of my CDDL. For example, something like: ```cddl tag-my-struct = #6.123456 ; … my-struct = tag-my-struct( bstr .size 32 ) ``` ~ Wolf > On Feb 26, 2024, at 12:31 PM, Carsten Bormann <cabo@tzi.org> wrote: > > In diagnostic notation examples used during development of a draft, > authors often use text strings for the constants they need, even > though they actually mean a placeholder for a later, to-be-registered > integer. > > I just reviewed draft-ietf-ace-oscore-gm-admin, where this is rampant: > > { > "group_mode" : true, > "gp_enc_alg" : 10, > "hkdf" : 5 > } > > All the map keys shown here that look like text strings are actually > intended to be integers (which at this point still need to be > assigned). > (There are also integers, without explanation what they mean.) > > This is a problem, as the examples are not machine-readable (well, > they are, but they mean the wrong thing in half of the places without > any warning that this is so). > > At IETF 118, I gave a brief concept presentation for an application > extension to CBOR diagnostic mode that I called e’’. > (The name `e` could stand for enum value, or external constant, etc. > You choose :-) > > I have implemented this now in the cbor-diag tools. > > First, you need a CDDL file (we’ll call gmadmin.cddl in our example) > that gives the actual values for the constants, as in: > > group_mode = 33 > gp_enc_alg = 34 > hkdf = 31 > HMAC-256-256 = 5 > AES-CCM-16-64-128 = 10 > > This can be a complete CDDL file, no need to limit it to constants. > You can set this up with your TBD values of the constants to be > assigned, and once they are, you only need to update them in one place. > > Then, you can write the diagnostic notation example in the draft like > this (let’s call this gmadmin.diag): > > { > e'group_mode' : true, > e'gp_enc_alg' : e'HMAC-256-256', > e'hkdf' : e'AES-CCM-16-64-128' > } > > The diag2x.rb tools can correctly read and interpret this; so for example > after setting > > export CBOR_DIAG_CDDL=gmadmin.cddl > > applying diag2diag.rb to gmadmin.diag spits out: > > $ diag2diag.rb -ae gmadmin.diag > {33: true, 34: 10, 31: 5} > > You need to enable the application extension `e` (-ae), which you can > install via: > > gem install cbor-diag-e cddlc > > (cbor-diag-e uses cddlc internally, so it must be in PATH.) > > The details of this little tool are certainly up for discussion, but it > really does work for me already. > > In the long run, this works best if edn-literal is approved (hint, > hint), and the `e''` extension is registered. > > Until then, each document using this scheme can simply use boilerplate > such as: > > In the CBOR diagnostic notation used in this document, constructs of > the form `e’somename'` are replaced by the value assigned to > `somename` in CDDL in figure 0815. > E.g., `{e'group_mode': "bar"}` stands for `{33: "bar"}`. > [Choose 0815, group_mode and 33 along the lines of the figure with the > CDDL included.] > > Should I write an Internet-Draft for this? > > Grüße, Carsten > > > _______________________________________________ > CBOR mailing list > CBOR@ietf.org > https://www.ietf.org/mailman/listinfo/cbor
- [Cbor] Getting diagnostic notation examples in dr… Carsten Bormann
- Re: [Cbor] Getting diagnostic notation examples i… Wolf McNally
- Re: [Cbor] Getting diagnostic notation examples i… Carsten Bormann
- Re: [Cbor] Getting diagnostic notation examples i… Carsten Bormann