Yes, the ARKG draft is in CFRG. I just put the "two-party signing algorithm
identifiers" mockup there to have an easy way to show the idea, the rest of
the document outside sections 5.3 and 5.2 are unrelated to this discussion.

If you don't want domain separation, then you simply need to identify
> registered algorithms,


For the keys and the resulting cryptograms, yes. But that's not what my
question was about.

[...] where you can do the pre hash part separate from the signing part.

[...]

[...] but be careful, this does not generalize to other COSE digital
> signature schemes, like Ed25519 / EdDSA.


This is what I'm asking about - or, more precisely, how to communicate
where the separation happens between "pre hash part" and "signing part".
Like you point out, there's no way to describe that generically, especially
since some algorithms like PureEdDSA and ML-DSA *can't* be separated like
that.

If you ask some remote kms / device for a key reference that can do "pre
> hash with -16, sign with -7, on kty 1, with curve 1", you could get back a
> key identifier which could resolve to a "almost fully specified cose key"


I think you misunderstood the idea. What we want to express is rather
"please sign this with -9, but I have already hashed it with -16, so please
skip the hash step". The usual COSE/JOSE algorithm identifiers - whether
fully specified or not - don't (and shouldn't) express this division of
labour during signing, they only express what procedure a verifier should
use to verify the resulting signature. The question is whether the mockup I
linked seems like a good way to express "please skip the hash step" during
signature generation.

Emil Lundberg

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




Den tors 3 okt. 2024 kl 19:11 skrev Orie Steele <[email protected]>:

> If you don't want domain separation, then you simply need to identify
> registered algorithms, where you can do the pre hash part separate from the
> signing part.
>
> Beware of the forgery potential if the hash function is broken in the
> future.
>
> ESP256 is a good example of this.
>
> SHA-256 (message) -> ... -> ECDSA using P-256
>
> You might also consider
> https://datatracker.ietf.org/doc/draft-ietf-cose-key-thumbprint/
> Although it looks like you may need the kid parameter as part of the ARKG
> construction...
>
> Without fully specified algorithms, you can still accomplish this, but you
> need to manage the parameters as follows:
>
> cose_hash_alg: -16 / sha-256 /
>
> cose_key_sign_alg: -7 / ES256 (ECDSA with SHA-256 prehash on ANY CURVE) /
> cose_key_kty: 2 / EC2 /
> cose_key_crv: 1 / P-256 /
>
> If you ask some remote kms / device for a key reference that can do "pre
> hash with -16, sign with -7, on kty 1, with curve 1", you could get back a
> key identifier which could resolve to a "almost fully specified cose key"
> (an api could error if you asked for pre hash with -16 (SHA-256) but sign
> with -35 (ES384) for example):
>
> / cose key / {
>  / kid /  2 : h'4741579f...e6cc42ef', / maybe computed from the thumbprint
> draft above /
>  / kty /  1 : 2, / EC2 /
>  / alg /  3 : -7, / -9 for ESP256 (either way -16 pre hash is implied) /
>  / crv / -1 : 1, / P-256 /
>  / x   / -2 : h'c7282bcb...3328dd7d',
>  / y   / -3 : h'e37ad72f...31f6edc2',
>  / d   / -4 : h'88aa8624...b8ce1856', / only if its exportable /
> }
>
> In this example, both -7 or -9 (requested assignment for ESP256) imply
> pre-hash with -16 .... but be careful, this does not generalize to other
> COSE digital signature schemes, like Ed25519 / EdDSA.
>
> The key blinding stuff you have in Section 3.1 feels like it belongs in a
> CFRG document.
>
> I wonder if it's possible to get ARKG to work while colliding on existing
> kty or kid assignments.
>
> You could introduce some structure to kid (which is bstr / tstr) to
> accomplish this: (ARKG params (including kty stuff if needed) + (normal
> thumbprint)
>
> Interesting draft.
>
> OS
>
>
>
>
>
> On Thu, Oct 3, 2024 at 11:39 AM Emil Lundberg <[email protected]> wrote:
>
>> Hi Mike and Orie, thank you for your replies (see Orie's reply on GitHub
>> <https://github.com/w3c/webauthn/pull/2078#issuecomment-2364535837>).
>> I've now had some time to digest them (pun intended) and consider how to
>> proceed.
>>
>> I agree that distinct algorithm identifiers seems like a suitable
>> solution for this. I mocked up an outline of the idea, including a few
>> examples of what this might look like for a couple of algorithms, which you
>> can see here for the time being:
>> https://yubico.github.io/arkg-rfc/cose-two-party-sign-algs/draft-bradleylundberg-cfrg-arkg.html#name-temporary-cose-algorithms-f
>> (This address is temporary, we'll move the draft somewhere more
>> appropriate when the ideas are more mature)
>> The relevant section is "5.3. TEMPORARY: COSE algorithms for two-party
>> signing", but it also lightly ties into the preceding section "5.2. COSE
>> key reference types" for things like the *ctx* parameter in HashML-DSA.
>> Perhaps this better illustrates what we're trying to do.
>>
>> As noted in the introduction section, this is subtly different from COSE
>> Hash Envelope (CHE), for example, if I understood CHE correctly. We
>> deliberately want to *avoid* domain-separating these signatures, and
>> avoid an additional protocol-level hash layer. The hope is to be able to
>> generate signatures that look the same as usual, and verify the same as
>> usual, but without having to send the entire original message to the
>> cryptographic hardware that holds the private key. These algorithm
>> identifiers therefore wouldn't appear on signature structures or keys, as
>> those would still be tagged with the existing identifier for the usual
>> signature (verification) algorithm.
>>
>> This would enable our WebAuthn raw signing extension to output signatures
>> that can be fed into existing verifiers, without needing to adapt those
>> verifiers and cryptographic protocols to accomodate a protocol-level
>> prehash. This also enables structuring the extension such that the WebAuthn
>> Relying Party and authenticator (e.g., security key) can negotiate a
>> two-party signature algorithm without needing the WebAuthn client (browser)
>> to support it - the client just passes the data through.
>>
>> Please have a look at the mockup link above. Does this (and the related
>> COSE_Key_Ref idea) seem like a reasonable approach?
>>
>> Emil Lundberg
>>
>> Staff Engineer | Yubico <http://www.yubico.com/>
>>
>>
>>
>>
>> Den ons 25 sep. 2024 kl 00:29 skrev Michael Jones <
>> [email protected]>:
>>
>>> 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/>
>>>
>>>
>>>
>>
>
> --
>
>
> ORIE STEELE
> Chief Technology Officer
> www.transmute.industries
>
> <https://transmute.industries>
>
_______________________________________________
jose mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to