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

Orie Steele <orie@transmute.industries> Mon, 21 March 2022 19:34 UTC

Return-Path: <orie@transmute.industries>
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 8E4593A14EC for <cose@ietfa.amsl.com>; Mon, 21 Mar 2022 12:34:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.107
X-Spam-Level:
X-Spam-Status: No, score=-2.107 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_BLOCKED=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
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=transmute.industries
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 FLzPhzyGZk5O for <cose@ietfa.amsl.com>; Mon, 21 Mar 2022 12:33:58 -0700 (PDT)
Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9EBE23A14ED for <cose@ietf.org>; Mon, 21 Mar 2022 12:33:57 -0700 (PDT)
Received: by mail-lj1-x230.google.com with SMTP id 17so21321013lji.1 for <cose@ietf.org>; Mon, 21 Mar 2022 12:33:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=transmute.industries; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3y994PTQeK+HD2Do+S5lyay/HVjVK6zhnY4TPFTi5nQ=; b=X+3kqWgbJMUi0s6QvBBqZhg9Az7djPjgjjXCexQ5nz8zwN5eCWR+B3QmOLnx+HqoCP gARegK9s8BMzTD03z7+p9GI8rUa7r5Qh6kd1xhvmyvMzdJwn7es80ycAp05HOoSj0Z1k oC65NNpxgCX4XLIuOUCbJItv8twkdvMAHS8iI5Hcg2yXU5YiFo9KaH9niJT73oq4oevU GJggPxL3OGq6R/Nqv0Hi7r5CEaI7eNt9UTs8TH0T8FLqFRffeSb5H56aFf7feDWoLdqR mJfFzGac+np3htFVx7MNttjCw4kxOEF0bEJcheK7CP4IgzjLnrOWaI8riC2eJnx9uf1E uwTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3y994PTQeK+HD2Do+S5lyay/HVjVK6zhnY4TPFTi5nQ=; b=ugg75F0dyPvMCljraI1rm7sDYMP62db4T+JV3eARLMJG+EPUK/70B+nqDvAX1x2O9b QaCohvql2E3hc/pSa9hOBsxbQJT3dfz3z7lUwbmlwaPQhwbTDhwJacWO6C1OMYLBoIkw NCi48ZDiSLlHo6MMYJJ2Cemu2a/IQHTrBy8hS3PCbLVutZOtzjoWTMy2DYOSzG30HZnE QGPfiFrolGkttUn/3A8RUF1CYXI/3bx+PkIRL+Z6mUcJ4n0hBJcCqorNjWGAkIMP6ZcZ eoF+EYIgI8g/Th3QJiL39ozV273cYvjmCOnGtgg46c9m58TCZkeG+O2pc+AeTcxKxzJg bdeg==
X-Gm-Message-State: AOAM532pCjP2CW6tLH/h5wZPLS8FcXVxFDgYbPnK+VIpsq6nyAT5tBR5 AROfXhXweRLBWizY1jMHaS75TF1yppsNYNJuY+0VJ8r447Q=
X-Google-Smtp-Source: ABdhPJzjFvsDp5VqLLLfFsDsBrSC0W7vayDJAh3Hr86JqP0EotWSuTsok8wKvxfNeJf53ky+FbLjCzzxiqb0H6w+rQ4=
X-Received: by 2002:a2e:a4b4:0:b0:246:2930:53d7 with SMTP id g20-20020a2ea4b4000000b00246293053d7mr16650120ljm.74.1647891235477; Mon, 21 Mar 2022 12:33:55 -0700 (PDT)
MIME-Version: 1.0
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> <CAGJKSNQkSv3sBqiSD-Xi0hKm6h9C19D86=nwx2ZnZ_qmyiR5uA@mail.gmail.com>
In-Reply-To: <CAGJKSNQkSv3sBqiSD-Xi0hKm6h9C19D86=nwx2ZnZ_qmyiR5uA@mail.gmail.com>
From: Orie Steele <orie@transmute.industries>
Date: Mon, 21 Mar 2022 14:33:44 -0500
Message-ID: <CAN8C-_LFJMqGLcERQ4uHi2bH9neaNc3G-T6Y7cp+W6DHcm5GWQ@mail.gmail.com>
To: Mike Prorock <mprorock@mesur.io>
Cc: Göran Selander <goran.selander=40ericsson.com@dmarc.ietf.org>, Laurence Lundblade <lgl@island-resort.com>, cose@ietf.org
Content-Type: multipart/alternative; boundary="000000000000b8352705dabf93dd"
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/Qpgf_1AsDmWaJ5BrHU08_PXNPFg>
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: Mon, 21 Mar 2022 19:34:04 -0000

I see basically 2 issues.

1. can `kid` and `intkid` both be present in a key.

If they can't then there is no upgrade path for existing keys to touch the
new RF stuff... and new keys with ONLY intkid would need to be generated.

If they can, then just generate a new intkid for each existing kid and be
done with it.

2. can we change the definition for `kid` to support both int and
bstring via making it have an or type.

If this were legal, you can't assign both an int and a bstring to the same
existing key, so you would be forced to generate new keys, for the int use
case... this does not seem that bad to me.

If this is not legal, you obviously need to register a new key identifier
that supports ints, if you need to support ints.

This raises the obvious question of will ANY of the new RF systems expect
to work with existing keys... if the answer is no, and the new RF stuff
will only use "new keys", you can generate the new keys and ensure:

- they have kid and it's an int.
- they have intkid and it's an int.

