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

Neil Madden <neil.e.madden@gmail.com> Sat, 06 January 2024 09:11 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 A9FB1C15109E for <jose@ietfa.amsl.com>; Sat, 6 Jan 2024 01:11:03 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.212
X-Spam-Level:
X-Spam-Status: No, score=-1.212 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, MIME_HTML_ONLY=0.1, MIME_HTML_ONLY_MULTI=0.001, MIME_QP_LONG_LINE=0.001, MPART_ALT_DIFF=0.79, 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=no 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 B8tDI-mI4CYF for <jose@ietfa.amsl.com>; Sat, 6 Jan 2024 01:10:59 -0800 (PST)
Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) (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 36FBFC14F6ED for <jose@ietf.org>; Sat, 6 Jan 2024 01:10:59 -0800 (PST)
Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50eafc5b39eso74926e87.1 for <jose@ietf.org>; Sat, 06 Jan 2024 01:10:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704532257; x=1705137057; darn=ietf.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=hEATByUx8lFiezxojFUSWOBgNNh3gJXZA7NfKuvvkhg=; b=kx59MkabaPKitTjAidnYrXbLBcE2LCC1RcxCc1d7yiMKsVd8VtHL2ddBNDJSshDjc6 2odNrzcva1rLQJQibiryrKiqfbCGOnGjgShQmqfnzLo0Qbxo56Y/XFOG9OxSNdPAGy69 TVdxeOEbbN+wCWI8jwBlcECv6tAblLq/UUx2E++dOpACZAPe4PC6JnVd/uzTB2RWUANO etjXMH3tisBkZJ2fTeN9Q7OrNmgbKMTJ7Uq2IeGNzduEkhyst1U3HVMtPGahLBuBGGeU 7/vPzoXXKJJUVA1mgpFh4c+BSJLCHk8NpBsdMFX4i1dWEqFLUHYjiUBQXM9CdBSipBhL vThw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704532257; x=1705137057; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hEATByUx8lFiezxojFUSWOBgNNh3gJXZA7NfKuvvkhg=; b=mYhLRXoifybor76oaDSCoGNyVdQ5ktPUFg1Vx0ZtpfmKbpyw8qgfA0rmpxC6LtXKNK XUPinOk2waPgbffPa9lSJ8UGUURZ+dbJfCscC5tQpvFk68N1tXDD0nGh66GNztAhB7US 3eJDUy9Ka2Zx4MZyL+dicZC0q8aJEqCXcErBm3RtNmslxKEBhC1WCMMJIrCr666fapXR WO8YjoUvi/Rnzz/Tg3/Z5B6E8cebS0cFClxOHUA98xEnMmZ8tw70PVG458CKbnjhIB7Y NHiT3LhKExyCHFycg9PdpCKGMtVegx5Bkt+g1vkbzBV3Eac22s7EPOULaEYBO962AX+t 4Tvw==
X-Gm-Message-State: AOJu0YxLQLBj1Llm3Xx2yIOzVyB/iRXbBFHidX/426AOxuR9VmtYs+r+ RicFFCI1U7R3M+pSE0V4LWk=
X-Google-Smtp-Source: AGHT+IELcTVtHrhBuCfV7EjJI5l0aRk2EU5L+2N5o6eXVX2QUv6/s8XuFX0iPPA2PHrrkTk9aGU8hg==
X-Received: by 2002:a05:6512:1318:b0:50e:7fb1:6456 with SMTP id x24-20020a056512131800b0050e7fb16456mr696633lfu.4.1704532256496; Sat, 06 Jan 2024 01:10:56 -0800 (PST)
Received: from smtpclient.apple (11.133.143.150.dyn.plus.net. [150.143.133.11]) by smtp.gmail.com with ESMTPSA id p15-20020a05600c358f00b0040d90407f7esm4027868wmq.8.2024.01.06.01.10.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Jan 2024 01:10:55 -0800 (PST)
From: Neil Madden <neil.e.madden@gmail.com>
X-Google-Original-From: Neil Madden <Neil.E.Madden@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail-ABA08266-B1D6-4E6C-BD56-B480D8AAA24E"
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (1.0)
Date: Sat, 06 Jan 2024 09:10:44 +0000
Message-Id: <F1607F5D-95D9-4F85-A2EE-21802EE23E7F@gmail.com>
References: <CAN8C-_Js=7touqKt0b=xeC4H8Yr2F9N_Qfu-=vi72VjFesmQ=g@mail.gmail.com>
Cc: Karen ODonoghue <kodonog@pobox.com>, jose@ietf.org
In-Reply-To: <CAN8C-_Js=7touqKt0b=xeC4H8Yr2F9N_Qfu-=vi72VjFesmQ=g@mail.gmail.com>
To: Orie Steele <orie@transmute.industries>
X-Mailer: iPhone Mail (21B101)
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/P5iU4NboKBkjmRqqREmMjaKGDNY>
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: Sat, 06 Jan 2024 09:11:03 -0000

On 5 Jan 2024, at 22:52, Orie Steele <orie@transmute.industries> wrote:


Inline with snips (which I don't often use, so apologies if I get one wrong), and thank you again for these excellent comments:

[snip]

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

That's right, but if you need to know the key type and the alg to verify, you have a "not fully specified alg".

https://datatracker.ietf.org/doc/html/rfc9053#section-2.1" rel="nofollow">https://datatracker.ietf.org/doc/html/rfc9053#section-2.1
https://datatracker.ietf.org/doc/html/rfc7518#section-3.1" rel="nofollow">https://datatracker.ietf.org/doc/html/rfc7518#section-3.1

ES256 is P-256 ECDSA with SHA-256 in JOSE.
ES256 is any curve ECDSA with SHA-256 in COSE.

ES256 in COSE can easily lead to cross curve scenarios, where the hash function is correct (the same), but the curve is different...

You need to negotiate the triple: [kty, crv, alg] in COSE and the singleton "alg" in JOSE.

To which my answer is, so what? You have to negotiate alg + enc for JWE, or alg + enc + crv for ECDH-ES. Applications have to be aware of these issues and deal with them.

Trying to smoosh all possible degrees of freedom into a single algorithm identifier is neither possible nor desirable. (Maybe I care about deterministic nonce generation in ECDSA, or maybe I want hedged nonces to mitigate fault attacks - should those be in the algorithm identifier? As you say, perhaps I want canonical signatures, maybe that should be in the identifier?)


[snip]

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?

https://github.com/Legrandin/pycryptodome/issues/759" rel="nofollow">https://github.com/Legrandin/pycryptodome/issues/759

https://bitcoin.stackexchange.com/questions/85946/low-s-value-in-bitcoin-signature" rel="nofollow">https://bitcoin.stackexchange.com/questions/85946/low-s-value-in-bitcoin-signature
 
(you replied before I hit send, but for others who might be curious, I'll leave the reference)...

I agree it's a "bug" except those are called expected behavior when they happen frequently enough... it was an analogy at any rate.


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.


Your argument is that fully specified algorithms in JOSE & COSE are redundant to the key type requirements (kty, crv, alg = fully specified)?

This is true, that's the nature of fully specifying things, you can rely on 1 value to uniquely identify a security relevant capability.

Or you can just publish a set of keys to be used for a given purpose and put appropriate constraints on those keys. This is, IMO, the safest way to negotiate parameters: https://neilmadden.blog/2018/09/30/key-driven-cryptographic-agility/" rel="nofollow">https://neilmadden.blog/2018/09/30/key-driven-cryptographic-agility/


[snip]

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,

Indeed, I agree.
 
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.

Except it's 2024, and as you said, systems already understand these algorithms : )

We don't have to backport full specification for things that we think people should not use, won't use in the future or that are not being used.

? All of these algorithms are being used. 


Creating a limited number of new code points does not break old code points.

But it does create new opportunities for incompatibilities for little benefit. 

 
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
Indeed.
 
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.

The intention is to give a "name" to a "reasonably safe thing that is supported".

Well, I wouldn’t describe ECDSA as a reasonably safe thing under any circumstances…


If changing the curve does not affect the security properties, then it seems reasonable to omit it... is that true?

I’m not sure what you’re asking here. Obviously the curve choice affects the security properties considerably. But we already have a field for specifying the curve. 


https://datatracker.ietf.org/doc/html/rfc8446#section-9.1" rel="nofollow">https://datatracker.ietf.org/doc/html/rfc8446#section-9.1

>  A TLS-compliant application MUST support digital signatures with
   rsa_pkcs1_sha256 (for certificates), rsa_pss_rsae_sha256 (for
   CertificateVerify and certificates), and ecdsa_secp256r1_sha256.

ecdsa_secp256r1_sha256 = ES256 in JOSE but != ES256 in COSE. (addressed in this draft)

... later:

> The following values are marked as "Recommended":
      ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384,
      rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512,
      rsa_pss_pss_sha256, rsa_pss_pss_sha384, rsa_pss_pss_sha512, and
      ed25519.

Here "ed25519" is defined as... https://datatracker.ietf.org/doc/html/rfc8446#appendix-B.3.1.3" rel="nofollow">https://datatracker.ietf.org/doc/html/rfc8446#appendix-B.3.1.3

/* EdDSA algorithms */
ed25519(0x0807),

If TLS mirrored COSE and JOSE, the algorithm would be called "EdDSA" and the curve would be unknown. (addressed in this draft)


The fact that TLS 1.3 decided to name Ed25519 rather than EdDSA is not the point. The point is that the draft under discussion was that “alg” should be “fully specified”, which if actually consistently applied would result in alg being more like a TLS 1.2 ciphersuite. What actually now happens in TLS 1.3 is that all the things that used to be “fully specified” in a single ciphersuite identifier are now negotiated separately:


If the actual point of this draft is the much more narrowly defined: that *signature algorithm identifiers* should include group parameters, then sure. I can live with that, even if I don’t think it’s necessary. But it’s not what the draft says at the moment. 

I’d also say that any such draft should just give advice for the future. Changing EdDSA to Ed25519/Ed448 retrospectively just causes pain for very little gain. 

TLS 1.3 algorithm name is better... "0x0807" refers to EdDSA with Ed25519.

Recent algorithms registered for use in COSE follow the same approach:

kty: HSS-LMS, alg: HSS-LMS
kty: WalnutDSA, alg: WalnutDSA

Naming the algorithm after the key (and all parameters necessary to use it) is fine.

Naming the algorithm after the process that you used the key with is not.

Because that process breaks when:
a) multiple keys support the same process, and
b) we don't know which key is supposed to be used.

You argued that b is a negotiation problem, and I agree... but that problem is compounded by a few poor names, adding a few more precise ones eliminates it, and establishes a safer convention moving forward.

Negotiate keys, not algorithms. Keys should fully specify their parameters (including algorithm). 

[snip]

My point is that "fully specified" is a vague term that depends on what you consider important and is likely to evolve over time.

Fully specified is not a vague term, it means that when I tell you EdDSAEd25519 or "0x0807", you know its EdDSA (which uses SHA-512 internally) with Ed25519 and that it won't work with an Ed448 key...

Today, if I tell you EdDSA, you don't know if it's from an Ed25519 or Ed448 key.

I’ve given lots of examples now of how “fully specified” depends on the context. You keep coming back to EdDSA, but the draft says that all “alg” identifiers should be “fully specified”. That is much broader than EdDSA. 


[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.

There are at least 3 parts of your arguments (thank you again), that I don't feel can be dismissed:

1. What cost for more precision is worth bearing in implementations and registry maintenance... If the current draft is "too costly" it should be rejected.
2. What should "fully specified" mean, for a series of processes, such as hash algorithm, then sign algorithm or key establishment, and then symmetric encryption.
3. Is the guidance we give on how to create new registries likely to cause problems in the future, including repeating very long debates, regarding how things were done, vs how they should be done.

ECDSA with P-521 can be used with lots of different hash first approaches.... Are all those worth registering?... No! ECDSA P-521 with SHA-1 makes no sense... arguing that it MUST be registered and that it would not be used is a straw man fallacy.

That’s not what I argued. 


Fully specifying things does not imply registering things that don't make sense to fully specify or to use in 2024.

Maintaining the registries is not about "what is possible". It is about "what is good for interoperability", "what lowers implementation burden", and "what improves security", and most importantly in this draft, providing guidance for new entries, that eliminates optionality, ambiguity and hopefully makes future discussions on this topic shorter and more satisfactory.

In your earlier reply you said "I’m fairly receptive to it in general, but I think it might be closing the stable door after the horse has already bolted."

It seems like part of standards is watching a different horse escape over and over again, until consensus is documented to not leave doors open : )

If you really want to close that door then the advice should be to not rely solely on a single algorithm identifier. 

— Neil