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 <[email protected]>
Sent: Friday, September 20, 2024 9:51 AM
To: cose <[email protected]>; [email protected]
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/>


_______________________________________________
jose mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to