Re: [COSE] Key identifier of type bstr / int

Laurence Lundblade <lgl@island-resort.com> Tue, 22 March 2022 07:53 UTC

Return-Path: <lgl@island-resort.com>
X-Original-To: cose@ietfa.amsl.com
Delivered-To: cose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 83E493A0BD3 for <cose@ietfa.amsl.com>; Tue, 22 Mar 2022 00:53:01 -0700 (PDT)
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_H4=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 K9J8ceGq1_aD for <cose@ietfa.amsl.com>; Tue, 22 Mar 2022 00:52:57 -0700 (PDT)
Received: from p3plsmtpa12-09.prod.phx3.secureserver.net (p3plsmtpa12-09.prod.phx3.secureserver.net [68.178.252.238]) (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 EE05E3A0BD2 for <cose@ietf.org>; Tue, 22 Mar 2022 00:52:56 -0700 (PDT)
Received: from [192.168.8.106] ([213.225.36.78]) by :SMTPAUTH: with ESMTPSA id WZK0nYUwmAmGxWZK1nZn07; Tue, 22 Mar 2022 00:52:55 -0700
X-CMAE-Analysis: v=2.4 cv=Y9g9DjSN c=1 sm=1 tr=0 ts=62398057 a=73sqJBfw4EOcj9Wd6QYAcA==:117 a=73sqJBfw4EOcj9Wd6QYAcA==:17 a=gKmFwSsBAAAA:8 a=jAY1G54eGKs1Lyl6ZgkA:9 a=QEXdDO2ut3YA:10 a=uITO7gyiMe-kP_i29OIA:9 a=X0i8Yj1IFEnJgGGk:21 a=_W_S_7VecoQA:10 a=nnPW6aIcBuj1ljLj_o6Q:22
X-SECURESERVER-ACCT: lgl@island-resort.com
From: Laurence Lundblade <lgl@island-resort.com>
Message-Id: <552B9E19-AAA7-467C-93BD-C621F5276539@island-resort.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_DDC81557-76F0-429C-977C-2DE137634823"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\))
Date: Tue, 22 Mar 2022 08:52:52 +0100
In-Reply-To: <3724F698-FB9A-44F2-B942-A6034B9D207E@tzi.org>
Cc: Michael Richardson <mcr+ietf@sandelman.ca>, Orie Steele <orie@transmute.industries>, "Apple Inc." <goran.selander@ericsson.com>, "cose@ietf.org" <cose@ietf.org>
To: Carsten Bormann <cabo@tzi.org>
References: <95B75634-B147-4756-A950-C6B139CF3ADD@ericsson.com> <9DF382AC-12A8-47A5-AAE7-2B0D75EAA669@island-resort.com> <EDFDB6E4-2BDE-4E2E-9CF0-D771E2DEF3C6@ericsson.com> <823C00C2-4F6C-4DF5-99B0-87D8524D4A9C@island-resort.com> <C059B669-4C5D-4980-A665-96A39F4457C3@island-resort.com> <AM4PR0701MB21958541C07CEA44DB1B1578F4169@AM4PR0701MB2195.eurprd07.prod.outlook.com> <CAN8C-_+3sWckZKo7KS2fsPU4pBHo+NNGgQpxg7p8LytFX01eEw@mail.gmail.com> <AM4PR0701MB2195D76D8CFCC873C1D05A04F4169@AM4PR0701MB2195.eurprd07.prod.outlook.com> <CAN8C-_K4EfFSar9H_QR+cV_pz+xhXtWA=pKK+rFv241E5DQofQ@mail.gmail.com> <DC1C335A-629D-4E4F-97BD-B4CA3519EDC6@island-resort.com> <641639.1647901233@dooku> <3724F698-FB9A-44F2-B942-A6034B9D207E@tzi.org>
X-Mailer: Apple Mail (2.3608.120.23.2.1)
X-CMAE-Envelope: MS4xfEViV9eU/vN78mDMAzEseXjA7lbQq5TuiWXkeYcpG2Dm8MTM9joY9LgN+jRoVRaYPM++tXzkIBMc2DwcEguCGoDMPdz8IMMOxVzbvehmc1iQfw8NMOuY gVhWSZdhWbCJlUMAAUbkOhYqGbqJ1br+rd1Co8QNwD3C/MYz+k2aJFYhWu1rDghjwHXJGgcJWWpvoG3sJhX5Z41vUWS1xIWsQYAlMYTB6qFxZRbCBbRJmFaC KPSiyr8SHT7YKBwIix2ykWTpNVRICXPcFODpaEZE0VJzultb7wGTUHvYOMivItJcDBF3VhYTEresDN/kfY2JIQ==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/reEP7uz3lrrQNDb9WmPQ00scwpw>
Subject: Re: [COSE] Key identifier of type bstr / int
X-BeenThere: cose@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: CBOR Object Signing and Encryption <cose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cose>, <mailto:cose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cose/>
List-Post: <mailto:cose@ietf.org>
List-Help: <mailto:cose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cose>, <mailto:cose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 22 Mar 2022 07:53:02 -0000


> On Mar 22, 2022, at 12:00 AM, Carsten Bormann <cabo@tzi.org> wrote:
> 
> Now, there is also API compatibility — can you upgrade the COSE library without upgrading the using application.
> 
> I’d like to ask those who are proposing kid => int / bytes: are the two kid name spaces disjoint (so you need an API extension, too), or is an integer kid just a way to express the same kid as was already possible to express using a byte string kid.  Another way to say the latter is that all kids are byte strings and the integer representation is just a compressed way to express such a byte string.  Obviously, the latter way to interpret kids is slightly less efficient, because there are now two ways to express certain kids.  But the change is also local, i.e. you can do it in your library without changing anything else.
> 
> If we go for the latter, we will want to make sure that in particular the integers -24..23 map to useful byte strings and v.v.  Note that there is no need to make these byte strings short; e.g., a decimal representation (‘-24’ to ‘-1’ and ‘0' to ’23’ in CBOR DN), or maybe an octal one (’50’ to ’77’ and ’00’ to ’27’) would work well.  We don’t even need to support integers outside -24..23.

From an API and implementation point of view, I like that int key IDs are just another way of putting the bytes on the wire.

Seems like we could just say that single byte kid value 0x01 can be encoded as bstr h’01’ or as integer 01. Allow this only for single byte kids in a range. Implementations error out for integers that can’t map to a single byte kid.

This keeps the COSE API, SW stack above and key databases the same, a byte string, no matter what encoding is used to convey.

LL