dotnet / dotnet/runtime

ML-DSA support on CryptoKit

Open
#120,550 5 comments 1 reaction 1 assignee Claimed by @vcsjones View on GitHub
area-System.Security os-ios os-mac-os-x os-tvos
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

Apple introduced ML-DSA in CryptoKit in Apple Platform 26. We should light up `MLDsa` on Apple platforms with CryptoKit.

Some notable details on CryptoKit.

1. No Security Category < 3, so that means ML-DSA-44 parameter set is not supported.
2. CryptoKit does not support FIPS-204 private keys. Only private seeds. Practically, that means `ExportMLDsaPrivateKey`, `ExportMLDsaPrivateKeyPem`, and their import variants are going to throw `PlatformNotSupportedException`.
3. We need to decide how PKCS#8 imports work. ML-DSA private keys, as of IETF draft 13, are `seed`, `expandedKey`, and `both`.

1. `seed` will work just work.
2. `expandedKey` is going to throw.
3. `both`, we can do one of two ways. The challenge here is what to do with `expandedKey` in the SEQUENCE. We have no ability to validate the `expandedKey`. We can ignore it (inconsistent with other platforms, as well as allowing inconsistencies in private key structures) and just import the seed, or we can always throw because don't have the information needed to validate the `expandedKey`. Throwing is tempted, except for the fact that by default OpenSSL CLI produces `both` if the key has a seed. So OpenSSL CLI will create PKCS#8 private keys that are `both` if it can. This is different from .NET on OpenSSL however, where we will always produce `seed` if we can, otherwise `expandedKey`, but never both.

4. No X.509 or key services support. Apple does not support certificates with ML-DSA signatures or keys. So this support from CryptoKit only offers `MLDsa` primitive support. That means `X509Certificate2` APIs that work with keys will not be supported. SubjectPublicKeyInfo on `X509Certificate2` and in `PublicKey` are going to work.
5. No external Mu support.
6. No PreHash support.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.