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 — test: update WPT for WebCryptoAPI to 2cb332d710 · nodejs/node@3796a73

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/fixtures/wpt
    • README.md
    • WebCryptoAPI/import_export
      • raw_format_aliases.tentative.https.any.js
    • versions.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/fixtures/wpt/README.md‎

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 numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Last update:
3434
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
3535
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
3636
- web-locks: https://github.com/web-platform-tests/wpt/tree/10a122a6bc/web-locks
37-
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/0acea989ac/WebCryptoAPI
37+
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/2cb332d710/WebCryptoAPI
3838
- webidl: https://github.com/web-platform-tests/wpt/tree/63ca529a02/webidl
3939
- webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/2f96fa1996/webidl/ecmascript-binding/es-exceptions
4040
- webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/6495c91853/webmessaging/broadcastchannel
Collapse file

‎test/fixtures/wpt/WebCryptoAPI/import_export/raw_format_aliases.tentative.https.any.js‎

Copy file name to clipboard
+72Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// META: title=WebCryptoAPI: raw-secret and raw-public importKey() format aliases
2+
// META: timeout=long
3+
// META: script=../util/helpers.js
4+
5+
// For all existing symmetric algorithms in WebCrypto, "raw-secret" acts as an
6+
// alias of "raw". For all existing asymmetric algorithms in WebCrypto,
7+
// "raw-public" acts as an alias of "raw".
8+
9+
"use strict";
10+
11+
const rawKeyData16 = crypto.getRandomValues(new Uint8Array(16));
12+
const rawKeyData32 = crypto.getRandomValues(new Uint8Array(32));
13+
const wrapAlgorithm = { name: "AES-GCM", iv: new Uint8Array(12) };
14+
15+
const symmetricAlgorithms = [
16+
{ algorithm: { name: "AES-CTR", length: 128 }, keyData: rawKeyData16, usages: ["encrypt", "decrypt"] },
17+
{ algorithm: { name: "AES-CBC", length: 128 }, keyData: rawKeyData16, usages: ["encrypt", "decrypt"] },
18+
{ algorithm: { name: "AES-GCM", length: 128 }, keyData: rawKeyData16, usages: ["encrypt", "decrypt"] },
19+
{ algorithm: { name: "AES-KW", length: 128 }, keyData: rawKeyData16, usages: ["wrapKey", "unwrapKey"] },
20+
{ algorithm: { name: "HMAC", hash: "SHA-256", length: 256 }, keyData: rawKeyData32, usages: ["sign", "verify"] },
21+
{ algorithm: { name: "HKDF" }, keyData: rawKeyData32, usages: ["deriveBits", "deriveKey"], extractable: false },
22+
{ algorithm: { name: "PBKDF2" }, keyData: rawKeyData32, usages: ["deriveBits", "deriveKey"], extractable: false },
23+
];
24+
25+
for (const { algorithm, keyData, usages, extractable = true } of symmetricAlgorithms) {
26+
promise_test(async () => {
27+
const key = await crypto.subtle.importKey("raw-secret", keyData, algorithm, extractable, usages);
28+
assert_goodCryptoKey(key, algorithm, extractable, usages, "secret");
29+
if (extractable) {
30+
await crypto.subtle.exportKey("raw-secret", key);
31+
}
32+
}, `importKey/exportKey with raw-secret: ${algorithm.name}`);
33+
34+
if (extractable) {
35+
promise_test(async () => {
36+
const wrappingKey = await crypto.subtle.generateKey({ name: "AES-GCM", length: 256 }, false, ["wrapKey", "unwrapKey"]);
37+
const key = await crypto.subtle.importKey("raw-secret", keyData, algorithm, true, usages);
38+
const wrapped = await crypto.subtle.wrapKey("raw-secret", key, wrappingKey, wrapAlgorithm);
39+
const unwrapped = await crypto.subtle.unwrapKey("raw-secret", wrapped, wrappingKey, wrapAlgorithm, algorithm, true, usages);
40+
assert_goodCryptoKey(unwrapped, algorithm, true, usages, "secret");
41+
}, `wrapKey/unwrapKey with raw-secret: ${algorithm.name}`);
42+
}
43+
}
44+
45+
const asymmetricAlgorithms = [
46+
{ algorithm: { name: "ECDSA", namedCurve: "P-256" }, usages: ["verify"] },
47+
{ algorithm: { name: "ECDH", namedCurve: "P-256" }, usages: [] },
48+
{ algorithm: { name: "Ed25519" }, usages: ["verify"] },
49+
{ algorithm: { name: "X25519" }, usages: [] },
50+
];
51+
52+
for (const { algorithm, usages } of asymmetricAlgorithms) {
53+
const generateKeyUsages = usages.length ? usages.concat("sign") : ["deriveBits"];
54+
55+
promise_test(async () => {
56+
const keyPair = await crypto.subtle.generateKey(algorithm, true, generateKeyUsages);
57+
const keyData = await crypto.subtle.exportKey("raw-public", keyPair.publicKey);
58+
59+
const key = await crypto.subtle.importKey("raw-public", keyData, algorithm, true, usages);
60+
assert_goodCryptoKey(key, algorithm, true, usages, "public");
61+
await crypto.subtle.exportKey("raw-public", key);
62+
}, `importKey/exportKey with raw-public: ${algorithm.name}`);
63+
64+
promise_test(async () => {
65+
const keyPair = await crypto.subtle.generateKey(algorithm, true, generateKeyUsages);
66+
67+
const wrappingKey = await crypto.subtle.generateKey({ name: "AES-GCM", length: 256 }, false, ["wrapKey", "unwrapKey"]);
68+
const wrapped = await crypto.subtle.wrapKey("raw-public", keyPair.publicKey, wrappingKey, wrapAlgorithm);
69+
const unwrapped = await crypto.subtle.unwrapKey("raw-public", wrapped, wrappingKey, wrapAlgorithm, algorithm, true, usages);
70+
assert_goodCryptoKey(unwrapped, algorithm, true, usages, "public");
71+
}, `wrapKey/unwrapKey with raw-public: ${algorithm.name}`);
72+
}
Collapse file

‎test/fixtures/wpt/versions.json‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/versions.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"path": "web-locks"
9797
},
9898
"WebCryptoAPI": {
99-
"commit": "0acea989ac21842d6545d16594f1a05491c6076e",
99+
"commit": "2cb332d71030ba0200610d72b94bb1badf447418",
100100
"path": "WebCryptoAPI"
101101
},
102102
"webidl": {

0 commit comments

Comments
0 (0)
You are visitor 01402520 — 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.