summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/WebCryptoAPI/generateKey
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/WebCryptoAPI/generateKey
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/WebCryptoAPI/generateKey')
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures.js216
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures.worker.js5
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-CBC.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-CTR.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-GCM.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-KW.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_ECDH.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_ECDSA.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_HMAC.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSA-OAEP.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSA-PSS.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSASSA-PKCS1-v1_5.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes.js88
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes.worker.js6
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-CBC.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-CTR.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-GCM.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-KW.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_ECDH.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_ECDSA.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_HMAC.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSA-PSS.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSASSA-PKCS1-v1_5.worker.js7
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-cbc.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-ctr.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CBC.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CTR.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-GCM.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-KW.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDH.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDSA.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_HMAC.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-OAEP.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-PSS.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.html18
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CBC.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CTR.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-GCM.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-KW.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDH.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDSA.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_HMAC.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-OAEP.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-PSS.html23
-rw-r--r--testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.html23
48 files changed, 942 insertions, 0 deletions
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures.js
new file mode 100644
index 000000000..23fb28018
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures.js
@@ -0,0 +1,216 @@
+function run_test(algorithmNames) {
+ var subtle = crypto.subtle; // Change to test prefixed implementations
+
+ setup({explicit_timeout: true});
+
+// These tests check that generateKey throws an error, and that
+// the error is of the right type, for a wide set of incorrect parameters.
+//
+// Error testing occurs by setting the parameter that should trigger the
+// error to an invalid value, then combining that with all valid
+// parameters that should be checked earlier by generateKey, and all
+// valid and invalid parameters that should be checked later by
+// generateKey.
+//
+// There are a lot of combinations of possible parameters for both
+// success and failure modes, resulting in a very large number of tests
+// performed.
+
+
+// Setup: define the correct behaviors that should be sought, and create
+// helper functions that generate all possible test parameters for
+// different situations.
+
+ var allTestVectors = [ // Parameters that should work for generateKey
+ {name: "AES-CTR", resultType: CryptoKey, usages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], mandatoryUsages: []},
+ {name: "AES-CBC", resultType: CryptoKey, usages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], mandatoryUsages: []},
+ {name: "AES-GCM", resultType: CryptoKey, usages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], mandatoryUsages: []},
+ {name: "AES-KW", resultType: CryptoKey, usages: ["wrapKey", "unwrapKey"], mandatoryUsages: []},
+ {name: "HMAC", resultType: CryptoKey, usages: ["sign", "verify"], mandatoryUsages: []},
+ {name: "RSASSA-PKCS1-v1_5", resultType: "CryptoKeyPair", usages: ["sign", "verify"], mandatoryUsages: ["sign"]},
+ {name: "RSA-PSS", resultType: "CryptoKeyPair", usages: ["sign", "verify"], mandatoryUsages: ["sign"]},
+ {name: "RSA-OAEP", resultType: "CryptoKeyPair", usages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], mandatoryUsages: ["decrypt", "unwrapKey"]},
+ {name: "ECDSA", resultType: "CryptoKeyPair", usages: ["sign", "verify"], mandatoryUsages: ["sign"]},
+ {name: "ECDH", resultType: "CryptoKeyPair", usages: ["deriveKey", "deriveBits"], mandatoryUsages: ["deriveKey", "deriveBits"]}
+ ];
+
+ var testVectors = [];
+ if (algorithmNames && !Array.isArray(algorithmNames)) {
+ algorithmNames = [algorithmNames];
+ };
+ allTestVectors.forEach(function(vector) {
+ if (!algorithmNames || algorithmNames.includes(vector.name)) {
+ testVectors.push(vector);
+ }
+ });
+
+
+ function parameterString(algorithm, extractable, usages) {
+ if (typeof algorithm !== "object" && typeof algorithm !== "string") {
+ alert(algorithm);
+ }
+
+ var result = "(" +
+ objectToString(algorithm) + ", " +
+ objectToString(extractable) + ", " +
+ objectToString(usages) +
+ ")";
+
+ return result;
+ }
+
+ // Test that a given combination of parameters results in an error,
+ // AND that it is the correct kind of error.
+ //
+ // Expected error is either a number, tested against the error code,
+ // or a string, tested against the error name.
+ function testError(algorithm, extractable, usages, expectedError, testTag) {
+ promise_test(function(test) {
+ return crypto.subtle.generateKey(algorithm, extractable, usages)
+ .then(function(result) {
+ assert_unreached("Operation succeeded, but should not have");
+ }, function(err) {
+ if (typeof expectedError === "number") {
+ assert_equals(err.code, expectedError, testTag + " not supported");
+ } else {
+ assert_equals(err.name, expectedError, testTag + " not supported");
+ }
+ });
+ }, testTag + ": generateKey" + parameterString(algorithm, extractable, usages));
+ }
+
+
+ // Given an algorithm name, create several invalid parameters.
+ function badAlgorithmPropertySpecifiersFor(algorithmName) {
+ var results = [];
+
+ if (algorithmName.toUpperCase().substring(0, 3) === "AES") {
+ // Specifier properties are name and length
+ [64, 127, 129, 255, 257, 512].forEach(function(length) {
+ results.push({name: algorithmName, length: length});
+ });
+ } else if (algorithmName.toUpperCase().substring(0, 3) === "RSA") {
+ [new Uint8Array([1]), new Uint8Array([1,0,0])].forEach(function(publicExponent) {
+ results.push({name: algorithmName, hash: "SHA-256", modulusLength: 1024, publicExponent: publicExponent});
+ });
+ } else if (algorithmName.toUpperCase().substring(0, 2) === "EC") {
+ ["P-512", "Curve25519"].forEach(function(curveName) {
+ results.push({name: algorithmName, namedCurve: curveName});
+ });
+ }
+
+ return results;
+ }
+
+
+ // Don't create an exhaustive list of all invalid usages,
+ // because there would usually be nearly 2**8 of them,
+ // way too many to test. Instead, create every singleton
+ // of an illegal usage, and "poison" every valid usage
+ // with an illegal one.
+ function invalidUsages(validUsages, mandatoryUsages) {
+ var results = [];
+
+ var illegalUsages = [];
+ ["encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey", "deriveKey", "deriveBits"].forEach(function(usage) {
+ if (!validUsages.includes(usage)) {
+ illegalUsages.push(usage);
+ }
+ });
+
+ var goodUsageCombinations = allValidUsages(validUsages, false, mandatoryUsages);
+
+ illegalUsages.forEach(function(illegalUsage) {
+ results.push([illegalUsage]);
+ goodUsageCombinations.forEach(function(usageCombination) {
+ results.push(usageCombination.concat([illegalUsage]));
+ });
+ });
+
+ return results;
+ }
+
+
+// Now test for properly handling errors
+// - Unsupported algorithm
+// - Bad usages for algorithm
+// - Bad key lengths
+
+ // Algorithm normalization should fail with "Not supported"
+ var badAlgorithmNames = [
+ "AES",
+ {name: "AES"},
+ {name: "AES", length: 128},
+ {name: "AES-CMAC", length: 128}, // Removed after CR
+ {name: "AES-CFB", length: 128}, // Removed after CR
+ {name: "HMAC", hash: "MD5"},
+ {name: "RSA", hash: "SHA-256", modulusLength: 2048, publicExponent: new Uint8Array([1,0,1])},
+ {name: "RSA-PSS", hash: "SHA", modulusLength: 2048, publicExponent: new Uint8Array([1,0,1])},
+ {name: "EC", namedCurve: "P521"}
+ ];
+
+
+ // Algorithm normalization failures should be found first
+ // - all other parameters can be good or bad, should fail
+ // due to NotSupportedError.
+ badAlgorithmNames.forEach(function(algorithm) {
+ allValidUsages(["decrypt", "sign", "deriveBits"], true, []) // Small search space, shouldn't matter because should fail before used
+ .forEach(function(usages) {
+ [false, true, "RED", 7].forEach(function(extractable){
+ testError(algorithm, extractable, usages, "NotSupportedError", "Bad algorithm");
+ });
+ });
+ });
+
+
+ // Algorithms normalize okay, but usages bad (though not empty).
+ // It shouldn't matter what other extractable is. Should fail
+ // due to SyntaxError
+ testVectors.forEach(function(vector) {
+ var name = vector.name;
+
+ allAlgorithmSpecifiersFor(name).forEach(function(algorithm) {
+ invalidUsages(vector.usages, vector.mandatoryUsages).forEach(function(usages) {
+ [true].forEach(function(extractable) {
+ testError(algorithm, extractable, usages, "SyntaxError", "Bad usages");
+ });
+ });
+ });
+ });
+
+
+ // Other algorithm properties should be checked next, so try good
+ // algorithm names and usages, but bad algorithm properties next.
+ // - Special case: normally bad usage [] isn't checked until after properties,
+ // so it's included in this test case. It should NOT cause an error.
+ testVectors.forEach(function(vector) {
+ var name = vector.name;
+ badAlgorithmPropertySpecifiersFor(name).forEach(function(algorithm) {
+ allValidUsages(vector.usages, true, vector.mandatoryUsages)
+ .forEach(function(usages) {
+ [false, true].forEach(function(extractable) {
+ if (name.substring(0,2) === "EC") {
+ testError(algorithm, extractable, usages, "NotSupportedError", "Bad algorithm property");
+ } else {
+ testError(algorithm, extractable, usages, "OperationError", "Bad algorithm property");
+ }
+ });
+ });
+ });
+ });
+
+
+ // The last thing that should be checked is an empty usages (for secret keys).
+ testVectors.forEach(function(vector) {
+ var name = vector.name;
+
+ allAlgorithmSpecifiersFor(name).forEach(function(algorithm) {
+ var usages = [];
+ [false, true].forEach(function(extractable) {
+ testError(algorithm, extractable, usages, "SyntaxError", "Empty usages");
+ });
+ });
+ });
+
+
+}
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures.worker.js
new file mode 100644
index 000000000..705664c2d
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures.worker.js
@@ -0,0 +1,5 @@
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test();
+done();
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-CBC.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-CBC.worker.js
new file mode 100644
index 000000000..2094bef58
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-CBC.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["AES-CBC"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-CTR.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-CTR.worker.js
new file mode 100644
index 000000000..233dae790
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-CTR.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["AES-CTR"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-GCM.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-GCM.worker.js
new file mode 100644
index 000000000..4119c1ebd
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-GCM.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["AES-GCM"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-KW.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-KW.worker.js
new file mode 100644
index 000000000..e3098e196
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_AES-KW.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["AES-KW"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_ECDH.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_ECDH.worker.js
new file mode 100644
index 000000000..ac95099ac
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_ECDH.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["ECDH"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_ECDSA.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_ECDSA.worker.js
new file mode 100644
index 000000000..48852dcf9
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_ECDSA.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["ECDSA"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_HMAC.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_HMAC.worker.js
new file mode 100644
index 000000000..94cdb731f
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_HMAC.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["HMAC"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSA-OAEP.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSA-OAEP.worker.js
new file mode 100644
index 000000000..90523a9fb
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSA-OAEP.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["RSA-OAEP"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSA-PSS.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSA-PSS.worker.js
new file mode 100644
index 000000000..8ea8b92a4
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSA-PSS.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["RSA-PSS"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSASSA-PKCS1-v1_5.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSASSA-PKCS1-v1_5.worker.js
new file mode 100644
index 000000000..d36368015
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/failures_RSASSA-PKCS1-v1_5.worker.js
@@ -0,0 +1,6 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("failures.js");
+run_test(["RSASSA-PKCS1-v1_5"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes.js
new file mode 100644
index 000000000..db4aae085
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes.js
@@ -0,0 +1,88 @@
+
+function run_test(algorithmNames) {
+ var subtle = crypto.subtle; // Change to test prefixed implementations
+
+ setup({explicit_timeout: true});
+
+// These tests check that generateKey successfully creates keys
+// when provided any of a wide set of correct parameters.
+//
+// There are a lot of combinations of possible parameters,
+// resulting in a very large number of tests
+// performed.
+
+
+// Setup: define the correct behaviors that should be sought, and create
+// helper functions that generate all possible test parameters for
+// different situations.
+
+ var allTestVectors = [ // Parameters that should work for generateKey
+ {name: "AES-CTR", resultType: CryptoKey, usages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], mandatoryUsages: []},
+ {name: "AES-CBC", resultType: CryptoKey, usages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], mandatoryUsages: []},
+ {name: "AES-GCM", resultType: CryptoKey, usages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], mandatoryUsages: []},
+ {name: "AES-KW", resultType: CryptoKey, usages: ["wrapKey", "unwrapKey"], mandatoryUsages: []},
+ {name: "HMAC", resultType: CryptoKey, usages: ["sign", "verify"], mandatoryUsages: []},
+ {name: "RSASSA-PKCS1-v1_5", resultType: "CryptoKeyPair", usages: ["sign", "verify"], mandatoryUsages: ["sign"]},
+ {name: "RSA-PSS", resultType: "CryptoKeyPair", usages: ["sign", "verify"], mandatoryUsages: ["sign"]},
+ {name: "RSA-OAEP", resultType: "CryptoKeyPair", usages: ["encrypt", "decrypt", "wrapKey", "unwrapKey"], mandatoryUsages: ["decrypt", "unwrapKey"]},
+ {name: "ECDSA", resultType: "CryptoKeyPair", usages: ["sign", "verify"], mandatoryUsages: ["sign"]},
+ {name: "ECDH", resultType: "CryptoKeyPair", usages: ["deriveKey", "deriveBits"], mandatoryUsages: ["deriveKey", "deriveBits"]}
+ ];
+
+ var testVectors = [];
+ if (algorithmNames && !Array.isArray(algorithmNames)) {
+ algorithmNames = [algorithmNames];
+ };
+ allTestVectors.forEach(function(vector) {
+ if (!algorithmNames || algorithmNames.includes(vector.name)) {
+ testVectors.push(vector);
+ }
+ });
+
+ function parameterString(algorithm, extractable, usages) {
+ var result = "(" +
+ objectToString(algorithm) + ", " +
+ objectToString(extractable) + ", " +
+ objectToString(usages) +
+ ")";
+
+ return result;
+ }
+
+ // Test that a given combination of parameters is successful
+ function testSuccess(algorithm, extractable, usages, resultType, testTag) {
+ // algorithm, extractable, and usages are the generateKey parameters
+ // resultType is the expected result, either the CryptoKey object or "CryptoKeyPair"
+ // testTag is a string to prepend to the test name.
+
+ promise_test(function(test) {
+ return subtle.generateKey(algorithm, extractable, usages)
+ .then(function(result) {
+ if (resultType === "CryptoKeyPair") {
+ assert_goodCryptoKey(result.privateKey, algorithm, extractable, usages, "private");
+ assert_goodCryptoKey(result.publicKey, algorithm, extractable, usages, "public");
+ } else {
+ assert_goodCryptoKey(result, algorithm, extractable, usages, "secret");
+ }
+ }, function(err) {
+ assert_unreached("Threw an unexpected error: " + err.toString());
+ });
+ }, testTag + ": generateKey" + parameterString(algorithm, extractable, usages));
+ }
+
+
+ // Test all valid sets of parameters for successful
+ // key generation.
+ testVectors.forEach(function(vector) {
+ allNameVariants(vector.name).forEach(function(name) {
+ allAlgorithmSpecifiersFor(name).forEach(function(algorithm) {
+ allValidUsages(vector.usages, false, vector.mandatoryUsages).forEach(function(usages) {
+ [false, true].forEach(function(extractable) {
+ testSuccess(algorithm, extractable, usages, vector.resultType, "Success");
+ });
+ });
+ });
+ });
+ });
+
+}
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes.worker.js
new file mode 100644
index 000000000..52e34946e
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes.worker.js
@@ -0,0 +1,6 @@
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test();
+done();
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-CBC.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-CBC.worker.js
new file mode 100644
index 000000000..c91244a98
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-CBC.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["AES-CBC"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-CTR.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-CTR.worker.js
new file mode 100644
index 000000000..a5a3fcd03
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-CTR.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["AES-CTR"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-GCM.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-GCM.worker.js
new file mode 100644
index 000000000..5960bb452
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-GCM.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["AES-GCM"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-KW.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-KW.worker.js
new file mode 100644
index 000000000..6771e09cb
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_AES-KW.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["AES-KW"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_ECDH.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_ECDH.worker.js
new file mode 100644
index 000000000..0531cd6f7
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_ECDH.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["ECDH"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_ECDSA.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_ECDSA.worker.js
new file mode 100644
index 000000000..20e6df2cb
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_ECDSA.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["ECDSA"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_HMAC.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_HMAC.worker.js
new file mode 100644
index 000000000..9dfd30a0d
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_HMAC.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["HMAC"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.worker.js
new file mode 100644
index 000000000..a9ed367a2
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["RSA-OAEP"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSA-PSS.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSA-PSS.worker.js
new file mode 100644
index 000000000..05de5a90e
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSA-PSS.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["RSA-PSS"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSASSA-PKCS1-v1_5.worker.js b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSASSA-PKCS1-v1_5.worker.js
new file mode 100644
index 000000000..3e48cfccb
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/successes_RSASSA-PKCS1-v1_5.worker.js
@@ -0,0 +1,7 @@
+// <meta> timeout=long
+importScripts("/resources/testharness.js");
+importScripts("../util/helpers.js");
+importScripts("successes.js");
+
+run_test(["RSASSA-PKCS1-v1_5"]);
+done(); \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-cbc.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-cbc.html
new file mode 100644
index 000000000..a3054a57a
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-cbc.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test("AES-CBC");
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-ctr.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-ctr.html
new file mode 100644
index 000000000..bb1abf0d9
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_aes-ctr.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test("AES-CTR");
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures.html
new file mode 100644
index 000000000..14e57b25c
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test();
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CBC.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CBC.html
new file mode 100644
index 000000000..7650908c0
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CBC.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["AES-CBC"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CTR.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CTR.html
new file mode 100644
index 000000000..f08737c39
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-CTR.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["AES-CTR"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-GCM.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-GCM.html
new file mode 100644
index 000000000..4ef6a7771
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-GCM.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["AES-GCM"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-KW.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-KW.html
new file mode 100644
index 000000000..7cbb4f8bf
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_AES-KW.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["AES-KW"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDH.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDH.html
new file mode 100644
index 000000000..c606a5b90
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDH.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["ECDH"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDSA.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDSA.html
new file mode 100644
index 000000000..8b742e80b
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_ECDSA.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["ECDSA"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_HMAC.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_HMAC.html
new file mode 100644
index 000000000..e037f0d07
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_HMAC.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["HMAC"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-OAEP.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-OAEP.html
new file mode 100644
index 000000000..ddd63beb3
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-OAEP.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["RSA-OAEP"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-PSS.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-PSS.html
new file mode 100644
index 000000000..2814b34e9
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSA-PSS.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["RSA-PSS"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.html
new file mode 100644
index 000000000..0e28914af
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_failures_RSASSA-PKCS1-v1_5.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() for Failures</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="failures.js"></script>
+
+<h1>generateKey Tests for Bad Parameters</h1>
+
+<div id="log"></div>
+<script>
+run_test(["RSASSA-PKCS1-v1_5"]);
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes.html
new file mode 100644
index 000000000..384db1cd1
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test();
+</script>
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CBC.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CBC.html
new file mode 100644
index 000000000..af8093539
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CBC.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["AES-CBC"]);
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CTR.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CTR.html
new file mode 100644
index 000000000..3608a4fde
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-CTR.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["AES-CTR"]);
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-GCM.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-GCM.html
new file mode 100644
index 000000000..eb7c6b5d0
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-GCM.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["AES-GCM"]);
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-KW.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-KW.html
new file mode 100644
index 000000000..9beab2083
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_AES-KW.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["AES-KW"]);
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDH.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDH.html
new file mode 100644
index 000000000..9871f572b
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDH.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["ECDH"]);
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDSA.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDSA.html
new file mode 100644
index 000000000..f32a556bb
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_ECDSA.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["ECDSA"]);
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_HMAC.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_HMAC.html
new file mode 100644
index 000000000..819b35df0
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_HMAC.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["HMAC"]);
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-OAEP.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-OAEP.html
new file mode 100644
index 000000000..db58fd669
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-OAEP.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["RSA-OAEP"]);
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-PSS.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-PSS.html
new file mode 100644
index 000000000..d6a3c1b02
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSA-PSS.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["RSA-PSS"]);
+</script> \ No newline at end of file
diff --git a/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.html b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.html
new file mode 100644
index 000000000..35678798b
--- /dev/null
+++ b/testing/web-platform/tests/WebCryptoAPI/generateKey/test_successes_RSASSA-PKCS1-v1_5.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>WebCryptoAPI: generateKey() Successful Calls</title>
+<link rel="author" title="Charles Engelke" href="mailto:w3c@engelke.com">
+<link rel="help" href="https://www.w3.org/TR/WebCryptoAPI/#dfn-SubtleCrypto-method-generateKey">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script src="/WebCryptoAPI/util/helpers.js"></script>
+<script src="successes.js"></script>
+
+<h1>generateKey Tests for Good Parameters</h1>
+<p>
+ <strong>Warning!</strong> RSA key generation is intrinsically
+ very slow, so the related tests can take up to
+ several minutes to complete, depending on browser!
+</p>
+
+<div id="log"></div>
+<script>
+run_test(["RSASSA-PKCS1-v1_5"]);
+</script> \ No newline at end of file