Re: [Cbor] draft-ietf-cbor-tags-oid-00.txt

Sean Leonard <dev+ietf@seantek.com> Sun, 02 August 2020 06:24 UTC

Return-Path: <dev+ietf@seantek.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 9E6BB3A08EE for <cbor@ietfa.amsl.com>; Sat, 1 Aug 2020 23:24:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.947
X-Spam-Level:
X-Spam-Status: No, score=-0.947 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, NICE_REPLY_A=-0.949, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=mxes.net
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 H2tucUnDlxx5 for <cbor@ietfa.amsl.com>; Sat, 1 Aug 2020 23:24:23 -0700 (PDT)
Received: from smtp-out-3.mxes.net (smtp-out-3.mxes.net [198.205.123.68]) (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 7FD003A08E4 for <cbor@ietf.org>; Sat, 1 Aug 2020 23:24:23 -0700 (PDT)
Received: from Customer-MUA (mua.mxes.net [10.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id DD03E75967 for <cbor@ietf.org>; Sun, 2 Aug 2020 02:24:17 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mxes.net; s=mta; t=1596349461; bh=NdN450WOJ50AN63JOzdxHRZwG3PY3+Wy6x68vozrmww=; h=Subject:To:References:From:Date:In-Reply-To:From; b=uy4IVzCywz2RYdc0i6j9dIhzUJJzuAPxYXXr5svRznuumoUn3RcJonYe2Egbji8qv kgnZ0q6qB0ZvE+Gt7n5KJeSa4InHDoiAZdkBVabWmoEly6lTFSEcMeV/dhWBycPRYQ k2GiyaA8XDemTODAVr9KMzKC81+a3WZEg9SEdI94=
To: cbor@ietf.org
References: <87h7tmxnxq.fsf@hobgoblin.ariadne.com>
From: Sean Leonard <dev+ietf@seantek.com>
Message-ID: <72e2157f-3915-542d-3b1e-2ef89b972cfe@seantek.com>
Date: Sat, 01 Aug 2020 23:22:46 -0700
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <87h7tmxnxq.fsf@hobgoblin.ariadne.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Sent-To: <Y2JvckBpZXRmLm9yZw==>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/1OguBLcL21fvB1K-ZPYt1JwJIdE>
Subject: Re: [Cbor] draft-ietf-cbor-tags-oid-00.txt
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: Sun, 02 Aug 2020 06:24:26 -0000

On 8/1/2020 10:42 AM, Dale R. Worley wrote:
> Reading this (and having read an earlier version), I really like the
> concept because I have a fondness for OIDs and think they should be used
> to name everything.

Yep, me too. :-)


>
> But there is a welter of problems around being able to "factor" an OID
> tag out of an array or map.
>
> Abstractly, if one can factor, one should be able to factor the tag out
> of any number of layers of structure.  The trouble with that is that it
> makes decoding difficult, as the decoder needs to keep the application
> of the tag in mind as it descends through structures.
>
> It would seem consistent that other tags might be defined with this
> behavior, in which case a decoder might need to keep several factored
> tags in mind as it is descending through structures.

I believe in several earlier drafts (like the one from a couple of years 
ago), there was a lot more text on the issue of tag factoring in 
general--of which OIDs were just a notable example. See below.


>
> Comparing with other types, a homogeneous array of OIDs is very like a
> homogeneous array of integers, for which we already have a mechanism for
> one-dimensional arrays.  OID arrays could be handled similarly, although
> things are more complex because OIDs don't have a fixed-length encoding.

The byte 0x80 *never* appears in an OID or Relative-OID ("ROID"). 
Therefore, the byte 0x80 can be used in a byte string to delimit 
multiple OIDs. In that regard it is similar to JSON Sequences (RFC 7464).

> What isn't parallel with previous mechanisms is factoring from *maps*.
> And that's novel because the factored tag applies to the keys but not
> the values.  The reason for that is a bit arbitrary, and seems to be
> because that's convenient for encoding X.500 certificates.
>
> Factoring seems to be hard to do; trying to make it semantically
> consistent and aligned with possible future tags with similar behavor
> seems to require complex behaviors in the decoder.

The original goal of the prior text was to come up with a semantically 
consistent way to factor tags out of arrays and maps, with the specific 
intention of saying "this is an array of identifiers" (e.g., OIDs or 
UUIDs) with one byte at the front, rather than an array with N tag bytes 
for N items. I believe the last extended discussion about this was in 
draft-bormann-cbor-tags-oid-06, which was considerably longer.

Whether tags should be factored as a general semantic thing, might be 
more appropriately a topic of a different Internet-Draft.


> Though this proposal
> saves about 10% in X.500 distinguished name encoding.  Then again, are
> distinguished names ever used when they aren't paired with keys (which
> are much longer)?

It looks like draft-bormann-cbor-tags-oid-06 from a long time ago has an 
example of a distinguished name semantically transposed into CBOR, in 
Section 8.2.

I am aware of two interchange formats for distinguished names: X.680 DER 
(aka "ASN.1") and LDAP string format, RFC 4514. I once wrote a parser 
that could go between the two with ease.

Although I wrote the example of DN in CBOR in 
draft-bormann-cbor-tags-oid-06, I am not sure what other implementations 
would prefer to do. If the DN is (from that application's perspective) 
just a binary blob to lob over to the crypto stack, maybe a tag for a 
DER-encoded distinguished name would be better than a CBOR 
transliteration. In such a case, the distinguished name tag could be 
defined as <<TBD>> bstr = DER, <<TBD>> tstr = LDAP string format, and 
<<TBD>> array of maps of OIDs to values = CBOR structured format.

Sean