Skip to content

Add support for generating ML-DSA certs with CertificateBuilder#14741

Merged
chrisvest merged 3 commits into
netty:4.2from
chrisvest:4.2-pqc-certs
Jan 30, 2025
Merged

Add support for generating ML-DSA certs with CertificateBuilder#14741
chrisvest merged 3 commits into
netty:4.2from
chrisvest:4.2-pqc-certs

Conversation

@chrisvest
Copy link
Copy Markdown
Member

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.

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() {
};
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@chrisvest
Copy link
Copy Markdown
Member Author

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.

@chrisvest
Copy link
Copy Markdown
Member Author

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. PrivateKey.getEncoded() returns the expanded-format DER; FYI @seanjmullan).
However, the industry is aligning behind the seed-only format. See https://www.ietf.org/archive/id/draft-ietf-lamps-dilithium-certificates-06.html#name-private-key-format

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.

@chrisvest
Copy link
Copy Markdown
Member Author

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.

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

@chrisvest chrisvest marked this pull request as ready for review January 29, 2025 23:21
@normanmaurer normanmaurer added this to the 4.2.0.Final milestone Jan 30, 2025
@chrisvest chrisvest merged commit 6313d0c into netty:4.2 Jan 30, 2025
@chrisvest chrisvest deleted the 4.2-pqc-certs branch January 30, 2025 18:11
chrisvest added a commit to chrisvest/netty that referenced this pull request Jan 30, 2025
…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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is superfluous

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@chrisvest
Copy link
Copy Markdown
Member Author

chrisvest commented Jan 31, 2025

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

normanmaurer pushed a commit that referenced this pull request Jan 31, 2025
…) (#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
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.

3 participants