Skip to content

crypto: reject ML-KEM/ML-DSA PKCS#8 import without seed in SubtleCrypto#62218

Open
panva wants to merge 1 commit intonodejs:mainfrom
panva:ml-kem-dsa-subtle-import
Open

crypto: reject ML-KEM/ML-DSA PKCS#8 import without seed in SubtleCrypto#62218
panva wants to merge 1 commit intonodejs:mainfrom
panva:ml-kem-dsa-subtle-import

Conversation

@panva
Copy link
Member

@panva panva commented Mar 11, 2026

Reject importing ML-KEM and ML-DSA PKCS#8 private keys that do not include a seed, throwing NotSupportedError.

Also add tests for importing PKCS#8 keys with a mismatched expanded key.

Refs: https://redirect.github.com/WICG/webcrypto-modern-algos/pull/34

Note: both of these algorithms are marked as experimental Issues and PRs related to experimental features.

@panva panva added crypto Issues and PRs related to the crypto subsystem. experimental Issues and PRs related to experimental features. webcrypto labels Mar 11, 2026
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Mar 11, 2026

Review requested:

  • @nodejs/crypto
  • @nodejs/web-standards

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Mar 11, 2026
Reject importing ML-KEM and ML-DSA PKCS#8 private keys that do not
include a seed, throwing NotSupportedError.

Also add tests for importing PKCS#8 keys with a mismatched expanded key.

Refs: https://redirect.github.com/WICG/webcrypto-modern-algos/pull/34
@panva panva force-pushed the ml-kem-dsa-subtle-import branch from e99ae40 to dc1212a Compare March 11, 2026 21:20
@panva panva marked this pull request as ready for review March 11, 2026 21:20
@nodejs-github-bot

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.67%. Comparing base (aaa9151) to head (dc1212a).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #62218   +/-   ##
=======================================
  Coverage   89.67%   89.67%           
=======================================
  Files         676      676           
  Lines      206451   206477   +26     
  Branches    39529    39533    +4     
=======================================
+ Hits       185139   185165   +26     
+ Misses      13451    13443    -8     
- Partials     7861     7869    +8     
Files with missing lines Coverage Δ
lib/internal/crypto/ml_dsa.js 95.16% <100.00%> (+1.45%) ⬆️
lib/internal/crypto/ml_kem.js 92.10% <100.00%> (+1.72%) ⬆️

... and 28 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot
Copy link
Collaborator

case 'pkcs8': {
verifyAcceptableMlDsaKeyUse(name, false, usagesSet);

const privOnlyLengths = {
Copy link
Member

Choose a reason for hiding this comment

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

Should we just create them on the root scope?

@panva panva added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. crypto Issues and PRs related to the crypto subsystem. experimental Issues and PRs related to experimental features. needs-ci PRs that need a full CI run. webcrypto

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants