Re: [Cbor] Tagging requirement

Laurence Lundblade <lgl@island-resort.com> Tue, 18 August 2020 19:39 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 0990C3A0AE2 for <cbor@ietfa.amsl.com>; Tue, 18 Aug 2020 12:39:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.894
X-Spam-Level:
X-Spam-Status: No, score=-1.894 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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 MggQL1bQ6bob for <cbor@ietfa.amsl.com>; Tue, 18 Aug 2020 12:39:53 -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 6B2CA3A0A2E for <cbor@ietf.org>; Tue, 18 Aug 2020 12:39:53 -0700 (PDT)
Received: from [192.168.1.49] ([76.167.193.86]) by :SMTPAUTH: with ESMTPA id 87SZkSSD4nJ6Y87SakOQ9V; Tue, 18 Aug 2020 12:39:52 -0700
X-CMAE-Analysis: v=2.3 cv=CMdUoijD c=1 sm=1 tr=0 a=t2DvPg6iSvRzsOFYbaV4uQ==:117 a=t2DvPg6iSvRzsOFYbaV4uQ==:17 a=gKmFwSsBAAAA:8 a=K6EGIJCdAAAA:8 a=y7ahmQfZmpKuHwsNqd4A:9 a=dStcDggSWP0pHJxe:21 a=DilzaZEiACOcxRui:21 a=QEXdDO2ut3YA:10 a=IXJhIi7PcXi8VagEURgA:9 a=Az6oztVmVF1LGvUA:21 a=_-yZ6xZlO5hdS9ib:21 a=D6ABdLweZOqYZM4z:21 a=_W_S_7VecoQA:10 a=nnPW6aIcBuj1ljLj_o6Q:22 a=L6pVIi0Kn1GYQfi8-iRI:22
X-SECURESERVER-ACCT: lgl@island-resort.com
From: Laurence Lundblade <lgl@island-resort.com>
Message-Id: <411B47FF-51D5-4D45-9637-FC078CAC9EB4@island-resort.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_128050FD-B2D0-4C72-8E75-ED9C81C39F13"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\))
Date: Tue, 18 Aug 2020 12:39:51 -0700
In-Reply-To: <7A845B58-9313-4B89-9A88-16A4E25A942B@tzi.org>
Cc: cbor@ietf.org
To: Carsten Bormann <cabo@tzi.org>
References: <5F695632-CF27-40FF-BC23-E731AAA95771@island-resort.com> <895A3DF8-DF11-479F-9DC6-9EF98465A7E0@tzi.org> <D8A304BA-897A-46D2-9B67-4FF458883478@island-resort.com> <1FC978C4-5EB5-42D9-B522-28D72FDCA5B9@tzi.org> <72CC1398-659B-4934-8851-50B8BB4752E1@island-resort.com> <7A845B58-9313-4B89-9A88-16A4E25A942B@tzi.org>
X-Mailer: Apple Mail (2.3608.80.23.2.2)
X-CMAE-Envelope: MS4wfEkruDivqXwUPZQzddeg1x9yfFo492lc7uXr6W8kFCz+nm/8W4611Igjuy3N049PdTDCReNAEPFXUIRTEAfDhpAkR2ZWbB62lE8LBB3ljLrLn5Vrc0dM N99E8VPTOkf578b+uy2MMwJ1AL46uhqIjOw90PU0tOWMHz5S9FsIXh7a6xAZPKWnjfkzJYeHL0f3yA==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/96sjK9oYHXdDLz27bBtapNGZOhI>
Subject: Re: [Cbor] Tagging requirement
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, 18 Aug 2020 19:39:55 -0000

I went through some of the registered tags and sorted them as to which has an independent definition and which do not. This really helps me get my head straight on this. Pointing out the parallel with maps and arrays is helpful too.

These have tag-independent definitions. If you want to put one of them into a CBOR item without a tag you just reference the independent definition. For example, "the first item in an array is a UUID”. 
  
 Date string — RFC 3339 and RFC 4287
 URI
 Regex
 B64, b64URL 
 MIME
 CWT
COSE_Untagged_Message (there is also COSE_Tagged_Message).


These don’t have tag-independent definitions. If you want to “borrow” the definition, you refer to the tag and then require it be unwrapped. For example, "the first item in the array is an unwrapped CBOR numeric date". Or, like CWT, you say it is a “CBOR numeric date modified to require the tag be omitted”. 

 Epoch Date
 Bignums
 Big float
 Decimal fraction
 Encoded CBOR

If you want the tag for either category above you say “the first item in the array is tag X”, The definition of tag X will tell you want the content is.


At this point, I think of tags more a typed content. 

LL




> On Aug 18, 2020, at 12:18 PM, Carsten Bormann <cabo@tzi.org> wrote:
> 
> On 2020-08-17, at 22:37, Laurence Lundblade <lgl@island-resort.com <mailto:lgl@island-resort.com>> wrote:
>> 
>> 
>> 
>>> On Aug 17, 2020, at 11:23 AM, Carsten Bormann <cabo@tzi.org> wrote:
>>> 
>>> On 2020-08-17, at 19:56, Laurence Lundblade <lgl@island-resort.com> wrote:
>>> 
>>>> with value 1 followed by the content which is a number.
>>> 
>>> Yes.
>>> 
>>>> Unless explicitly allowed, the type 6 integer and number content are inseparable. 
>>> 
>>> As long as you are talking about Tags, yes: Tags are a major-type 6 container.
>>> You can also borrow the definition of a Tag content data structure for an application protocol, but then you aren’t using a Tag, you are using the definition of a Tag content data structure (or “an unwrapped tag”, if you must say so).
>> 
>> What do you think about defining CBOR protocol items that can be either tag-contained or unwrapped?  In CDDL, “dualistic_bigfloat = bigfloat / ~bigfloat”. 
> 
> I think that this specific example is the OPTIONAL in your previous message that we would normally try to avoid.
> 
>> Making a distinction in the way CWT is defined and named from the way epoch date, bignum and such are defined is what clears it up for me.
> 
> Good.
> 
>> The definition of the CBOR structure for CWT is independent of the CWT tag. The CBOR structure for the CWT is defined first. Then the tag definition comes a long and says is contents is a CWT.
> 
> Right.  Does it even say that a CWT with a tag 61 around it is a CWT?
> 
> That is indeed some terminology thing we could try to normalize.
> 
>> For tags epoch date, bignum and such there is no independent definition of the contents. That content definite is wrapped up with the tag definition. If you want to use the content without a tag-container you have to unwrap it.
> 
> Indeed.
> 
>> That a tag is a “container” is really helpful to me.
> 
> We are not using this term in 7049bis.
> But if you look at Table 1, there are three (definite-length) major types that have data items in them: 4 (array), 5 (map), 6 (tag).
> (Table 2 then reveals that indefinite length strings are represented like containers, but that is not really their semantics.)
> 
>> Thanks for the discussion on this!
> 
> Certainly!
> 
> Grüße, Carsten