mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
test: update WPT for WebCryptoAPI to c9e955840a
PR-URL: https://github.com/nodejs/node/pull/62147 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
17c76c1775
commit
9220d4e752
5 files changed
+83
-7
No files matched your search
@@ -0,0 +1,52 @@
|
||||
// META: title=WebCryptoAPI: Algorithm normalization matches names ASCII case-insensitively
|
||||
// U+212A is the Kelvin Sign
|
||||
|
||||
function makeSalt() {
|
||||
return crypto.getRandomValues(new Uint8Array(32));
|
||||
}
|
||||
|
||||
async function makeKey(algorithm) {
|
||||
const keyData = new Uint8Array([]);
|
||||
return crypto.subtle.importKey("raw", keyData, algorithm, false, ["deriveBits"]);
|
||||
}
|
||||
|
||||
promise_test(async (t) => {
|
||||
const algorithm = {
|
||||
name: "H\u212ADF",
|
||||
hash: "SHA-256",
|
||||
salt: makeSalt(),
|
||||
info: new TextEncoder().encode(''),
|
||||
};
|
||||
const key = await makeKey("HKDF");
|
||||
const p = crypto.subtle.deriveBits(algorithm, key, 256);
|
||||
return promise_rejects_dom(t, "NotSupportedError", p, algorithm.name);
|
||||
}, `"H<U+212A>DF" does not match "HKDF"`);
|
||||
|
||||
promise_test(async (t) => {
|
||||
const algorithm = {
|
||||
name: "PB\u212ADF2",
|
||||
hash: "SHA-256",
|
||||
iterations: 1,
|
||||
salt: makeSalt(),
|
||||
};
|
||||
const key = await makeKey("PBKDF2");
|
||||
const p = crypto.subtle.deriveBits(algorithm, key, 256);
|
||||
return promise_rejects_dom(t, "NotSupportedError", p, algorithm.name);
|
||||
}, `"PB<U+212A>DF2" does not match "PBKDF2"`);
|
||||
|
||||
promise_test(async (t) => {
|
||||
const algorithm = {name: "AES-\u212AW", length: 256};
|
||||
const p = crypto.subtle.generateKey(algorithm, false, ["wrapKey"]);
|
||||
return promise_rejects_dom(t, "NotSupportedError", p, algorithm.name);
|
||||
}, `"AES-<U+212A>W" does not match "AES-KW"`);
|
||||
|
||||
promise_test(async (t) => {
|
||||
const algorithm = {
|
||||
name: "RSASSA-P\u212ACS1-V1_5",
|
||||
modulusLength: 2048,
|
||||
publicExponent: new Uint8Array([3]),
|
||||
hash: "SHA-256",
|
||||
};
|
||||
const p = crypto.subtle.generateKey(algorithm, false, ["sign"]);
|
||||
return promise_rejects_dom(t, "NotSupportedError", p, algorithm.name);
|
||||
}, `"RSASSA-P<U+212A>CS1-V1_5" does not match "RSASSA-PKCS1-V1_5"`);
|
||||
Reference in new issue
Block a user