Skip to content

8347938: Add Support for the Latest ML-KEM and ML-DSA Private Key Encodings#446

Open
rm-gh-8 wants to merge 1 commit intoopenjdk:masterfrom
rm-gh-8:JDK-8347938-V25
Open

8347938: Add Support for the Latest ML-KEM and ML-DSA Private Key Encodings#446
rm-gh-8 wants to merge 1 commit intoopenjdk:masterfrom
rm-gh-8:JDK-8347938-V25

Conversation

@rm-gh-8
Copy link
Copy Markdown
Contributor

@rm-gh-8 rm-gh-8 commented Apr 2, 2026

Backporting JDK-8347938: Add Support for the Latest ML-KEM and ML-DSA Private Key Encodings.

This PR updates ML-KEM and ML-DSA private key encodings to comply with draft-ietf-lamps-kyber-certificates-11 and RFC 9881, which define private keys as a DER-encoded ASN.1 CHOICE of three formats (seed, expandedKey, or both), replacing the JDK 24 implementation that only supported the FIPS 203/204 expanded format.

This PR is not clean because it skips JDK-8349732, which introduces behavioral changes which will require a new CSR. A new file ("test/lib/jdk/test/lib/security/RepositoryFileReader.java") was added in this PR from the skipped commit, and conflicts were resolved on "test/jdk/sun/security/provider/acvp/Launcher.java".

For parity with Oracle JDK.

Ran related tests on macos-aarch64 (with kyber certificates repo) :

~/github/jtreg/build/images/jtreg/bin/jtreg -jdk build/macosx-aarch64-server-release/images/jdk -Djdk.tests.repos.pattern="file:///Users/$USER/repos/lamps-wg/%n/%e" test/jdk/sun/security/provider

Results:

test result: Passed. Execution successful

PrivateKeyEncodings.jtr.txt

summary.txt (all tests)

Ran related tests on linux-x64, linux-aarch64, macos-aarch64 and windows-x64 (no kyber certificates repo):

make test TEST=test/jdk/sun/security/provider
make test TEST=test/jdk/javax/crypto/KEM

Results attached:

windows-x64-specific-test.log
windows-x64-specific-2-test.log
macos-aarch64-specific-test.log
macos-aarch64-specific-2-test.log
linux-x64-specific-test.log
linux-x64-specific-2-test.log
linux-aarch64-specific-test.log
linux-aarch64-specific-2-test.log


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8349163 to be approved
  • JDK-8347938 needs maintainer approval

Issues

  • JDK-8347938: Add Support for the Latest ML-KEM and ML-DSA Private Key Encodings (Bug - P2 - Requested)
  • JDK-8349163: Add Support for the Latest ML-KEM and ML-DSA Private Key Encodings (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk25u-dev.git pull/446/head:pull/446
$ git checkout pull/446

Update a local copy of the PR:
$ git checkout pull/446
$ git pull https://git.openjdk.org/jdk25u-dev.git pull/446/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 446

View PR using the GUI difftool:
$ git pr show -t 446

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk25u-dev/pull/446.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Apr 2, 2026

👋 Welcome back rmesde! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 2, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title Backport e51ccef9cb415ed31db70971bb439ca3d96c5bce 8347938: Add Support for the Latest ML-KEM and ML-DSA Private Key Encodings Apr 2, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 2, 2026

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added the backport Port of a pull request already in a different code base label Apr 2, 2026
@rm-gh-8 rm-gh-8 marked this pull request as ready for review April 2, 2026 15:42
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 2, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Apr 2, 2026

Webrevs

Copy link
Copy Markdown
Member

@phohensee phohensee left a comment

Choose a reason for hiding this comment

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

Looks ok. Might be worth backporting JDK-8349732, even though it has a CSR, which looks like a pure addition.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 2, 2026

⚠️ @rm-gh-8 This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@rm-gh-8
Copy link
Copy Markdown
Contributor Author

rm-gh-8 commented Apr 2, 2026

@phohensee I'll ask for maintainer approval and will act based on their feedback.

@rm-gh-8
Copy link
Copy Markdown
Contributor Author

rm-gh-8 commented Apr 2, 2026

/approval request for backport of JDK-8347938: Add Support for the Latest ML-KEM and ML-DSA Private Key Encodings.

For parity with Oracle JDK.

Medium risk — this changes the default private key encoding from expanded to seed format. Existing serialized keys in expanded format will still be readable (all three CHOICE formats are supported on input), but newly generated keys will encode differently by default. In addition, the NamedKeyFactory becoming abstract is a source-breaking change for any external subclasses.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 2, 2026

@rm-gh-8
8347938: The approval request has been created successfully.

@openjdk openjdk bot added the approval Requires approval; will be removed when approval is received label Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval Requires approval; will be removed when approval is received backport Port of a pull request already in a different code base rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants