Re: [jose] Call for Adoption: draft-jones-jose-fully-specified-algorithms

Neil Madden <neil.e.madden@gmail.com> Fri, 05 January 2024 20:31 UTC

Return-Path: <neil.e.madden@gmail.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 4669BC1522C6 for <jose@ietfa.amsl.com>; Fri, 5 Jan 2024 12:31:59 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.104
X-Spam-Level:
X-Spam-Status: No, score=-7.104 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, 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=gmail.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 LapsbMPLfXo5 for <jose@ietfa.amsl.com>; Fri, 5 Jan 2024 12:31:55 -0800 (PST)
Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450: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 86156C14CE51 for <jose@ietf.org>; Fri, 5 Jan 2024 12:31:55 -0800 (PST)
Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40d5d9adf6eso4060765e9.0 for <jose@ietf.org>; Fri, 05 Jan 2024 12:31:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704486714; x=1705091514; darn=ietf.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=ZsSWT3dxBAQgg0D7PgQyUbreubaGA1H3Sal1zpdbyWM=; b=K9M9y6FMAU96J9pgU2UNHdjjz0FvAm/fg9wrV+T1JkQA5uJicGSnSaDitZhM7uFVMD wy49s3ADn2/fRmbmlYlPwOwnyOWA3qt/YudMv/4AB/Nnzf6yOoGIU5/ruOQzozmBW7Uf 6aw2RYKegevbZpQOKceuPrxOi9xhbaiwGsqMv1d6u4SW5pqKoAmSj/5gduQ6/hfOaYIV hiCDKEgo49nniTPJBDl5QTd9wZg9wHPjLLJVo8/NTj0T7Hp61tCVNiVWyB0j+4OQqdJB TM2RnV55QFT9CEvah1sIIFaBzGtG5XyxQRV9AlllPX/6DkH1QvxtYyaRxpQ7rK+xAQ0j zCPA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704486714; x=1705091514; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZsSWT3dxBAQgg0D7PgQyUbreubaGA1H3Sal1zpdbyWM=; b=kKg3moBdaUSHcYh5TY+ijUZuK4TggHgSJ8vPdpe8QxpzvikovUnw49qVh50IQUcx5S ar+PT/bRj1rrk+JgMBkxQzeMIxepQkGLFFBBJUIW9xC8g3ECbRXN4YA/BxmTC5bP8PBL HQlaj8wA6OLFMkO3JqfdNs5ftAQjzNQrh1Y+OKV+jQa0eT/LyzdKd+1ivx8H6nDE8Tmj 1pI0yjbKdUcibVSHXHWdnlaMdPOgQvVpyc6w96TX6HfVGPbJL0Ae4nhai5chXdrQg/1v d8jn8uHZCbZ6EhXIX+MMmN0WPCT34nK2Pp1TheAsaD5vV06U4NHU8rDUgU2mAfJUYqHU jppg==
X-Gm-Message-State: AOJu0Yw63Tn3SKG2KxxLFcI9IePPL+CL2hQxOnwbeMwNsUI4A/xCa7Xm IgYf/aPH2OiFBlmWUkNb+JLNHZCElmCm0Q==
X-Google-Smtp-Source: AGHT+IGNvo7sOatC4CjpuFFJiTlGWOQuhWVZOASh76jCx1G0nH/i/S8w/lYzr6v/K/+mAKohqTt1aQ==
X-Received: by 2002:a05:600c:1c85:b0:40d:3dfb:1cbe with SMTP id k5-20020a05600c1c8500b0040d3dfb1cbemr68026wms.2.1704486713432; Fri, 05 Jan 2024 12:31:53 -0800 (PST)
Received: from smtpclient.apple (11.133.143.150.dyn.plus.net. [150.143.133.11]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c154d00b0040e3635ca65sm2588449wmg.2.2024.01.05.12.30.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2024 12:30:55 -0800 (PST)
From: Neil Madden <neil.e.madden@gmail.com>
Message-Id: <B28A795E-EA91-4F2E-8F26-422C1C4E7E4E@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_E8BF2661-E420-4219-91B1-41AD663E28C2"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\))
Date: Fri, 05 Jan 2024 20:30:37 +0000
In-Reply-To: <CAN8C-_+UftOWR0K24XdCAtJ0C5TsEvNWKC+CdCYctGfe9gbBxQ@mail.gmail.com>
Cc: Karen ODonoghue <kodonog@pobox.com>, jose@ietf.org
To: Orie Steele <orie@transmute.industries>
References: <CA+mgmiMRLh=CskaOY_Ex4Q6-XfXLhkw-rQp4CezOXxBD8J=Xjg@mail.gmail.com> <A7286B92-BFB2-45C8-A811-CBF5113F91B0@gmail.com> <CAN8C-_+UftOWR0K24XdCAtJ0C5TsEvNWKC+CdCYctGfe9gbBxQ@mail.gmail.com>
X-Mailer: Apple Mail (2.3696.120.41.1.4)
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/2o8Chli2A3G0ladGJJ3bdq_xfTA>
Subject: Re: [jose] Call for Adoption: draft-jones-jose-fully-specified-algorithms
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jose>, <mailto:jose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jose/>
List-Post: <mailto:jose@ietf.org>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jose>, <mailto:jose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 05 Jan 2024 20:31:59 -0000


> On 4 Jan 2024, at 19:37, Orie Steele <orie@transmute.industries> wrote:
> 
> Thanks for your comments Neil!
> 
> On Thu, Jan 4, 2024 at 12:47 PM Neil Madden <neil.e.madden@gmail.com <mailto:neil.e.madden@gmail.com>> wrote:
> I’m in two minds about this draft. I’m fairly receptive to it in general, but I think it might be closing the stable door after the horse has already bolted. 
> 
> Some questions and comments that come to mind:
> 
> * A JWK “alg” constraint can only contain a single value. After this spec passes some algorithms may have two valid identifiers, leaving implementations a choice as to which to advertise (and risk breaking some clients) or to publish the key twice with different identifiers (wasteful and potentially causes other issues), or to drop the algorithm constraint entirely. None of these seem great. 
> 
> I'd argue that dropping alg, and leaving alg polymorphic are basically the same thing (and both are not great).
> 
> It's worth considering the parts of key management that happen before and after you have a key representation.
> 
> I am sure there are other references, but one I often find myself referring to is:
> 
> https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57Pt3r1.pdf <https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57Pt3r1.pdf>
> 
> > A major thrust from Part 1 of this Recommendation is that, in general, keys shall not be
> used for multiple cryptographic purposes
> 
> > Maximum cryptoperiods for each key type shall be determined at the KMF in
> accordance with the organization’s security policy...
> 
> When best practices are followed, keys are created for a single purpose, and for a fixed lifespan, they operate in that purpose and then they are destroyed.

Right, and the point of associating the "alg" with the key is to ensure that it is only used for one thing.

> 
> It would be more work to change the requirements for "alg" in key representations, or to add crypto periods to key representations.
> 
> I see this document as enabling compliance with best practices, not ensuring that all protocols follow them.

I'm not sure how this document does that at all.

> * In the example given of advertising algorithms in server metadata, I’m not sure how this helps. For compatibility, any server that supports EdDSA is going to have to continue supporting EdDSA or risk breaking existing clients. Likewise, any signature verification client that supports only Ed25519 may still have to support “EdDSA” and filter out any non-Ed25519 keys. 
> 
> A similar issue occurs with secp256k1 and ecdsa today.
> 
> Some implementations normalize to lower-s (and expect it), others don't.
> 
> When you cross test, you get errors in implementations that assume ES256K is always lower S, and it's not... that's for the same ES256K public key (arguably an even worse problem).
> 
> The point being that we could fix this by making "ES256K-LS", and we'd have the same problem with older implementations that advertised ES256K.

I'm not familiar with this issue or what "lower S" refers to here. Do you mean some implementations spell the algorithm "Es256K" with a lowercase s?

> I agree with your comment, but I don't see anything better to do than enable more precision, so that implementations that are aware of it, or that come after it's available, can take advantage of it.

Given that an EC/OKP JWK already specifies the curve, this is a case where this draft doesn't make things more precise and just causes compatibility issues for no gain.

> 
> * Does the usage of “enc” count as not being fully specified? I can well imagine that there are some clients that support, say, RSA-OAEP, but only support 128-bit content encryption algorithms, or only support GCM. So the same issue with not specifying the curve also applies when not specifying the content encryption algorithm. 
> 
> Excellent question.
> 
> See the recent discussion here:
> 
> https://datatracker.ietf.org/meeting/118/materials/slides-118-lamps-attack-against-aead-in-cms-00 <https://datatracker.ietf.org/meeting/118/materials/slides-118-lamps-attack-against-aead-in-cms-00>
> 
> In an ideal world, the crypto is "key AND algorithm" committing, in our current world, we may only be able to signal things in a way that easily enables that kind of commitment, not enforce that it actually happens in all the places it should.

This is not really related to the point I was making, and I'm not sure how that attack would apply to JOSE given that we don't have any unauthenticated cipher modes. (One of the good things about "enc" compared to "alg" is that all of the choices share the same security goal: AEAD). The algorithm and encryption mode are also both committed to already in the AD.

What I mean is that this draft is motivated by saying that algorithms like "EdDSA" don't give enough information to be useful in negotiating an algorithm because one party might only support the curve Ed25519 while another supports only Ed448. Well, exactly the same thing happens with content encryption algorithms. Both parties might support "RSA-OAEP" key algorithm, but one supports only "A128GCM" and the other only supports "A128CBC-HS256". Following the logic of this draft, the issue is that "RSA-OAEP" is not fully specified, so we should really add the following additional algorithm identifiers:

RSA-OAEP-A128GCM
RSA-OAEP-A192GCM
RSA-OAEP-A256GCM
RSA-OAEP-A128CBC-HS256
RSA-OAEP-A192CBC-HS384
RSA-OAEP-A256CBC-HS512

Not to mention doing the same for RSA-OAEP-256 and RSA1_5 and ECDH-ES and ECDH-ES+A128KW and ...

This is what I mean when I say that "fully specifying" the algorithm results in a combinatorial explosion of cipher-suite like identifiers. It doesn't seem like a sensible way to do things, which is why TLS 1.3 doesn't do that any more. And this is also why OIDC, which is cited in the draft as a motivating example, has both metadata fields:
id_token_encryption_alg_values_supported
id_token_encryption_enc_values_supported
Probably OIDC should add similar id_token_signing_crv_values_supported and so on metadata fields to address this properly, rather than trying to cram everything into a single algorithm identifier.

> 
> Addressing what "fully specified" means for HPKE, ECDH-* + AEAD... is harder than addressing signatures... There are principles that are hard to achieve without an ability to fully specify and commit to keys, this is an area where more discussion is probably needed.
> 
> 
> * The draft states that having different algorithm identifiers for different RSA key sizes is not useful, but actually some HSMs only support specific key sizes for RSA, and an implementation may want to restrict key sizes for efficiency reasons (even more so with PQC). 
> 
> Are you suggesting that RSA usage is sorta like P-256 / ES256 vs P-384 / ES384, where some systems would prefer fully specified RSA "alg" values for JOSE / COSE ?

No, as in practice everyone uses 2048 or (rarely) 3072. If more key sizes became common then this might be an issue. My point is that "fully specified" is a vague term that depends on what you consider important and is likely to evolve over time.

[snip the rest]

In short, I don't think this draft improves anything and it makes some things worse so should be rejected on that basis.

-- Neil