GeezerVison is showing github.com — test: update WPT for WebCryptoAPI to c9e955840a · nodejs/node@456abc7
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/README.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,7 @@ Last update: | 34 | 34 | - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi | 35 | 35 | - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi | 36 | 36 | - web-locks: https://github.com/web-platform-tests/wpt/tree/10a122a6bc/web-locks | 37 | | -- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/42e47329fd/WebCryptoAPI | | 37 | +- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/c9e955840a/WebCryptoAPI | 38 | 38 | - webidl: https://github.com/web-platform-tests/wpt/tree/63ca529a02/webidl | 39 | 39 | - webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/2f96fa1996/webidl/ecmascript-binding/es-exceptions | 40 | 40 | - webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/6495c91853/webmessaging/broadcastchannel | |
Collapse file Copy file name to clipboard +52Lines changed: 52 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +// META: title=WebCryptoAPI: Algorithm normalization matches names ASCII case-insensitively | | 2 | +// U+212A is the Kelvin Sign | | 3 | + | | 4 | +function makeSalt() { | | 5 | + return crypto.getRandomValues(new Uint8Array(32)); | | 6 | +} | | 7 | + | | 8 | +async function makeKey(algorithm) { | | 9 | + const keyData = new Uint8Array([]); | | 10 | + return crypto.subtle.importKey("raw", keyData, algorithm, false, ["deriveBits"]); | | 11 | +} | | 12 | + | | 13 | +promise_test(async (t) => { | | 14 | + const algorithm = { | | 15 | + name: "H\u212ADF", | | 16 | + hash: "SHA-256", | | 17 | + salt: makeSalt(), | | 18 | + info: new TextEncoder().encode(''), | | 19 | + }; | | 20 | + const key = await makeKey("HKDF"); | | 21 | + const p = crypto.subtle.deriveBits(algorithm, key, 256); | | 22 | + return promise_rejects_dom(t, "NotSupportedError", p, algorithm.name); | | 23 | +}, `"H<U+212A>DF" does not match "HKDF"`); | | 24 | + | | 25 | +promise_test(async (t) => { | | 26 | + const algorithm = { | | 27 | + name: "PB\u212ADF2", | | 28 | + hash: "SHA-256", | | 29 | + iterations: 1, | | 30 | + salt: makeSalt(), | | 31 | + }; | | 32 | + const key = await makeKey("PBKDF2"); | | 33 | + const p = crypto.subtle.deriveBits(algorithm, key, 256); | | 34 | + return promise_rejects_dom(t, "NotSupportedError", p, algorithm.name); | | 35 | +}, `"PB<U+212A>DF2" does not match "PBKDF2"`); | | 36 | + | | 37 | +promise_test(async (t) => { | | 38 | + const algorithm = {name: "AES-\u212AW", length: 256}; | | 39 | + const p = crypto.subtle.generateKey(algorithm, false, ["wrapKey"]); | | 40 | + return promise_rejects_dom(t, "NotSupportedError", p, algorithm.name); | | 41 | +}, `"AES-<U+212A>W" does not match "AES-KW"`); | | 42 | + | | 43 | +promise_test(async (t) => { | | 44 | + const algorithm = { | | 45 | + name: "RSASSA-P\u212ACS1-V1_5", | | 46 | + modulusLength: 2048, | | 47 | + publicExponent: new Uint8Array([3]), | | 48 | + hash: "SHA-256", | | 49 | + }; | | 50 | + const p = crypto.subtle.generateKey(algorithm, false, ["sign"]); | | 51 | + return promise_rejects_dom(t, "NotSupportedError", p, algorithm.name); | | 52 | +}, `"RSASSA-P<U+212A>CS1-V1_5" does not match "RSASSA-PKCS1-V1_5"`); |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.https.any.js +21-3Lines changed: 21 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 40 | 40 | name: "AES-KW", | 41 | 41 | importParameters: {name: "AES-KW", length: 128}, | 42 | 42 | wrapParameters: {name: "AES-KW"} | | 43 | + }, | | 44 | + { | | 45 | + name: 'ChaCha20-Poly1305', | | 46 | + importParameters: {name: "ChaCha20-Poly1305"}, | | 47 | + wrapParameters: {name: "ChaCha20-Poly1305", iv: new Uint8Array(12), additionalData: new Uint8Array(16)} | 43 | 48 | } | 44 | 49 | ]; | 45 | 50 |
| | 57 | 62 | {algorithm: {name: "AES-CBC", length: 128}, usages: ["encrypt", "decrypt"]}, | 58 | 63 | {algorithm: {name: "AES-GCM", length: 128}, usages: ["encrypt", "decrypt"]}, | 59 | 64 | {algorithm: {name: "AES-KW", length: 128}, usages: ["wrapKey", "unwrapKey"]}, | 60 | | - {algorithm: {name: "HMAC", length: 128, hash: "SHA-256"}, usages: ["sign", "verify"]} | | 65 | + {algorithm: {name: "HMAC", length: 128, hash: "SHA-256"}, usages: ["sign", "verify"]}, | | 66 | + {algorithm: {name: "ChaCha20-Poly1305"}, usages: ['encrypt', 'decrypt']} | 61 | 67 | ]; | 62 | 68 |
| 63 | 69 | // Import all the keys needed, then iterate over all combinations | | 106 | 112 | .then(function(key) { | 107 | 113 | wrappers["RSA-OAEP"].unwrappingKey = key; | 108 | 114 | })); | | 115 | + } else if (params.name === "ChaCha20-Poly1305") { | | 116 | + var algorithm = {name: params.name}; | | 117 | + promises.push(subtle.importKey("raw", wrappingKeyData["SYMMETRIC256"].raw, algorithm, true, ["wrapKey", "unwrapKey"]) | | 118 | + .then(function(key) { | | 119 | + wrappers[params.name] = {wrappingKey: key, unwrappingKey: key, parameters: params}; | | 120 | + })); | 109 | 121 | } else { | 110 | 122 | var algorithm = {name: params.name}; | 111 | | - promises.push(subtle.importKey("raw", wrappingKeyData["SYMMETRIC"].raw, algorithm, true, ["wrapKey", "unwrapKey"]) | | 123 | + promises.push(subtle.importKey("raw", wrappingKeyData["SYMMETRIC128"].raw, algorithm, true, ["wrapKey", "unwrapKey"]) | 112 | 124 | .then(function(key) { | 113 | 125 | wrappers[params.name] = {wrappingKey: key, unwrappingKey: key, parameters: params}; | 114 | 126 | })); | | 151 | 163 | var keyData = toWrapKeyDataFromAlg(params.algorithm.name); | 152 | 164 | promises.push(importAndExport("spki", keyData.spki, params.algorithm, params.publicUsages, "public key ")); | 153 | 165 | promises.push(importAndExport("pkcs8", keyData.pkcs8, params.algorithm, params.privateUsages, "private key ")); | | 166 | + } else if (params.algorithm.name === "ChaCha20-Poly1305") { | | 167 | + keys[params.algorithm.name] = {}; | | 168 | + promises.push(importAndExport("raw", toWrapKeyData["SYMMETRIC256"].raw, params.algorithm, params.usages, "")); | 154 | 169 | } else { | 155 | 170 | keys[params.algorithm.name] = {}; | 156 | | - promises.push(importAndExport("raw", toWrapKeyData["SYMMETRIC"].raw, params.algorithm, params.usages, "")); | | 171 | + promises.push(importAndExport("raw", toWrapKeyData["SYMMETRIC128"].raw, params.algorithm, params.usages, "")); | 157 | 172 | } | 158 | 173 | }); | 159 | 174 | // Using allSettled to skip unsupported test cases. | | 432 | 447 | case "ECDH" : | 433 | 448 | deriveParams = {name: "ECDH"}; | 434 | 449 | break; | | 450 | + case "ChaCha20-Poly1305": | | 451 | + cryptParams = {name: "ChaCha20-Poly1305", iv: new Uint8Array(12)}; | | 452 | + break; | 435 | 453 | default: | 436 | 454 | throw new Error("Unsupported algorithm for key comparison"); | 437 | 455 | } | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey_vectors.js +8-2Lines changed: 8 additions & 2 deletions Collapse file Copy file name to clipboardExpand all lines: test/fixtures/wpt/versions.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 96 | 96 | "path": "web-locks" | 97 | 97 | }, | 98 | 98 | "WebCryptoAPI": { | 99 | | - "commit": "42e47329fdc92c80d58c2816eb66cb2cf2b32a89", | | 99 | + "commit": "c9e955840a21be6e492225a4a53fc4828d8933b9", | 100 | 100 | "path": "WebCryptoAPI" | 101 | 101 | }, | 102 | 102 | "webidl": { | |
|