[COSE] Re: [jose] Algorithm identifiers for pre-hashing in two-party signing?

Michael Jones <michael_b_jones@hotmail.com> Tue, 24 September 2024 22:29 UTC

Return-Path: <michael_b_jones@hotmail.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 42CDCC1D52FD; Tue, 24 Sep 2024 15:29:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.233
X-Spam-Level:
X-Spam-Status: No, score=-1.233 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, FORGED_HOTMAIL_RCVD2=0.874, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, 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=hotmail.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 U3S38wEx2AG2; Tue, 24 Sep 2024 15:29:28 -0700 (PDT)
Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04olkn2010.outbound.protection.outlook.com [40.92.45.10]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C2A59C1D52E2; Tue, 24 Sep 2024 15:29:28 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tVEbtRrnQWgcbYhYOS3z6JaSF+CkGmvSiEiomiBhWjUOioY9AwG9bLzPbHKGFXUMfNRDBOqIcKt+uRPxdVM8SYxZ51KvPOnKBIGcUeSaID1B3nQJvaaY0gWVLPgDZu77hhZLWSJAUBA7jDGBF56w9/l98boP2jIebP3Xz4bzP3CKDwKl1gT55ySiWeZnrTk/gJXdIlEzaA0i3yOgeJJIWyuVek/tle1eMp5l9MRETIOprnRsHWBQt1p5hO+a5Uq+PHo7Am0QP67rQw67cL2ogoGj0H9Pw5MLHuanqQq5Ii+dOtqntTHaskxsUBEGK/GyhyQ08ZWyLTzHhoezeAlL1g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CSe3SBHR+8mxA4/95EvqzmXeaL3Bv/HmMBm5c4U5XHY=; b=VYNhagH+nz9yqSueR7RhN+hmMWNsc6vV3O1MnB2/4R+Xeqv6B43z6iaQbRQOD76gBMXkRjyHmfZnYL77j+39cE8FhVdCcLxRuUSu7mM50KA3DhYfdO9wr4fwPxPX6p085LzOzO+2LlwBWFiuFv0oQGg/SiAcmDvHwNaMNy4NxAu+jYrEz3O8tcKQQSBHZFFStD+V72HNDPIWHAt31gEY9JwAJD9H25QYwnag1YV6jKd6HFTJfGA5+50WNQqda5ydBrt2XSbqy9F3x6UdwF/rKOF2zfG6/w83HyCfKb68En5PY6lITbiuu8dY31/dW8lJGGLBjHvD5LJ5W2DtMkb21Q==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CSe3SBHR+8mxA4/95EvqzmXeaL3Bv/HmMBm5c4U5XHY=; b=HpljZwPFmfQGsNUbX5DdJ9j+AsIqH+8GBAK9o3Q+eOqK+3hGIWuXQl62IWXQUNaZAeeppsmMSG76Di7zjix2j5M9iRzQtofp2wXW1ZsoSvM9V5kNNKcXLtRE9deD27xIKzHayMTsC0HLntfXudMOu6Zlq1FGybQnr0/IZzLX88yFUNG59jrGd1aJHQqnf9IGpq7hspNTwu0y052nVzO4Vio8yIbwTV5CbV9HRApEt1RktMbDwoJJ5lcyQrXFjdea2GsMDNg9YMnQt15vwjA8bM6bRmtiu0iIFxbxnDBxNRhkeM71kfdM09xRN0E4wOFvdF8hNXI00R8ZU8vqV6Pj0A==
Received: from SJ0PR02MB7439.namprd02.prod.outlook.com (2603:10b6:a03:295::14) by SA0PR02MB7244.namprd02.prod.outlook.com (2603:10b6:806:ed::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Tue, 24 Sep 2024 22:29:26 +0000
Received: from SJ0PR02MB7439.namprd02.prod.outlook.com ([fe80::6394:e79c:c32a:4c6a]) by SJ0PR02MB7439.namprd02.prod.outlook.com ([fe80::6394:e79c:c32a:4c6a%3]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 22:29:26 +0000
From: Michael Jones <michael_b_jones@hotmail.com>
To: Emil Lundberg <emil@yubico.com>, cose <cose@ietf.org>, "jose@ietf.org" <jose@ietf.org>
Thread-Topic: [jose] Algorithm identifiers for pre-hashing in two-party signing?
Thread-Index: AQHbC31aHju9lEI680CNGyGsnCJUsLJnhyTg
Date: Tue, 24 Sep 2024 22:29:26 +0000
Message-ID: <SJ0PR02MB743976C3214FBB090F2D7D71B7682@SJ0PR02MB7439.namprd02.prod.outlook.com>
References: <CANMnvkxiVppxz5Pm2dWaMVJTB229kTpw9f8Si-WmY0jkrBP=wg@mail.gmail.com>
In-Reply-To: <CANMnvkxiVppxz5Pm2dWaMVJTB229kTpw9f8Si-WmY0jkrBP=wg@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SJ0PR02MB7439:EE_|SA0PR02MB7244:EE_
x-ms-office365-filtering-correlation-id: 364e8aec-7371-4bbd-b894-08dcdce858f1
x-microsoft-antispam: BCL:0;ARA:14566002|7092599003|461199028|8060799006|12050799009|8062599003|9400799024|15080799006|19110799003|102099032|440099028|10035399004|4302099013|3412199025|1602099012;
x-microsoft-antispam-message-info: lFG2cerY639zEXQP8T9zXnRrjzk1uAeIFNX5ctPjq0PjH3tHpg+DsU+kaTJNH3WpGpRwFUtukdny4jQ5I5flBhSVQMEcrWu51jKlYpTWEyPqjT6Q9d8E507a7eCV0oZxzRix4Y4QKQoxDOHwQUWyOR6pMndxPbTN2Oxc+xQNyPqDKFdOiEcpNhFTN/Ci1Ik4AnACZiNN6e5Z+hp2RsNURlb8laG53udITDGb7K2eIZIpoIPYLbSFbXC0Ut2JGm+QuEWeEqVPn7hy/brKAjKAYHz1l1gU11oMOlY9Jrm49rn2r2rhmmT/97/K8wDLoUa63mSJqR5uO5HoSskIVAHIKrwjRGjxCFnJpsDvo8kYVxXK7JJtDxwL9Is/kPQgA7CPdtv8pV8XooEACES1hxVnbrnK6UwgASA+HdMqsqYnwtYDC0FCg43v5Jv3dXiTSM8shGdn6YTdpjfDtkWp5YJv3MkIX/2qXEziO0SJ1fh5cau4ynwKxoH3UUIzHccfsVQXcuPoat8velI6HzIyHs4JbL0lxPZFcbpM+P3CpaXoCgMKjz4nLiVTdK/6MKA8qjjS3l9uxBqljvSMxlQOraURSkU+cCKHKVbXvu+/uvJ9Ixbj67w8Pp7+uhkoMmCjFEqUdhX6mrNR+tzCxMXGE/fRGsOJvzLFgZJkyEbBocCI+mK0UiWuTwOBrug6+WUnCediFf4ZFQaFpj5NKpSE0ZHKH98buCIcmp0hBSNLpAID57si+hhNp4DbYDIraBOMrbbJ83qUdSaxoX84lYMnCjFjAGxoQ1cWciNPVnBjLYEYEdj0k3UxfteavkCOe27zbslWxiGTHBNq04gPPXHruNbWXZH9Y3p0osES3xav8ojZQ6TY9K3DusuLg5BAXZqrkzv7jED9vnqElnegaKH87Pn6XjIlN4SIf7OxINdLESjh3IZdX8BHm5dzu2UjanGrJpkZ
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: ghWZjLilhVY89q6/421XDAnF2tywkNa5c6ZPEGQ1GFsuYsdieYSbA3DY2XrMs1Q1BHwXQQijoyBp+HTOIL4c/EaMtYr1j8U3nTNXIvYjpr4dV8hlHtDwYQ0Sl+Qdd4lTD/nRs+cgQl57bQK4D/ru35H2UwvbkD98/wHNjxyKj8n3uta3q1kIViMwbgNo07KbNS4wPo+bwZESXGspfQSc3WYUTmYikVbtNNb0GsFr5UfwxRGmPw5NXfSYkhorS5KbA6K2R24luel+P3qNHBb0zdxCDp3MtXsM0MrWzdLhgHSJwQj+/UmvM53ym/uGBveUELe14GIVuYYEhzvFTaXxxFvwMi9T+NdSwvw0kA8/2LW/g5kUDQnkt5mN6Q9EeLDFIuY++WICjoGmYztGyMsb06ntCfAr2u8CsDnkazOHs27+I0uGAEguQLbAvKYH4vLK6z2neipPTCQxH+uYGEqiC5UMHe/hsaikt2ifv0YdSas/5NeVfpAJTk3iM1islZBLStpU68UIsYivJYksZ17vzQ24FfafILqEh+1D1Nln3SwZYcVkL/i1EupfGRnp9ji31ViSh6RO4nB0e/aHrYC8+9bS+tawLlZewdvhYqOfVMkyCXI4+n6bg0tIOcLwuit69Nhr+BaEcwQHE7PJh3l2QljpkMX3hBlC05kc7JqaWJQtLie3ruKauZKWLbDtZVakQpzdRdScdmBEM9vxQaS7hgneQrmYtqyiH9mSHjNNYFlnRg4OehMnFwrHNOrJqRbxOCgHvDJMj1rQ7NfjstZs/bEBE+xwH1QB5E0egizPW+uPOCJ1OUy8TRsRzULU3AKGL5Y1eUdS0gRM9ZmTl6/oxiYbhFves94BsN72kH8AspAli6MPhTwvSsqmMPnKWNcLYFqf0Bm5W6VprHY3MopNfPF3oYypOeuA2z3legc4fZWSfRMypJ9R9GwtcQjsAbeTJL7aPzqSnXrDLbEoO4D6voi6hiyZFIDf6KAyuCe+/EHFau70iascOjt3xv/CNptLqn0fj75yzlRE8UlRWt3TLPPs27eiZpKd0z4S5vDvHaiH3nyKpISYwHhjko0lx5S4KgIK7Q+5rDSv5o/5Z73X2jfeA84prL64QXOC0V09Kh2FH5DuFyXiEDDlC7F+A3dvNgRhyYNSXbyGp1a0gK40m0zgjFs6Qe961puWNIs2oMsaQCn8eAS+EnEv3VAXOuieSfGk6WxJWeYTnTSyh25CVp7vnbfU7rzNGc4E+OKGGVE=
Content-Type: multipart/alternative; boundary="_000_SJ0PR02MB743976C3214FBB090F2D7D71B7682SJ0PR02MB7439namp_"
MIME-Version: 1.0
X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-99c3d.templateTenant
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR02MB7439.namprd02.prod.outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-CrossTenant-Network-Message-Id: 364e8aec-7371-4bbd-b894-08dcdce858f1
X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2024 22:29:26.1980 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR02MB7244
Message-ID-Hash: AKJ6GY2HLDSIGURBPQ35YZCVCMICDWHT
X-Message-ID-Hash: AKJ6GY2HLDSIGURBPQ35YZCVCMICDWHT
X-MailFrom: michael_b_jones@hotmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cose.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: "mprorock@mesur.io" <mprorock@mesur.io>, Orie Steele <orie@transmute.industries>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [COSE] Re: [jose] Algorithm identifiers for pre-hashing in two-party signing?
List-Id: CBOR Object Signing and Encryption <cose.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/21ns3qbaGSspYnjv4NBf7Ca9a5A>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cose>
List-Help: <mailto:cose-request@ietf.org?subject=help>
List-Owner: <mailto:cose-owner@ietf.org>
List-Post: <mailto:cose@ietf.org>
List-Subscribe: <mailto:cose-join@ietf.org>
List-Unsubscribe: <mailto:cose-leave@ietf.org>

Thanks for writing, Emil.  Here are my thoughts.

I would not suggest trying to generically extend the JOSE and COSE signing structures with additional parameters, such as creating a signing request data structure.  It would be much simpler and more aligned with how JOSE and COSE work to define new algorithm identifiers for the additional needed functionality.  These should go into the existing registries for JOSE<https://www.iana.org/assignments/jose/jose.xhtml#web-signature-encryption-algorithms> and COSE<https://www.iana.org/assignments/cose/cose.xhtml#header-algorithm-parameters>.

As you probably already know, pre-hash algorithm identifiers for Ed25519 and Ed448 are not currently registered for JOSE<https://www.iana.org/assignments/jose/jose.xhtml#web-signature-encryption-algorithms> or COSE<https://www.iana.org/assignments/cose/cose.xhtml#header-algorithm-parameters>.  I suggest creating them in a new specification.  I'd be glad to collaborate on writing that with you if you'd like.  Other needed pre-hash algorithm identifiers could also be created in the new spec.

Mike Prorock and Orie Steele, it's relevant to know whether you intent to extend to register both pre-hash and non-pre-hash algorithm identifiers in draft-ietf-cose-dilithium.  Your thoughts?

Emil, I am glad that you are working on the signing extension for WebAuthn.  I certainly support that work.

                                                                Best wishes,
                                                                -- Mike

From: Emil Lundberg <emil=40yubico.com@dmarc.ietf.org>
Sent: Friday, September 20, 2024 9:51 AM
To: cose <cose@ietf.org>; jose@ietf.org
Subject: [jose] Algorithm identifiers for pre-hashing in two-party signing?

Hi COSE and JOSE WGs,

I'm currently working on an extension to WebAuthn<https://github.com/w3c/webauthn/pull/2078> [1] for signing arbitrary data. The current draft uses `COSEAlgorithmIdentifier`s to negotiate what signature algorithm to use, and the same `COSEAlgorithmIdentifier` is also emitted in generated `COSE_Key`s to communicate the signature algorithm to the signature verifier.

However, for several reasons we want the caller of this signing API to pre-hash the data to be signed before passing it into the extension. The question then is: how should we communicate, _generically_, which steps of the signing algorithm are performed in advance by the caller and which are performed by the WebAuthn authenticator?

In some cases the division is fairly obvious. For example, ESP256<https://www.ietf.org/archive/id/draft-ietf-jose-fully-specified-algorithms-05.html> [2] hashes the input only once, so it's obvious that the caller performs the hash and the WebAuthn authenticator interprets the input as a raw P-256 scalar. Ed25519ph<https://www.rfc-editor.org/rfc/rfc8032#section-5.1> [3] hashes the input once without the key and then hashes the digest again with the key, so clearly only the first hash can be performed by the caller (and Ed25519 is impossible to implement in this way).

But for other algorithms it's less obvious - for example, for HashML-DSA<https://csrc.nist.gov/pubs/fips/204/final> [4], the caller could compute only PH_M and submit PH_M and the hash OID into the signing API, or the caller could compute M' and submit only M' into the signing API (I think the former is clearly preferable, but the point is that both options exist). Similarly for RSASSA-PSS<https://www.rfc-editor.org/rfc/rfc8017#section-9.1.1> [5], should the caller submit `mHash` or `EM`? This "division of labour" between the caller and the WebAuthn authenticator needs to be defined somehow.

So, that is my question: how should we define and communicate this division of labour?

- Is there some way we can do it generically, without defining any new algorithm identifiers?
- Should we define new algorithm identifiers for "pre-hashing for two-party signing" in some existing registry?
- Should we define a new registry of algorithm identifiers?
- Should we define some new "signing request" data structure, which can describe whether and how data is pre-hashed (perhaps similar to COSE Hash Envelopes<https://cose-wg.github.io/draft-ietf-cose-hash-envelope/draft-ietf-cose-hash-envelope.html#name-hash-envelope-cddl> [6]?)?
- Other options?

Any insight and guidance on this would be much appreciated. Of course I'm also happy to elaborate on anything that is unclear. Thank you.


[1]: https://github.com/w3c/webauthn/pull/2078
[2]: https://www.ietf.org/archive/id/draft-ietf-jose-fully-specified-algorithms-05.html
[3]: https://www.rfc-editor.org/rfc/rfc8032#section-5.1
[4]: https://csrc.nist.gov/pubs/fips/204/final
[5]: https://www.rfc-editor.org/rfc/rfc8017#section-9.1.1
[6]: https://cose-wg.github.io/draft-ietf-cose-hash-envelope/draft-ietf-cose-hash-envelope.html#name-hash-envelope-cddl


Emil Lundberg

Staff Engineer | Yubico<http://www.yubico.com/>