| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent aeea8f4 commit 2678168
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -801,6 +801,10 @@ const kKeyOps = { | |||
| 801 | 801 | unwrapKey: 6, | |
| 802 | 802 | deriveKey: 7, | |
| 803 | 803 | deriveBits: 8, | |
| 804 | + encapsulateKey: 9, | ||
| 805 | + encapsulateBits: 10, | ||
| 806 | + decapsulateKey: 11, | ||
| 807 | + decapsulateBits: 12, | ||
| 804 | 808 | }; | |
| 805 | 809 | ||
| 806 | 810 | function validateKeyOps(keyOps, usagesSet) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -479,3 +479,16 @@ async function testImportJwk({ name, publicUsages, privateUsages }, extractable) | |||
| 479 | 479 | }); | |
| 480 | 480 | } | |
| 481 | 481 | })().then(common.mustCall()); | |
| 482 | + | ||
| 483 | + // Regression test: JWK `key_ops` validation must recognize ML-KEM operations | ||
| 484 | + // (encapsulateKey, encapsulateBits, decapsulateKey, decapsulateBits) so that | ||
| 485 | + // duplicate entries are rejected | ||
| 486 | + (async function() { | ||
| 487 | + for (const op of ['encapsulateKey', 'encapsulateBits', | ||
| 488 | + 'decapsulateKey', 'decapsulateBits']) { | ||
| 489 | + const jwk = { ...keyData['ML-KEM-768'].jwk, key_ops: [op, op] }; | ||
| 490 | + await assert.rejects( | ||
| 491 | + subtle.importKey('jwk', jwk, { name: 'ML-KEM-768' }, true, [op]), | ||
| 492 | + { name: 'DataError', message: /Duplicate key operation/ }); | ||
| 493 | + } | ||
| 494 | + })().then(common.mustCall()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments