GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — crypto: reject duplicate ML-KEM JWK key_ops · nodejs/node@6eea524

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/crypto
    • util.js
  • test/parallel
    • test-webcrypto-export-import-ml-kem.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/crypto/util.js‎

Copy file name to clipboardExpand all lines: lib/internal/crypto/util.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,10 @@ const kKeyOps = {
801801
unwrapKey: 6,
802802
deriveKey: 7,
803803
deriveBits: 8,
804+
encapsulateKey: 9,
805+
encapsulateBits: 10,
806+
decapsulateKey: 11,
807+
decapsulateBits: 12,
804808
};
805809

806810
function validateKeyOps(keyOps, usagesSet) {
Collapse file

‎test/parallel/test-webcrypto-export-import-ml-kem.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-webcrypto-export-import-ml-kem.js
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,16 @@ async function testImportRawSeed({ name, privateUsages }, extractable) {
321321
});
322322
}
323323
})().then(common.mustCall());
324+
325+
// Regression test: JWK `key_ops` validation must recognize ML-KEM operations
326+
// (encapsulateKey, encapsulateBits, decapsulateKey, decapsulateBits) so that
327+
// duplicate entries are rejected
328+
(async function() {
329+
for (const op of ['encapsulateKey', 'encapsulateBits',
330+
'decapsulateKey', 'decapsulateBits']) {
331+
const jwk = { ...keyData['ML-KEM-768'].jwk, key_ops: [op, op] };
332+
await assert.rejects(
333+
subtle.importKey('jwk', jwk, { name: 'ML-KEM-768' }, true, [op]),
334+
{ name: 'DataError', message: /Duplicate key operation/ });
335+
}
336+
})().then(common.mustCall());

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.