As an aside keys should have ids that are assigned when they are
generated... so for me, the "lets use an existing key, but give it a new
id" is an anti pattern... just generate a new key, and make sure it has all
the fields you think it needs to be successful.

I still think allowing any form of int kid is a mistake, and the header
size requirement is the thing that should change, not the `kid` type... the
compatibility and simplicity are worth the size cost imo.

OS



On Mon, Mar 21, 2022 at 2:10 PM Mike Prorock <mprorock@mesur.io> wrote:

> As with Orie, pretty big -1 to adjusting kid from me
>
> Mike Prorock
> mesur.io
>
> On Mon, Mar 21, 2022, 09:55 Orie Steele <orie@transmute.industries> wrote:
>
>> I am a -1 to changing `kid`, it should remain a string, for compatibility
>> with existing key identifier systems.
>>
>> Including ones that support
>> https://datatracker.ietf.org/doc/html/rfc7638#section-1
>>
>> See the original definition:
>> https://datatracker.ietf.org/doc/html/rfc7517#section-4.5
>>
>> > The "kid" value is a case-sensitive string.
>>
>> Many implementations have built hard dependencies on RFC7515.
>>
>> One of the nicest things about JOSE / COSE is being able to "upgrade"
>> from JOSE to COSE.
>>
>> Having a significant difference between `kid` in JOSE and COSE would be
>> harmful.
>>
>> If we really need an integer version of `kid` I would suggest following
>> the `jti / cti` convention and calling it `ckid`... keeping it optional (as
>> is the convention), and ensuring it is not part of thumbprint computations.
>>
>> Regards,
>>
>> OS
>>
>>
>>
>>
>> On Mon, Mar 21, 2022 at 8:35 AM Göran Selander <goran.selander=
>> 40ericsson.com@dmarc.ietf.org> wrote:
>>
>>> Hi Laurence,
>>>
>>>
>>>
>>> Thanks for copying in the old thread. As noted, you and others preferred
>>> `kid` as bstr / int rather than `kid2` as int when we discussed it last
>>> time. Would be good to come out with a more solid motivation this time so
>>> we can converge on this  :-)
>>>
>>>
>>>
>>> With `kid2` as int, the fields that uses both bstr and int would be of
>>> type  `kid` / `kid2` which is fine.
>>>
>>>
>>>
>>> There is an algorithm for translation from CBOR bstr / int to byte
>>> strings on the wire (back and forth) in draft-ietf-core-oscore-edhoc.
>>>
>>>
>>>
>>> Göran
>>>
>>>
>>>
>>>
>>>
>>> *From: *COSE <cose-bounces@ietf.org> on behalf of Laurence Lundblade <
>>> lgl@island-resort.com>
>>> *Date: *Monday, 21 March 2022 at 14:14
>>> *To: *Göran Selander <goran.selander=40ericsson.com@dmarc.ietf.org>
>>> *Cc: *cose@ietf.org <cose@ietf.org>
>>> *Subject: *Re: [COSE] Key identifier of type bstr / int
>>>
>>> Thinking about Mike’s comment today in COSE/Vienna about backwards
>>> compatibility. Looked at my code around this. That definitely seems like an
>>> issue.
>>>
>>>
>>>
>>> What about defining “kid2” as just int? “kid” stays as bstr only. Then
>>> there’s no backwards compatibility break. Adding support for another
>>> integer parameter isn’t difficult. The downside is a little extra code to
>>> look at two different parameters.
>>>
>>>
>>>
>>> You’d probably want to say that only one of the two kids MUST be present.
>>>
>>>
>>>
>>> Another random idea — could you say that it is allowed to translate an
>>> integer kid to a bstr kid by assuming network byte order and stripping
>>> leading zeros?
>>>
>>>
>>>
>>> LL
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Aug 13, 2021, at 3:01 AM, Laurence Lundblade <lgl@island-resort.com>
>>> wrote:
>>>
>>>
>>>
>>> Understood about the use case. Thx for the background.
>>>
>>>
>>>
>>> On Aug 10, 2021, at 3:13 AM, Göran Selander <
>>> goran.selander=40ericsson.com@dmarc.ietf.org> wrote:
>>>
>>>
>>>
>>> Assume that we do want to allow key identifiers to be CBOR ints in
>>> certain settings,  what is the best (least intrusive) way to allow this
>>> while still maintain compatibility with 'kid's supporting the type bstr?
>>> Another alternative to what has been listed below is to define 'kid2' to
>>> only be of type int - is that a better option?
>>>
>>>
>>>
>>> I didn’t write actual code to check, but they about the same to me.
>>>
>>>
>>>
>>> ‘kid' as int/bstr seems less confusing to me than ‘kid2’. It tells you
>>> it does exactly the same thing whether it is an int or a bstr.
>>>
>>>
>>>
>>> So my pick is ‘kid’, but ‘kid2’ is OK too.
>>>
>>>
>>>
>>> LL
>>>
>>>
>>> _______________________________________________
>>> COSE mailing list
>>> COSE@ietf.org
>>> https://www.ietf.org/mailman/listinfo/cose
>>>
>>
>>
>> --
>> *ORIE STEELE*
>> Chief Technical Officer
>> www.transmute.industries
>>
>> <https://www.transmute.industries>
>> _______________________________________________
>> COSE mailing list
>> COSE@ietf.org
>> https://www.ietf.org/mailman/listinfo/cose
>>
>

-- 
*ORIE STEELE*
Chief Technical Officer
www.transmute.industries

<https://www.transmute.industries>