Repository navigation
Add support for ML-DSA signatures - #535
PhilSchmieder wants to merge 7 commits into
Conversation
arckoor
left a comment
There was a problem hiding this comment.
Very hasty review only, but looks like the right direction.
- How were the keys for the tests generated? OpenSSL, or through rust-crypto, or something else entirely? (just curious)
- The JWK dance with serde I'm not a huge fan of, I would like to find a way to make that unnecessary
I used OpenSSL to generate the test keys. I also don't like the serialization stuff. I guess than can be fixed with either changing the "JwkWire" representation or the AKP params. I tend to keeping the alg member in the AKP parameters to be RFC compliant and to future proof. |
|
The I'll try to do a full review sometime next week. |
arckoor
left a comment
There was a problem hiding this comment.
Sorry this took so long.
I played around with the JwkWire thing for a while, I didn't find a nice way to get rid of it. However I would not duplicate the alg field between them, and instead deser the json into JwkWire, reassemble into Jwk and beforehand check if alg needs to be present
if let AlgorithmParameters::AlgorithmKeyPair(_) = &algorithm {
common.key_algorithm.ok_or_else(|| de::Error::missing_field("alg"))?;
}|
Hi, can you please review the changes I made when you get a chance? Thanks! |
|
@PhilSchmieder I will give this a look again when it's time to merge it, which won't be at least until the next major and until the rust crypto people release rsa v10 so we can bump that stack. If you want to prepare for that you can remove your getrandom changes from the If you're very bored you can have a look at the jsonwebtoken-providers repo, I'd take an accompanying PR there, though subject to the same "won't be merged until ..." restrictions, so might be better to tackle that once this is actually merged. |
Closes #534
Summary
Adds ML-DSA signature support following FIPS 204 and RFC 9964.
aws_lc_rsandrust_cryptobackends.kty: "AKP"JWK import, export, and thumbprints.Implementation Decisions
ML-DSA uses the RFC 9964 wire names (
ML-DSA-44,ML-DSA-65, andML-DSA-87) while retaining regular Rust variants such asAlgorithm::MLDSA44.Signing uses the deterministic variant of ML-DSA with an empty context.
Variable
algexists in both the common JWK parameters and the AKP algorithm parameters as specified in RFC 9964. Serialization toJwkWireflattens them to one parameter which causes all sorts of problems when doing naively. I opted to introduce custom (de-) serialization logic that uses both locations. Serialization rejects conflicting values, and emits onealgmember. Deserialization populates the AKP algorithm parameter and the common parameter.Dependencies Notes
aws-lc-rscrate updated from 1.15 to 1.18 because the stable ML-DSA API is only available in 1.18.ml-dsausessignature3.x while this crate still directly usessignature2.2.Open to discussion on the implementation decisions and how dependencies like the 'signature' crate is handled especially since other issues / PRs mention this too.