Skip to content

Conversation

@twiss
Copy link
Collaborator

@twiss twiss commented Jan 8, 2025

No description provided.

@Frosne
Copy link
Contributor

Frosne commented Feb 17, 2025

Not sure if it's worth an issue, so writing here:

You introduced raw-secret in 4.1 Data Types, but you're not using it anywhere. I understand that it's a part of the discussion about exporting private keys as seed/raw bytes, maybe we should specify it somewhere?

@twiss
Copy link
Collaborator Author

twiss commented Feb 21, 2025

Thanks for pointing it out! My plan was to switch from "raw" to "raw-secret" for the symmetric algorithms proposed in this document (AES-OCB, ChaCha20-Poly1305, etc.), and propose to allow the same for other existing symmetric algorithms in Web Crypto, and deprecate the use of "raw" (as it's a bit ambiguous). I didn't get to it yet, though.
"raw-private" would instead be used for raw private (asymmetric) keys; indeed this document has no examples unless we add support for semi-expanded ML-KEM and ML-DSA keys. But, other existing asymmetric algorithms in Web Crypto could use it potentially, so I included it for completeness.
Alternatively, we could also try to introduce it in the Web Crypto repo directly and then adopt it here later if necessary :)

@twiss twiss changed the title WIP: Define ML-KEM WIP: Define ML-KEM and ML-DSA Feb 26, 2025
@twiss twiss marked this pull request as draft February 26, 2025 09:40
@panva
Copy link
Collaborator

panva commented Feb 27, 2025

@twiss please see https://datatracker.ietf.org/doc/draft-ietf-cose-dilithium/ for ML-DSA appropriate JWK format and JWK "alg" identifiers.

@panva
Copy link
Collaborator

panva commented Mar 1, 2025

@twiss please see datatracker.ietf.org/doc/draft-ietf-cose-dilithium for ML-DSA appropriate JWK format and JWK "alg" identifiers.

Note that this is a draft and may still change. The important part that's different from previous JWK representations

  • new "kty" (JWK Key Type) value "AKP" - Algorithm Key Pair
  • "alg" is a required JWK property (to be checked during import, and must be present during export)
  • "priv" is a seed, not the the expanded expression

Both "priv" and "pub" must be present in private JWK representations.

If you've got any feedback then please present it on the COSE WG mailing list.

@twiss
Copy link
Collaborator Author

twiss commented Mar 4, 2025

@panva Thanks for pointing that out! It looks reasonable to me.

@panva
Copy link
Collaborator

panva commented Mar 6, 2025

On that same note, see https://datatracker.ietf.org/doc/draft-ietf-jose-pqc-kem/ for ML-KEM

@twiss twiss changed the title WIP: Define ML-KEM and ML-DSA Define ML-KEM, ML-DSA and SLH-DSA Mar 7, 2025
@panva
Copy link
Collaborator

panva commented Mar 10, 2025

JOSE Definitions for SLH-DSA-SHA2-128s, SLH-DSA-SHAKE-128s, and SLH-DSA-SHA2-128f are in https://datatracker.ietf.org/doc/draft-ietf-cose-sphincs-plus/

@twiss
Copy link
Collaborator Author

twiss commented Jul 3, 2025

@panva I've taken a stab at defining JWK import and export for the PQC algorithms; please take a look if you have time and let me know whether it looks reasonable 😊

@panva
Copy link
Collaborator

panva commented Jul 3, 2025

@twiss Thank you, is there a deployed preview I could use for the review?

@twiss twiss marked this pull request as ready for review July 3, 2025 16:25
@twiss
Copy link
Collaborator Author

twiss commented Jul 3, 2025

Comment on lines +2910 to +2914
If the {{JsonWebKey/pub}} attribute of |jwk|
does not contain the base64url encoded public key
representing the SLH-DSA public key
corresponding to |key|,
then [= exception/throw =] a {{DataError}}.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this possible for SLH-DSA?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so; in an SLH-DSA private key, both the private and public values are included (see FIPS 205, Figure 15). If the AKP key type requires both the pub and priv properties, then it's possible for them not to match. But it should be trivial to check for SLH-DSA, basically the second half of priv needs to equal pub.

In the example in Appendix 1.1 of draft-ietf-cose-sphincs-plus-05, it looks like the first half of priv matches pub rather than the second half, but I imagine that's a mistake.

Section 5.1 also talks about validating public keys, though I'm not 100% sure if they're talking about this or something else.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically the second half of priv needs to equal pub.

You're 100% right. Thank you.

@twiss
Copy link
Collaborator Author

twiss commented Jul 8, 2025

I'll merge this for now; we can always make changes later. We may also still want to add spki and pkcs8 import/export at some point.

@twiss twiss merged commit 95303d7 into main Jul 8, 2025
1 check passed
@twiss twiss deleted the pqc branch July 8, 2025 12:06
@panva
Copy link
Collaborator

panva commented Jul 8, 2025

We may also still want to add spki and pkcs8 import/export at some point.

For sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants