Add support for generating ML-DSA certs with CertificateBuilder#14741
Conversation
Motivation: Post-quantum encryption algorithms are fast becoming relevant to a lot of people. NIST finalized CRYSTALS-Dilithium as ML-DSA with 3 parameter sets (44, 65, 87) in FIPS 204. Let's make it possible to create test certificates using these algorithms. Java 24 natively adds support, see: https://openjdk.org/jeps/497 For Java 11 to 23, we can support ML-DSA certificate generation with BouncyCastle. On older Java releases, we throw an exception if people try to use these algorithms. Modification: Add ML-DSA-44, ML-DSA-65, ML-DSA-87 algorithms to CertificateBuilder.Algorithm. Upgrade BouncyCastle to version 1.80, where support for these algorithms is finalized. Result: It's now possible to generate post-quantum certificates with the ML-DSA algorithms.
| } | ||
|
|
||
| static final AlgorithmParameterSpec UNSUPPORTED = new AlgorithmParameterSpec() { | ||
| }; |
There was a problem hiding this comment.
Turns out enum variants are initialized before any static fields on the enum, so this is moved to the CertificateBuilder class, to avoid namedParameterSpec returning null from the uninitialized field.
|
Draft because I also want to see if I can make a test that ties it all together and make a TLS connection using these certs. |
|
An issue that needs to be fixed here: ML-DSA private keys can be in one of two formats; seed-only and expanded. Java throws away the seed after generating the keys, so it can only produce expanded format private key PEMs (i.e. Relatedly, BoringSSL is presently in a state where they've removed support for parsing expanded-format private keys, but haven't yet added the support for parsing PEMs in seed-only format, so we can't test with the native SSL provider just yet. |
TLS support was actually not part of the JEP, so we have to punt on this as well. See https://openjdk.org/jeps/497#Non-Goals |
…y#14741) Motivation: Post-quantum encryption algorithms are fast becoming relevant to a lot of people. NIST finalized CRYSTALS-Dilithium as ML-DSA with 3 parameter sets (44, 65, 87) in FIPS 204. Let's make it possible to create test certificates using these algorithms. Java 24 natively adds support, see: https://openjdk.org/jeps/497 For Java 11 to 23, we can support ML-DSA certificate generation with BouncyCastle. On older Java releases, we throw an exception if people try to use these algorithms. Modification: Add ML-DSA-44, ML-DSA-65, ML-DSA-87 algorithms to CertificateBuilder.Algorithm. Upgrade BouncyCastle to version 1.80, where support for these algorithms is finalized. Result: It's now possible to generate post-quantum certificates with the ML-DSA algorithms.
| return key.isDestroyed(); | ||
| } | ||
|
|
||
| static byte[] getEncoded(PrivateKey key) { |
|
The JDK team is aware of the issue with the private key encoding, and are planning a fix: https://bugs.openjdk.org/browse/JDK-8347941 and openjdk/jdk#23376 |
…) (#14748) Motivation: Post-quantum encryption algorithms are fast becoming relevant to a lot of people. NIST finalized CRYSTALS-Dilithium as ML-DSA with 3 parameter sets (44, 65, 87) in FIPS 204. Let's make it possible to create test certificates using these algorithms. Java 24 natively adds support, see: https://openjdk.org/jeps/497 For Java 11 to 23, we can support ML-DSA certificate generation with BouncyCastle. On older Java releases, we throw an exception if people try to use these algorithms. Modification: Add ML-DSA-44, ML-DSA-65, ML-DSA-87 algorithms to CertificateBuilder.Algorithm. Upgrade BouncyCastle to version 1.80, where support for these algorithms is finalized. Result: It's now possible to generate post-quantum certificates with the ML-DSA algorithms. Forward port of #14741
Motivation:
Post-quantum encryption algorithms are fast becoming relevant to a lot of people. NIST finalized CRYSTALS-Dilithium as ML-DSA with 3 parameter sets (44, 65, 87) in FIPS 204. Let's make it possible to create test certificates using these algorithms.
Java 24 natively adds support, see: https://openjdk.org/jeps/497
For Java 11 to 23, we can support ML-DSA certificate generation with BouncyCastle.
On older Java releases, we throw an exception if people try to use these algorithms.
Modification:
Add ML-DSA-44, ML-DSA-65, ML-DSA-87 algorithms to CertificateBuilder.Algorithm. Upgrade BouncyCastle to version 1.80, where support for these algorithms is finalized.
Result:
It's now possible to generate post-quantum certificates with the ML-DSA algorithms.