[WebCrypto] Implement ECDH GenerateKey operation
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Mar 2017 02:56:58 +0000 (02:56 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Mar 2017 02:56:58 +0000 (02:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=169093
<rdar://problem/23789585>

Reviewed by Brent Fulgham.

LayoutTests/imported/w3c:

* web-platform-tests/WebCryptoAPI/generateKey/failures_ECDH.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/generateKey/successes_ECDH.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/generateKey/test_failures_ECDH-expected.txt:
* web-platform-tests/WebCryptoAPI/generateKey/test_successes_ECDH-expected.txt:

Source/WebCore:

This patch implements GenerateKey operation of ECDH according to:
https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations.
Note: Sad that we are not able to support P-521 at this moment due
to lack of necessary support in the underlying crypto library.

Tests: crypto/subtle/ec-generate-key-malformed-parameters.html
       crypto/subtle/ecdh-generate-key-extractable.html
       crypto/subtle/ecdh-generate-key-p256.html
       crypto/subtle/ecdh-generate-key-p384.html
       crypto/subtle/ecdh-generate-key-single-usage.html
       crypto/workers/subtle/ec-generate-key.html

* CMakeLists.txt:
* DerivedSources.make:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCryptoKeyCustom.cpp:
(WebCore::JSCryptoKey::algorithm):
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
Add support for ECDH.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::write):
Structured clonable will be added later on.
* crypto/CommonCryptoUtilities.h:
Add SPI for EC.
* crypto/CryptoAlgorithmParameters.h:
* crypto/CryptoKey.h:
* crypto/algorithms/CryptoAlgorithmECDH.cpp: Added.
(WebCore::CryptoAlgorithmECDH::create):
(WebCore::CryptoAlgorithmECDH::identifier):
(WebCore::CryptoAlgorithmECDH::generateKey):
* crypto/algorithms/CryptoAlgorithmECDH.h: Added.
* crypto/gnutls/CryptoKeyECGnuTLS.cpp: Added.
(WebCore::CryptoKeyEC::~CryptoKeyEC):
(WebCore::CryptoKeyEC::platformGeneratePair):
* crypto/keys/CryptoKeyEC.cpp: Added.
(WebCore::CryptoKeyEC::CryptoKeyEC):
(WebCore::CryptoKeyEC::generatePair):
(WebCore::CryptoKeyEC::buildAlgorithm):
(WebCore::CryptoKeyEC::exportData):
* crypto/keys/CryptoKeyEC.h: Added.
(WebCore::EcKeyAlgorithm::EcKeyAlgorithm):
(WebCore::EcKeyAlgorithm::namedCurve):
* crypto/mac/CryptoAlgorithmRegistryMac.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
Add support for ECDH.
* crypto/mac/CryptoKeyECMac.cpp: Added.
(WebCore::CryptoKeyEC::~CryptoKeyEC):
(WebCore::CryptoKeyEC::platformGeneratePair):
* crypto/parameters/CryptoAlgorithmEcKeyParams.h: Added.
* crypto/parameters/EcKeyParams.idl: Added.

LayoutTests:

* crypto/subtle/ec-generate-key-malformed-parameters-expected.txt: Added.
* crypto/subtle/ec-generate-key-malformed-parameters.html: Added.
* crypto/subtle/ecdh-generate-key-extractable-expected.txt: Added.
* crypto/subtle/ecdh-generate-key-extractable.html: Added.
* crypto/subtle/ecdh-generate-key-p256-expected.txt: Added.
* crypto/subtle/ecdh-generate-key-p256.html: Added.
* crypto/subtle/ecdh-generate-key-p384-expected.txt: Added.
* crypto/subtle/ecdh-generate-key-p384.html: Added.
* crypto/subtle/ecdh-generate-key-single-usage-expected.txt: Added.
* crypto/subtle/ecdh-generate-key-single-usage.html: Added.
* crypto/workers/subtle/ec-generate-key-expected.txt: Added.
* crypto/workers/subtle/ec-generate-key.html: Added.
* crypto/workers/subtle/resources/ec-generate-key.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213489 268f45cc-cd09-0410-ab3c-d52691b4dbfc

40 files changed:
LayoutTests/ChangeLog
LayoutTests/crypto/subtle/ec-generate-key-malformed-parameters-expected.txt [new file with mode: 0644]
LayoutTests/crypto/subtle/ec-generate-key-malformed-parameters.html [new file with mode: 0644]
LayoutTests/crypto/subtle/ecdh-generate-key-extractable-expected.txt [new file with mode: 0644]
LayoutTests/crypto/subtle/ecdh-generate-key-extractable.html [new file with mode: 0644]
LayoutTests/crypto/subtle/ecdh-generate-key-p256-expected.txt [new file with mode: 0644]
LayoutTests/crypto/subtle/ecdh-generate-key-p256.html [new file with mode: 0644]
LayoutTests/crypto/subtle/ecdh-generate-key-p384-expected.txt [new file with mode: 0644]
LayoutTests/crypto/subtle/ecdh-generate-key-p384.html [new file with mode: 0644]
LayoutTests/crypto/subtle/ecdh-generate-key-single-usage-expected.txt [new file with mode: 0644]
LayoutTests/crypto/subtle/ecdh-generate-key-single-usage.html [new file with mode: 0644]
LayoutTests/crypto/workers/subtle/ec-generate-key-expected.txt [new file with mode: 0644]
LayoutTests/crypto/workers/subtle/ec-generate-key.html [new file with mode: 0644]
LayoutTests/crypto/workers/subtle/resources/ec-generate-key.js [new file with mode: 0644]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/failures_ECDH.worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_ECDH.worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/test_failures_ECDH-expected.txt
LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/test_successes_ECDH-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/PlatformGTK.cmake
Source/WebCore/PlatformMac.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSCryptoKeyCustom.cpp
Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/crypto/CommonCryptoUtilities.h
Source/WebCore/crypto/CryptoAlgorithmParameters.h
Source/WebCore/crypto/CryptoKey.h
Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp [new file with mode: 0644]
Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h [new file with mode: 0644]
Source/WebCore/crypto/gnutls/CryptoKeyECGnuTLS.cpp [new file with mode: 0644]
Source/WebCore/crypto/keys/CryptoKeyEC.cpp [new file with mode: 0644]
Source/WebCore/crypto/keys/CryptoKeyEC.h [new file with mode: 0644]
Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp
Source/WebCore/crypto/mac/CryptoKeyECMac.cpp [new file with mode: 0644]
Source/WebCore/crypto/parameters/CryptoAlgorithmEcKeyParams.h [new file with mode: 0644]
Source/WebCore/crypto/parameters/EcKeyParams.idl [new file with mode: 0644]

index 1024637..eddf3aa 100644 (file)
@@ -1,3 +1,25 @@
+2017-03-06  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebCrypto] Implement ECDH GenerateKey operation
+        https://bugs.webkit.org/show_bug.cgi?id=169093
+        <rdar://problem/23789585>
+
+        Reviewed by Brent Fulgham.
+
+        * crypto/subtle/ec-generate-key-malformed-parameters-expected.txt: Added.
+        * crypto/subtle/ec-generate-key-malformed-parameters.html: Added.
+        * crypto/subtle/ecdh-generate-key-extractable-expected.txt: Added.
+        * crypto/subtle/ecdh-generate-key-extractable.html: Added.
+        * crypto/subtle/ecdh-generate-key-p256-expected.txt: Added.
+        * crypto/subtle/ecdh-generate-key-p256.html: Added.
+        * crypto/subtle/ecdh-generate-key-p384-expected.txt: Added.
+        * crypto/subtle/ecdh-generate-key-p384.html: Added.
+        * crypto/subtle/ecdh-generate-key-single-usage-expected.txt: Added.
+        * crypto/subtle/ecdh-generate-key-single-usage.html: Added.
+        * crypto/workers/subtle/ec-generate-key-expected.txt: Added.
+        * crypto/workers/subtle/ec-generate-key.html: Added.
+        * crypto/workers/subtle/resources/ec-generate-key.js: Added.
+
 2017-03-06  Dave Hyatt  <hyatt@apple.com>
 
         REGRESSION: Block no longer shrinks to preferred width in this flex box layout
diff --git a/LayoutTests/crypto/subtle/ec-generate-key-malformed-parameters-expected.txt b/LayoutTests/crypto/subtle/ec-generate-key-malformed-parameters-expected.txt
new file mode 100644 (file)
index 0000000..70d5c45
--- /dev/null
@@ -0,0 +1,24 @@
+Test generating an EC key pair with malformed-paramters.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.subtle.generateKey("ecdh", extractable, ["deriveKey", "deriveBits"]) rejected promise  with TypeError: Member EcKeyParams.namedCurve is required and must be an instance of DOMString.
+PASS crypto.subtle.generateKey({name: "ecdh"}, extractable, ["deriveKey", "deriveBits"]) rejected promise  with TypeError: Member EcKeyParams.namedCurve is required and must be an instance of DOMString.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: true}, extractable, ["deriveKey", "deriveBits"]) rejected promise  with NotSupportedError (DOM Exception 9): The algorithm is not supported.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: null}, extractable, ["deriveKey", "deriveBits"]) rejected promise  with NotSupportedError (DOM Exception 9): The algorithm is not supported.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: undefined}, extractable, ["deriveKey", "deriveBits"]) rejected promise  with TypeError: Member EcKeyParams.namedCurve is required and must be an instance of DOMString.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: Symbol()}, extractable, ["deriveKey", "deriveBits"]) rejected promise  with TypeError: Cannot convert a symbol to a string.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: { }}, extractable, ["deriveKey", "deriveBits"]) rejected promise  with NotSupportedError (DOM Exception 9): The algorithm is not supported.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: 1}, extractable, ["deriveKey", "deriveBits"]) rejected promise  with NotSupportedError (DOM Exception 9): The algorithm is not supported.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["encrypt"]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["decrypt"]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["sign"]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["verify"]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["wrapKey"]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["unwrapKey"]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-521"}, extractable, ["deriveKey"]) rejected promise  with NotSupportedError (DOM Exception 9): The algorithm is not supported.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/subtle/ec-generate-key-malformed-parameters.html b/LayoutTests/crypto/subtle/ec-generate-key-malformed-parameters.html
new file mode 100644 (file)
index 0000000..11e03d9
--- /dev/null
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test generating an EC key pair with malformed-paramters.");
+
+var extractable = true;
+
+// Malformed AlgorithmIdentifiers
+shouldReject('crypto.subtle.generateKey("ecdh", extractable, ["deriveKey", "deriveBits"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh"}, extractable, ["deriveKey", "deriveBits"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: true}, extractable, ["deriveKey", "deriveBits"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: null}, extractable, ["deriveKey", "deriveBits"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: undefined}, extractable, ["deriveKey", "deriveBits"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: Symbol()}, extractable, ["deriveKey", "deriveBits"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: { }}, extractable, ["deriveKey", "deriveBits"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: 1}, extractable, ["deriveKey", "deriveBits"])');
+// Wrong usages
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["encrypt"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["decrypt"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["sign"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["verify"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["wrapKey"])');
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-256"}, extractable, ["unwrapKey"])');
+// Not supported NamedCurve
+shouldReject('crypto.subtle.generateKey({name: "ecdh", namedCurve: "P-521"}, extractable, ["deriveKey"])');
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/crypto/subtle/ecdh-generate-key-extractable-expected.txt b/LayoutTests/crypto/subtle/ecdh-generate-key-extractable-expected.txt
new file mode 100644 (file)
index 0000000..fea0c8a
--- /dev/null
@@ -0,0 +1,21 @@
+Test generating an extractable EC key pair with P-256 using ECDH algorithm.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key pair...
+PASS keyPair.toString() is '[object Object]'
+PASS keyPair.publicKey.type is 'public'
+PASS keyPair.publicKey.extractable is true
+PASS keyPair.publicKey.algorithm.name is 'ECDH'
+PASS keyPair.publicKey.algorithm.namedCurve is 'P-256'
+PASS keyPair.publicKey.usages is [ ]
+PASS keyPair.privateKey.type is 'private'
+PASS keyPair.privateKey.extractable is true
+PASS keyPair.privateKey.algorithm.name is 'ECDH'
+PASS keyPair.privateKey.algorithm.namedCurve is 'P-256'
+PASS keyPair.privateKey.usages is ['deriveBits', 'deriveKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/subtle/ecdh-generate-key-extractable.html b/LayoutTests/crypto/subtle/ecdh-generate-key-extractable.html
new file mode 100644 (file)
index 0000000..394247c
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test generating an extractable EC key pair with P-256 using ECDH algorithm.");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+
+debug("Generating a key pair...");
+crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-256"}, extractable, ["deriveKey", "deriveBits"]).then(function(result) {
+    keyPair = result;
+    shouldBe("keyPair.toString()", "'[object Object]'");
+    shouldBe("keyPair.publicKey.type", "'public'");
+    shouldBe("keyPair.publicKey.extractable", "true");
+    shouldBe("keyPair.publicKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.publicKey.usages", "[ ]");
+    shouldBe("keyPair.privateKey.type", "'private'");
+    shouldBe("keyPair.privateKey.extractable", "true");
+    shouldBe("keyPair.privateKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.privateKey.usages", "['deriveBits', 'deriveKey']");
+
+    finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/crypto/subtle/ecdh-generate-key-p256-expected.txt b/LayoutTests/crypto/subtle/ecdh-generate-key-p256-expected.txt
new file mode 100644 (file)
index 0000000..c73b105
--- /dev/null
@@ -0,0 +1,21 @@
+Test generating an EC key pair with P-256 using ECDH algorithm.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key pair...
+PASS keyPair.toString() is '[object Object]'
+PASS keyPair.publicKey.type is 'public'
+PASS keyPair.publicKey.extractable is true
+PASS keyPair.publicKey.algorithm.name is 'ECDH'
+PASS keyPair.publicKey.algorithm.namedCurve is 'P-256'
+PASS keyPair.publicKey.usages is [ ]
+PASS keyPair.privateKey.type is 'private'
+PASS keyPair.privateKey.extractable is false
+PASS keyPair.privateKey.algorithm.name is 'ECDH'
+PASS keyPair.privateKey.algorithm.namedCurve is 'P-256'
+PASS keyPair.privateKey.usages is ['deriveBits', 'deriveKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/subtle/ecdh-generate-key-p256.html b/LayoutTests/crypto/subtle/ecdh-generate-key-p256.html
new file mode 100644 (file)
index 0000000..a047026
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test generating an EC key pair with P-256 using ECDH algorithm.");
+
+jsTestIsAsync = true;
+
+var nonExtractable = false;
+
+debug("Generating a key pair...");
+crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-256"}, nonExtractable, ["deriveKey", "deriveBits"]).then(function(result) {
+    keyPair = result;
+    shouldBe("keyPair.toString()", "'[object Object]'");
+    shouldBe("keyPair.publicKey.type", "'public'");
+    shouldBe("keyPair.publicKey.extractable", "true");
+    shouldBe("keyPair.publicKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.publicKey.usages", "[ ]");
+    shouldBe("keyPair.privateKey.type", "'private'");
+    shouldBe("keyPair.privateKey.extractable", "false");
+    shouldBe("keyPair.privateKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.privateKey.usages", "['deriveBits', 'deriveKey']");
+
+    finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/crypto/subtle/ecdh-generate-key-p384-expected.txt b/LayoutTests/crypto/subtle/ecdh-generate-key-p384-expected.txt
new file mode 100644 (file)
index 0000000..b7450c2
--- /dev/null
@@ -0,0 +1,21 @@
+Test generating an EC key pair with P-384 using ECDH algorithm.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key pair...
+PASS keyPair.toString() is '[object Object]'
+PASS keyPair.publicKey.type is 'public'
+PASS keyPair.publicKey.extractable is true
+PASS keyPair.publicKey.algorithm.name is 'ECDH'
+PASS keyPair.publicKey.algorithm.namedCurve is 'P-384'
+PASS keyPair.publicKey.usages is [ ]
+PASS keyPair.privateKey.type is 'private'
+PASS keyPair.privateKey.extractable is false
+PASS keyPair.privateKey.algorithm.name is 'ECDH'
+PASS keyPair.privateKey.algorithm.namedCurve is 'P-384'
+PASS keyPair.privateKey.usages is ['deriveBits', 'deriveKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/subtle/ecdh-generate-key-p384.html b/LayoutTests/crypto/subtle/ecdh-generate-key-p384.html
new file mode 100644 (file)
index 0000000..fae7026
--- /dev/null
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test generating an EC key pair with P-384 using ECDH algorithm.");
+
+jsTestIsAsync = true;
+
+var nonExtractable = false;
+
+debug("Generating a key pair...");
+crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-384"}, nonExtractable, ["deriveKey", "deriveBits"]).then(function(result) {
+    keyPair = result;
+    shouldBe("keyPair.toString()", "'[object Object]'");
+    shouldBe("keyPair.publicKey.type", "'public'");
+    shouldBe("keyPair.publicKey.extractable", "true");
+    shouldBe("keyPair.publicKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-384'");
+    shouldBe("keyPair.publicKey.usages", "[ ]");
+    shouldBe("keyPair.privateKey.type", "'private'");
+    shouldBe("keyPair.privateKey.extractable", "false");
+    shouldBe("keyPair.privateKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-384'");
+    shouldBe("keyPair.privateKey.usages", "['deriveBits', 'deriveKey']");
+
+    finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/crypto/subtle/ecdh-generate-key-single-usage-expected.txt b/LayoutTests/crypto/subtle/ecdh-generate-key-single-usage-expected.txt
new file mode 100644 (file)
index 0000000..6f9518b
--- /dev/null
@@ -0,0 +1,32 @@
+Test generating an EC key pair with P-256 using ECDH algorithm with a single usage.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key pair...
+PASS keyPair.toString() is '[object Object]'
+PASS keyPair.publicKey.type is 'public'
+PASS keyPair.publicKey.extractable is true
+PASS keyPair.publicKey.algorithm.name is 'ECDH'
+PASS keyPair.publicKey.algorithm.namedCurve is 'P-256'
+PASS keyPair.publicKey.usages is [ ]
+PASS keyPair.privateKey.type is 'private'
+PASS keyPair.privateKey.extractable is false
+PASS keyPair.privateKey.algorithm.name is 'ECDH'
+PASS keyPair.privateKey.algorithm.namedCurve is 'P-256'
+PASS keyPair.privateKey.usages is ['deriveKey']
+PASS keyPair.toString() is '[object Object]'
+PASS keyPair.publicKey.type is 'public'
+PASS keyPair.publicKey.extractable is true
+PASS keyPair.publicKey.algorithm.name is 'ECDH'
+PASS keyPair.publicKey.algorithm.namedCurve is 'P-256'
+PASS keyPair.publicKey.usages is [ ]
+PASS keyPair.privateKey.type is 'private'
+PASS keyPair.privateKey.extractable is false
+PASS keyPair.privateKey.algorithm.name is 'ECDH'
+PASS keyPair.privateKey.algorithm.namedCurve is 'P-256'
+PASS keyPair.privateKey.usages is ['deriveBits']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/subtle/ecdh-generate-key-single-usage.html b/LayoutTests/crypto/subtle/ecdh-generate-key-single-usage.html
new file mode 100644 (file)
index 0000000..663c4b4
--- /dev/null
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test generating an EC key pair with P-256 using ECDH algorithm with a single usage.");
+
+jsTestIsAsync = true;
+
+var nonExtractable = false;
+
+debug("Generating a key pair...");
+crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-256"}, nonExtractable, ["deriveKey"]).then(function(result) {
+    keyPair = result;
+    shouldBe("keyPair.toString()", "'[object Object]'");
+    shouldBe("keyPair.publicKey.type", "'public'");
+    shouldBe("keyPair.publicKey.extractable", "true");
+    shouldBe("keyPair.publicKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.publicKey.usages", "[ ]");
+    shouldBe("keyPair.privateKey.type", "'private'");
+    shouldBe("keyPair.privateKey.extractable", "false");
+    shouldBe("keyPair.privateKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.privateKey.usages", "['deriveKey']");
+
+    return crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-256"}, nonExtractable, ["deriveBits"]);
+}).then(function(result) {
+    keyPair = result;
+    shouldBe("keyPair.toString()", "'[object Object]'");
+    shouldBe("keyPair.publicKey.type", "'public'");
+    shouldBe("keyPair.publicKey.extractable", "true");
+    shouldBe("keyPair.publicKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.publicKey.usages", "[ ]");
+    shouldBe("keyPair.privateKey.type", "'private'");
+    shouldBe("keyPair.privateKey.extractable", "false");
+    shouldBe("keyPair.privateKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.privateKey.usages", "['deriveBits']");
+
+    finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/crypto/workers/subtle/ec-generate-key-expected.txt b/LayoutTests/crypto/workers/subtle/ec-generate-key-expected.txt
new file mode 100644 (file)
index 0000000..6e0a85e
--- /dev/null
@@ -0,0 +1,22 @@
+[Worker] Test generating an EC key pair with P-256 using ECDH algorithm in workers.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/ec-generate-key.js
+[Worker] Generating a key pair...
+PASS [Worker] keyPair.toString() is '[object Object]'
+PASS [Worker] keyPair.publicKey.type is 'public'
+PASS [Worker] keyPair.publicKey.extractable is true
+PASS [Worker] keyPair.publicKey.algorithm.name is 'ECDH'
+PASS [Worker] keyPair.publicKey.algorithm.namedCurve is 'P-256'
+PASS [Worker] keyPair.publicKey.usages is [ ]
+PASS [Worker] keyPair.privateKey.type is 'private'
+PASS [Worker] keyPair.privateKey.extractable is false
+PASS [Worker] keyPair.privateKey.algorithm.name is 'ECDH'
+PASS [Worker] keyPair.privateKey.algorithm.namedCurve is 'P-256'
+PASS [Worker] keyPair.privateKey.usages is ['deriveBits', 'deriveKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/crypto/workers/subtle/ec-generate-key.html b/LayoutTests/crypto/workers/subtle/ec-generate-key.html
new file mode 100644 (file)
index 0000000..90fbdd1
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+    <script>
+        worker = startWorker('resources/ec-generate-key.js');
+    </script>
+    <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/crypto/workers/subtle/resources/ec-generate-key.js b/LayoutTests/crypto/workers/subtle/resources/ec-generate-key.js
new file mode 100644 (file)
index 0000000..e380517
--- /dev/null
@@ -0,0 +1,26 @@
+importScripts('../../../../resources/js-test-pre.js');
+importScripts("../../../resources/common.js");
+
+description("Test generating an EC key pair with P-256 using ECDH algorithm in workers.");
+
+jsTestIsAsync = true;
+
+var nonExtractable = false;
+
+debug("Generating a key pair...");
+crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-256"}, nonExtractable, ["deriveKey", "deriveBits"]).then(function(result) {
+    keyPair = result;
+    shouldBe("keyPair.toString()", "'[object Object]'");
+    shouldBe("keyPair.publicKey.type", "'public'");
+    shouldBe("keyPair.publicKey.extractable", "true");
+    shouldBe("keyPair.publicKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.publicKey.usages", "[ ]");
+    shouldBe("keyPair.privateKey.type", "'private'");
+    shouldBe("keyPair.privateKey.extractable", "false");
+    shouldBe("keyPair.privateKey.algorithm.name", "'ECDH'");
+    shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-256'");
+    shouldBe("keyPair.privateKey.usages", "['deriveBits', 'deriveKey']");
+
+    finishJSTest();
+});
\ No newline at end of file
index 39ab695..9b58cb2 100644 (file)
@@ -1,3 +1,16 @@
+2017-03-06  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebCrypto] Implement ECDH GenerateKey operation
+        https://bugs.webkit.org/show_bug.cgi?id=169093
+        <rdar://problem/23789585>
+
+        Reviewed by Brent Fulgham.
+
+        * web-platform-tests/WebCryptoAPI/generateKey/failures_ECDH.worker-expected.txt:
+        * web-platform-tests/WebCryptoAPI/generateKey/successes_ECDH.worker-expected.txt:
+        * web-platform-tests/WebCryptoAPI/generateKey/test_failures_ECDH-expected.txt:
+        * web-platform-tests/WebCryptoAPI/generateKey/test_successes_ECDH-expected.txt:
+
 2017-03-06  Alex Christensen  <achristensen@webkit.org>
 
         Fix URLs relative to file URLs with paths beginning with Windows drive letters
index 053620a..e797642 100644 (file)
@@ -323,96 +323,96 @@ PASS Bad algorithm: generateKey({name: EC, namedCurve: P521}, false, [decrypt, s
 PASS Bad algorithm: generateKey({name: EC, namedCurve: P521}, true, [decrypt, sign, deriveBits, decrypt, sign, deriveBits]) 
 PASS Bad algorithm: generateKey({name: EC, namedCurve: P521}, RED, [decrypt, sign, deriveBits, decrypt, sign, deriveBits]) 
 PASS Bad algorithm: generateKey({name: EC, namedCurve: P521}, 7, [decrypt, sign, deriveBits, decrypt, sign, deriveBits]) 
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: P-512}, false, [deriveKey]) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: P-512}, true, [deriveKey]) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: P-512}, false, [deriveBits, deriveKey]) 
@@ -433,10 +433,10 @@ PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: Curve25519}, f
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: Curve25519}, true, []) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: Curve25519}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: Curve25519}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
-FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-256}, false, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-256}, true, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-384}, false, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-384}, true, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
+PASS Empty usages: generateKey({name: ECDH, namedCurve: P-256}, false, []) 
+PASS Empty usages: generateKey({name: ECDH, namedCurve: P-256}, true, []) 
+PASS Empty usages: generateKey({name: ECDH, namedCurve: P-384}, false, []) 
+PASS Empty usages: generateKey({name: ECDH, namedCurve: P-384}, true, []) 
 FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-521}, false, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
 FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-521}, true, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
 
index 9e9dfb0..cb49e32 100644 (file)
@@ -1,74 +1,74 @@
 
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
 
index 38c9bcd..2ec0423 100644 (file)
@@ -325,96 +325,96 @@ PASS Bad algorithm: generateKey({name: EC, namedCurve: P521}, false, [decrypt, s
 PASS Bad algorithm: generateKey({name: EC, namedCurve: P521}, true, [decrypt, sign, deriveBits, decrypt, sign, deriveBits]) 
 PASS Bad algorithm: generateKey({name: EC, namedCurve: P521}, RED, [decrypt, sign, deriveBits, decrypt, sign, deriveBits]) 
 PASS Bad algorithm: generateKey({name: EC, namedCurve: P521}, 7, [decrypt, sign, deriveBits, decrypt, sign, deriveBits]) 
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) assert_equals: Bad usages not supported expected "SyntaxError" but got "NotSupportedError"
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, encrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, decrypt]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, sign]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, verify]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, wrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, unwrapKey]) 
+PASS Bad usages: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits, unwrapKey]) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: P-512}, false, [deriveKey]) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: P-512}, true, [deriveKey]) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: P-512}, false, [deriveBits, deriveKey]) 
@@ -435,10 +435,10 @@ PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: Curve25519}, f
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: Curve25519}, true, []) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: Curve25519}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
 PASS Bad algorithm property: generateKey({name: ECDH, namedCurve: Curve25519}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
-FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-256}, false, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-256}, true, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-384}, false, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
-FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-384}, true, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
+PASS Empty usages: generateKey({name: ECDH, namedCurve: P-256}, false, []) 
+PASS Empty usages: generateKey({name: ECDH, namedCurve: P-256}, true, []) 
+PASS Empty usages: generateKey({name: ECDH, namedCurve: P-384}, false, []) 
+PASS Empty usages: generateKey({name: ECDH, namedCurve: P-384}, true, []) 
 FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-521}, false, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
 FAIL Empty usages: generateKey({name: ECDH, namedCurve: P-521}, true, []) assert_equals: Empty usages not supported expected "SyntaxError" but got "NotSupportedError"
 
index aa0e340..08703da 100644 (file)
@@ -3,76 +3,76 @@ generateKey Tests for Good Parameters
 Warning! RSA key generation is intrinsically very slow, so the related tests can take up to several minutes to complete, depending on browser!
 
 
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
-FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The operation is not supported. Reached unreachable code
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ECDH, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ECDH, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: ecdh, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: ecdh, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-256}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveBits, deriveKey]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+PASS Success: generateKey({name: Ecdh, namedCurve: P-384}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) 
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveBits, deriveKey]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, false, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
+FAIL Success: generateKey({name: Ecdh, namedCurve: P-521}, true, [deriveKey, deriveBits, deriveKey, deriveBits, deriveKey, deriveBits]) assert_unreached: Threw an unexpected error: NotSupportedError (DOM Exception 9): The algorithm is not supported Reached unreachable code
 
index dd2aa7b..0db1afa 100644 (file)
@@ -342,6 +342,7 @@ set(WebCore_NON_SVG_IDL_FILES
     crypto/parameters/AesCbcCfbParams.idl
     crypto/parameters/AesGcmParams.idl
     crypto/parameters/AesKeyGenParams.idl
+    crypto/parameters/EcKeyParams.idl
     crypto/parameters/HmacKeyParams.idl
     crypto/parameters/RsaHashedImportParams.idl
     crypto/parameters/RsaHashedKeyGenParams.idl
index 24b7913..23bd5f2 100644 (file)
@@ -1,3 +1,66 @@
+2017-03-06  Jiewen Tan  <jiewen_tan@apple.com>
+
+        [WebCrypto] Implement ECDH GenerateKey operation
+        https://bugs.webkit.org/show_bug.cgi?id=169093
+        <rdar://problem/23789585>
+
+        Reviewed by Brent Fulgham.
+
+        This patch implements GenerateKey operation of ECDH according to:
+        https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations.
+        Note: Sad that we are not able to support P-521 at this moment due
+        to lack of necessary support in the underlying crypto library.
+
+        Tests: crypto/subtle/ec-generate-key-malformed-parameters.html
+               crypto/subtle/ecdh-generate-key-extractable.html
+               crypto/subtle/ecdh-generate-key-p256.html
+               crypto/subtle/ecdh-generate-key-p384.html
+               crypto/subtle/ecdh-generate-key-single-usage.html
+               crypto/workers/subtle/ec-generate-key.html
+
+        * CMakeLists.txt:
+        * DerivedSources.make:
+        * PlatformGTK.cmake:
+        * PlatformMac.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSCryptoKeyCustom.cpp:
+        (WebCore::JSCryptoKey::algorithm):
+        * bindings/js/JSSubtleCryptoCustom.cpp:
+        (WebCore::normalizeCryptoAlgorithmParameters):
+        (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
+        Add support for ECDH.
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::CloneSerializer::write):
+        Structured clonable will be added later on.
+        * crypto/CommonCryptoUtilities.h:
+        Add SPI for EC.
+        * crypto/CryptoAlgorithmParameters.h:
+        * crypto/CryptoKey.h:
+        * crypto/algorithms/CryptoAlgorithmECDH.cpp: Added.
+        (WebCore::CryptoAlgorithmECDH::create):
+        (WebCore::CryptoAlgorithmECDH::identifier):
+        (WebCore::CryptoAlgorithmECDH::generateKey):
+        * crypto/algorithms/CryptoAlgorithmECDH.h: Added.
+        * crypto/gnutls/CryptoKeyECGnuTLS.cpp: Added.
+        (WebCore::CryptoKeyEC::~CryptoKeyEC):
+        (WebCore::CryptoKeyEC::platformGeneratePair):
+        * crypto/keys/CryptoKeyEC.cpp: Added.
+        (WebCore::CryptoKeyEC::CryptoKeyEC):
+        (WebCore::CryptoKeyEC::generatePair):
+        (WebCore::CryptoKeyEC::buildAlgorithm):
+        (WebCore::CryptoKeyEC::exportData):
+        * crypto/keys/CryptoKeyEC.h: Added.
+        (WebCore::EcKeyAlgorithm::EcKeyAlgorithm):
+        (WebCore::EcKeyAlgorithm::namedCurve):
+        * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
+        (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
+        Add support for ECDH.
+        * crypto/mac/CryptoKeyECMac.cpp: Added.
+        (WebCore::CryptoKeyEC::~CryptoKeyEC):
+        (WebCore::CryptoKeyEC::platformGeneratePair):
+        * crypto/parameters/CryptoAlgorithmEcKeyParams.h: Added.
+        * crypto/parameters/EcKeyParams.idl: Added.
+
 2017-03-06  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         Unreviewed, fix unused parameter warning after r213464
index d9275af..c24e6f3 100644 (file)
@@ -274,6 +274,7 @@ JS_BINDING_IDLS = \
     $(WebCore)/crypto/parameters/AesCbcCfbParams.idl \
     $(WebCore)/crypto/parameters/AesGcmParams.idl \
     $(WebCore)/crypto/parameters/AesKeyGenParams.idl \
+    $(WebCore)/crypto/parameters/EcKeyParams.idl \
     $(WebCore)/crypto/parameters/HmacKeyParams.idl \
     $(WebCore)/crypto/parameters/RsaHashedImportParams.idl \
     $(WebCore)/crypto/parameters/RsaHashedKeyGenParams.idl \
index 6e00098..3cd0db9 100644 (file)
@@ -386,6 +386,7 @@ if (ENABLE_SUBTLE_CRYPTO)
         crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
         crypto/algorithms/CryptoAlgorithmAES_GCM.cpp
         crypto/algorithms/CryptoAlgorithmAES_KW.cpp
+        crypto/algorithms/CryptoAlgorithmECDH.cpp
         crypto/algorithms/CryptoAlgorithmHMAC.cpp
         crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
         crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
@@ -406,12 +407,14 @@ if (ENABLE_SUBTLE_CRYPTO)
         crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp
         crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp
         crypto/gnutls/CryptoAlgorithmRegistryGnuTLS.cpp
+        crypto/gnutls/CryptoKeyECGnuTLS.cpp
         crypto/gnutls/CryptoKeyRSAGnuTLS.cpp
         crypto/gnutls/SerializedCryptoKeyWrapGnuTLS.cpp
 
         crypto/keys/CryptoKeyAES.cpp
         crypto/keys/CryptoKeyDataOctetSequence.cpp
         crypto/keys/CryptoKeyDataRSAComponents.cpp
+        crypto/keys/CryptoKeyEC.cpp
         crypto/keys/CryptoKeyHMAC.cpp
         crypto/keys/CryptoKeyRSA.cpp
         crypto/keys/CryptoKeySerializationRaw.cpp
index 2f62b17..5e0d955 100644 (file)
@@ -182,6 +182,7 @@ list(APPEND WebCore_SOURCES
     crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
     crypto/algorithms/CryptoAlgorithmAES_GCM.cpp
     crypto/algorithms/CryptoAlgorithmAES_KW.cpp
+    crypto/algorithms/CryptoAlgorithmECDH.cpp
     crypto/algorithms/CryptoAlgorithmHMAC.cpp
     crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
     crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
@@ -195,6 +196,7 @@ list(APPEND WebCore_SOURCES
     crypto/keys/CryptoKeyAES.cpp
     crypto/keys/CryptoKeyDataOctetSequence.cpp
     crypto/keys/CryptoKeyDataRSAComponents.cpp
+    crypto/keys/CryptoKeyEC.cpp
     crypto/keys/CryptoKeyHMAC.cpp
     crypto/keys/CryptoKeyRSA.cpp
     crypto/keys/CryptoKeySerializationRaw.cpp
@@ -208,6 +210,7 @@ list(APPEND WebCore_SOURCES
     crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp
     crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp
     crypto/mac/CryptoAlgorithmRegistryMac.cpp
+    crypto/mac/CryptoKeyECDHMac.cpp
     crypto/mac/CryptoKeyMac.cpp
     crypto/mac/CryptoKeyRSAMac.cpp
     crypto/mac/SerializedCryptoKeyWrapMac.mm
index abe9dd5..2c1f5bc 100644 (file)
                573489391DAC6B6E00DC0667 /* CryptoAlgorithmParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 573489381DAC6B6D00DC0667 /* CryptoAlgorithmParameters.h */; };
                5739E12F1DAC7F7800E14383 /* JSCryptoAlgorithmParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5739E12E1DAC7F7800E14383 /* JSCryptoAlgorithmParameters.h */; };
                5739E1311DAC7FD100E14383 /* JSCryptoAlgorithmParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5739E1301DAC7FD100E14383 /* JSCryptoAlgorithmParameters.cpp */; };
+               5750A9741E68D00000705C4A /* CryptoKeyEC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5750A9721E68D00000705C4A /* CryptoKeyEC.cpp */; };
+               5750A9751E68D00000705C4A /* CryptoKeyEC.h in Headers */ = {isa = PBXBuildFile; fileRef = 5750A9731E68D00000705C4A /* CryptoKeyEC.h */; };
+               5750A97B1E69161600705C4A /* CryptoKeyECMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5750A97A1E69161600705C4A /* CryptoKeyECMac.cpp */; };
+               5750A97E1E6A13EF00705C4A /* CryptoAlgorithmEcKeyParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5750A97D1E6A13EF00705C4A /* CryptoAlgorithmEcKeyParams.h */; };
+               5750A9811E6A150800705C4A /* JSEcKeyParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5750A97F1E6A150800705C4A /* JSEcKeyParams.cpp */; };
+               5750A9821E6A150800705C4A /* JSEcKeyParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5750A9801E6A150800705C4A /* JSEcKeyParams.h */; };
+               5750A9861E6A216800705C4A /* CryptoAlgorithmECDH.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5750A9841E6A216800705C4A /* CryptoAlgorithmECDH.cpp */; };
+               5750A9871E6A216800705C4A /* CryptoAlgorithmECDH.h in Headers */ = {isa = PBXBuildFile; fileRef = 5750A9851E6A216800705C4A /* CryptoAlgorithmECDH.h */; };
                5768E4341DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5768E4331DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h */; };
                5768E4361DB7527400D0A4F7 /* JSRsaHashedKeyGenParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5768E4351DB7527300D0A4F7 /* JSRsaHashedKeyGenParams.cpp */; };
                577483121DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h */; };
                5739E1301DAC7FD100E14383 /* JSCryptoAlgorithmParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoAlgorithmParameters.cpp; sourceTree = "<group>"; };
                574AC7531DAC367D00E9744C /* CryptoAlgorithmParameters.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CryptoAlgorithmParameters.idl; sourceTree = "<group>"; };
                574D42791D594FF6002CF50E /* GlobalCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GlobalCrypto.idl; sourceTree = "<group>"; };
+               5750A9721E68D00000705C4A /* CryptoKeyEC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoKeyEC.cpp; sourceTree = "<group>"; };
+               5750A9731E68D00000705C4A /* CryptoKeyEC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoKeyEC.h; sourceTree = "<group>"; };
+               5750A97A1E69161600705C4A /* CryptoKeyECMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoKeyECMac.cpp; sourceTree = "<group>"; };
+               5750A97C1E6A12B400705C4A /* EcKeyParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = EcKeyParams.idl; sourceTree = "<group>"; };
+               5750A97D1E6A13EF00705C4A /* CryptoAlgorithmEcKeyParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmEcKeyParams.h; sourceTree = "<group>"; };
+               5750A97F1E6A150800705C4A /* JSEcKeyParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEcKeyParams.cpp; sourceTree = "<group>"; };
+               5750A9801E6A150800705C4A /* JSEcKeyParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEcKeyParams.h; sourceTree = "<group>"; };
+               5750A9841E6A216800705C4A /* CryptoAlgorithmECDH.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmECDH.cpp; sourceTree = "<group>"; };
+               5750A9851E6A216800705C4A /* CryptoAlgorithmECDH.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmECDH.h; sourceTree = "<group>"; };
                5768E4331DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRsaHashedKeyGenParams.h; sourceTree = "<group>"; };
                5768E4351DB7527300D0A4F7 /* JSRsaHashedKeyGenParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRsaHashedKeyGenParams.cpp; sourceTree = "<group>"; };
                577483101DADC49900716EF9 /* AesKeyGenParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AesKeyGenParams.idl; sourceTree = "<group>"; };
                                E1FE136E183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp */,
                                E1233F0E185A4130008DFAF5 /* CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp */,
                                E1C266D618317AB4003F8B33 /* CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp */,
+                               5750A97A1E69161600705C4A /* CryptoKeyECMac.cpp */,
                                E19AC3F8182566F700349426 /* CryptoKeyMac.cpp */,
                                E164FAA418315E1A00DB4E61 /* CryptoKeyRSAMac.cpp */,
                                E18DF33618AAF14D00773E59 /* SerializedCryptoKeyWrapMac.mm */,
                                57B5F7F71E5BE84000F34F90 /* CryptoAlgorithmAES_GCM.h */,
                                E1FE1378184D21BB00892F13 /* CryptoAlgorithmAES_KW.cpp */,
                                E1FE1379184D21BB00892F13 /* CryptoAlgorithmAES_KW.h */,
+                               5750A9841E6A216800705C4A /* CryptoAlgorithmECDH.cpp */,
+                               5750A9851E6A216800705C4A /* CryptoAlgorithmECDH.h */,
                                E125F82F1822F11B00D84CD9 /* CryptoAlgorithmHMAC.cpp */,
                                E125F8301822F11B00D84CD9 /* CryptoAlgorithmHMAC.h */,
                                E1FE1368183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.cpp */,
                                E125F862182C303A00D84CD9 /* CryptoKeyDataOctetSequence.h */,
                                E1C266DC18319F31003F8B33 /* CryptoKeyDataRSAComponents.cpp */,
                                E1C266DD18319F31003F8B33 /* CryptoKeyDataRSAComponents.h */,
+                               5750A9721E68D00000705C4A /* CryptoKeyEC.cpp */,
+                               5750A9731E68D00000705C4A /* CryptoKeyEC.h */,
                                E125F8331822F18A00D84CD9 /* CryptoKeyHMAC.cpp */,
                                E125F8341822F18A00D84CD9 /* CryptoKeyHMAC.h */,
                                57E2336A1DCC262400F28D01 /* CryptoKeyRSA.cpp */,
                                57B5F8081E5D1A9800F34F90 /* CryptoAlgorithmAesGcmParams.h */,
                                577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h */,
                                E19AC3F61824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h */,
+                               5750A97D1E6A13EF00705C4A /* CryptoAlgorithmEcKeyParams.h */,
                                577483181DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h */,
                                E19DA29B18189ADD00088BC8 /* CryptoAlgorithmHmacKeyParamsDeprecated.h */,
                                E1C6571E1816E50300256CDD /* CryptoAlgorithmHmacParamsDeprecated.h */,
                                5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */,
                                E1FE1376184D1E3300892F13 /* CryptoAlgorithmRsaOaepParamsDeprecated.h */,
                                E1BD331B182D8EE900C05D9F /* CryptoAlgorithmRsaSsaParamsDeprecated.h */,
+                               5750A97C1E6A12B400705C4A /* EcKeyParams.idl */,
                                577483171DB1FE8900716EF9 /* HmacKeyParams.idl */,
                                57E2336C1DCD437000F28D01 /* RsaHashedImportParams.idl */,
                                57F827391DB72C22009D2BF4 /* RsaHashedKeyGenParams.idl */,
                                E1F80B8C183172B5007885C3 /* JSCryptoKeyPair.h */,
                                57D0018E1DD5415300ED19D9 /* JSCryptoKeyUsage.cpp */,
                                57D0018C1DD5413200ED19D9 /* JSCryptoKeyUsage.h */,
+                               5750A97F1E6A150800705C4A /* JSEcKeyParams.cpp */,
+                               5750A9801E6A150800705C4A /* JSEcKeyParams.h */,
                                57E233681DCAB24300F28D01 /* JSHmacKeyParams.cpp */,
                                57E233661DCAB21C00F28D01 /* JSHmacKeyParams.h */,
                                57E2335E1DC7D67B00F28D01 /* JSJsonWebKey.cpp */,
                                FD31607E12B026F700C1A359 /* AudioChannel.h in Headers */,
                                FD31600512B0267600C1A359 /* AudioContext.h in Headers */,
                                FD31607F12B026F700C1A359 /* AudioDestination.h in Headers */,
+                               5750A9871E6A216800705C4A /* CryptoAlgorithmECDH.h in Headers */,
                                070F549E17F2402700169E04 /* AudioDestinationConsumer.h in Headers */,
                                FD3160BD12B0272A00C1A359 /* AudioDestinationMac.h in Headers */,
                                FD31600812B0267600C1A359 /* AudioDestinationNode.h in Headers */,
                                BC6932740D7E293900AE44D1 /* JSDOMWindowBase.h in Headers */,
                                652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */,
                                460CBF361D4BCD0E0092E88E /* JSDOMWindowProperties.h in Headers */,
+                               5750A97E1E6A13EF00705C4A /* CryptoAlgorithmEcKeyParams.h in Headers */,
                                BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */,
                                65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */,
                                7C45C9D31E3FCBD700AAB558 /* JSDOMWrapperCache.h in Headers */,
                                99CC0B5C18BE984A006CEBCC /* ReplaySessionSegment.h in Headers */,
                                4998AEC613F9D0EA0090B1AA /* RequestAnimationFrameCallback.h in Headers */,
                                F55B3DD01251F12D003EF269 /* ResetInputType.h in Headers */,
+                               5750A9821E6A150800705C4A /* JSEcKeyParams.h in Headers */,
                                7EE6846A12D26E3800E79415 /* ResourceError.h in Headers */,
                                934F713C0D5A6F1900018D69 /* ResourceErrorBase.h in Headers */,
                                514C76790CE923A1007EF3CD /* ResourceHandle.h in Headers */,
                                BC2272BD0E82EAAE00E7F975 /* StyleRareNonInheritedData.h in Headers */,
                                BC2272870E82E70700E7F975 /* StyleReflection.h in Headers */,
                                E461802D1C8DD2900026C02C /* StyleRelations.h in Headers */,
+                               5750A9751E68D00000705C4A /* CryptoKeyEC.h in Headers */,
                                E4D58EB517B4DBDC00CBDCA8 /* StyleResolveForDocument.h in Headers */,
                                E139866415478474001E3F65 /* StyleResolver.h in Headers */,
                                E4BBED4D14FCDBA1003F0B98 /* StyleRule.h in Headers */,
                                511EF2CB17F0FD3500E4FA16 /* JSIDBVersionChangeEvent.cpp in Sources */,
                                A77979280D6B9E64003851B9 /* JSImageData.cpp in Sources */,
                                A7D0318E0E93540300E24ACD /* JSImageDataCustom.cpp in Sources */,
+                               5750A9811E6A150800705C4A /* JSEcKeyParams.cpp in Sources */,
                                A86629D409DA2B48009633A6 /* JSInputEvent.cpp in Sources */,
                                7A0E771E10C00DB100A0276E /* JSInspectorFrontendHost.cpp in Sources */,
                                7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */,
                                FABE72FD1059C21100D999DD /* MathMLElementFactory.cpp in Sources */,
                                0BCF83F61059C1EB00D999DD /* MathMLFractionElement.cpp in Sources */,
                                FABE72F81059C1EB00D999DD /* MathMLMathElement.cpp in Sources */,
+                               5750A9741E68D00000705C4A /* CryptoKeyEC.cpp in Sources */,
                                05D913CEEAB2A60534218ACF /* MathMLMencloseElement.cpp in Sources */,
                                FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */,
                                16EA24CEEAB2A60534218ACF /* MathMLOperatorDictionary.cpp in Sources */,
                                BCE65D320EAD1211007E4533 /* Theme.cpp in Sources */,
                                310D71951B335C9D009C7B73 /* ThemeCocoa.mm in Sources */,
                                44C991A00F3D210E00586670 /* ThemeIOS.mm in Sources */,
+                               5750A9861E6A216800705C4A /* CryptoAlgorithmECDH.cpp in Sources */,
                                BCE659E90EA92FFA007E4533 /* ThemeMac.mm in Sources */,
                                976D6C94122B8A3D001FD1F7 /* ThreadableBlobRegistry.cpp in Sources */,
                                0B90561E0F257E930095FF6A /* ThreadableLoader.cpp in Sources */,
                                FD7F299313D4C0CB00AD9535 /* WaveShaperNode.cpp in Sources */,
                                FD7F299613D4C0CB00AD9535 /* WaveShaperProcessor.cpp in Sources */,
                                29A8124A0FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.mm in Sources */,
+                               5750A97B1E69161600705C4A /* CryptoKeyECMac.cpp in Sources */,
                                AAA728F816D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.mm in Sources */,
                                AA478A8016CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.mm in Sources */,
                                2D3EF4491917915C00034184 /* WebActionDisablingCALayerDelegate.mm in Sources */,
index e975400..ae277cf 100644 (file)
@@ -29,6 +29,7 @@
 #if ENABLE(SUBTLE_CRYPTO)
 
 #include "CryptoKeyAES.h"
+#include "CryptoKeyEC.h"
 #include "CryptoKeyHMAC.h"
 #include "CryptoKeyRSA.h"
 #include "JSCryptoAlgorithmBuilder.h"
@@ -54,6 +55,12 @@ JSValue JSCryptoKey::algorithm(JSC::ExecState& state) const
         builder.add("length", aesAlgorithm.length());
         break;
     }
+    case KeyAlgorithmClass::EC: {
+        auto& ecAlgorithm = downcast<EcKeyAlgorithm>(*algorithm);
+        builder.add("name", ecAlgorithm.name());
+        builder.add("namedCurve", ecAlgorithm.namedCurve());
+        break;
+    }
     case KeyAlgorithmClass::HMAC: {
         auto& hmacAlgorithm = downcast<HmacKeyAlgorithm>(*algorithm);
         builder.add("name", hmacAlgorithm.name());
index ba70cca..b906224 100644 (file)
@@ -38,6 +38,7 @@
 #include "JSCryptoKeyPair.h"
 #include "JSDOMPromise.h"
 #include "JSDOMWrapper.h"
+#include "JSEcKeyParams.h"
 #include "JSHmacKeyParams.h"
 #include "JSJsonWebKey.h"
 #include "JSRsaHashedImportParams.h"
@@ -199,6 +200,13 @@ static std::unique_ptr<CryptoAlgorithmParameters> normalizeCryptoAlgorithmParame
                 result = std::make_unique<CryptoAlgorithmHmacKeyParams>(params);
                 break;
             }
+            case CryptoAlgorithmIdentifier::ECDSA:
+            case CryptoAlgorithmIdentifier::ECDH: {
+                auto params = convertDictionary<CryptoAlgorithmEcKeyParams>(state, value);
+                RETURN_IF_EXCEPTION(scope, nullptr);
+                result = std::make_unique<CryptoAlgorithmEcKeyParams>(params);
+                break;
+            }
             default:
                 throwNotSupportedError(state, scope);
                 return nullptr;
@@ -724,9 +732,9 @@ static void jsSubtleCryptoFunctionGenerateKeyPromise(ExecState& state, Ref<Defer
         rejectWithException(WTFMove(capturedPromise), ec);
     };
 
-    // The 11 December 2014 version of the specification suggests we should perform the following task asynchronously
+    // The 26 January 2017 version of the specification suggests we should perform the following task asynchronously
     // regardless what kind of keys it produces: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey
-    // That's simply not efficient for AES and HMAC keys. Therefore, we perform it as an async task conditionally.
+    // That's simply not efficient for AES, HMAC and EC keys. Therefore, we perform it as an async task only for RSA keys.
     algorithm->generateKey(*params, extractable, keyUsages, WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContextFromExecState(&state));
 }
 
index c9904c0..4c4a39e 100644 (file)
@@ -1208,6 +1208,10 @@ private:
             write(key->algorithmIdentifier());
             write(downcast<CryptoKeyAES>(*key).key());
             break;
+        case CryptoKeyClass::EC:
+            // A dummy implementation for now.
+            // FIXME: https://bugs.webkit.org/show_bug.cgi?id=169232
+            break;
         case CryptoKeyClass::RSA:
             write(CryptoKeyClassSubtag::RSA);
             write(key->algorithmIdentifier());
index 904ac24..7cd105d 100644 (file)
@@ -33,6 +33,7 @@
 
 #if USE(APPLE_INTERNAL_SDK)
 #include <CommonCrypto/CommonCryptorSPI.h>
+#include <CommonCrypto/CommonECCryptor.h>
 #include <CommonCrypto/CommonRSACryptor.h>
 #include <CommonCrypto/CommonRandomSPI.h>
 #endif
@@ -85,6 +86,10 @@ extern "C" CCRSAKeyType CCRSAGetKeyType(CCRSACryptorRef key);
 extern "C" CCCryptorStatus CCRSACryptorImport(const void *keyPackage, size_t keyPackageLen, CCRSACryptorRef *key);
 extern "C" CCCryptorStatus CCRSACryptorExport(CCRSACryptorRef key, void *out, size_t *outLen);
 
+typedef struct _CCECCryptor *CCECCryptorRef;
+extern "C" CCCryptorStatus CCECCryptorGeneratePair(size_t keysize, CCECCryptorRef *publicKey, CCECCryptorRef *privateKey);
+extern "C" void CCECCryptorRelease(CCECCryptorRef key);
+
 #if !USE(APPLE_INTERNAL_SDK)
 extern "C" CCCryptorStatus CCCryptorGCM(CCOperation op, CCAlgorithm alg, const void* key, size_t keyLength, const void* iv, size_t ivLen, const void* aData, size_t aDataLen, const void* dataIn, size_t dataInLength, void* dataOut, void* tag, size_t* tagLength);
 #endif
index 30cc7f4..6aa633b 100644 (file)
@@ -40,6 +40,7 @@ public:
         AesCbcCfbParams,
         AesGcmParams,
         AesKeyGenParams,
+        EcKeyParams,
         HmacKeyParams,
         RsaHashedKeyGenParams,
         RsaHashedImportParams,
index df06b54..bfd769b 100644 (file)
@@ -43,12 +43,14 @@ class CryptoKeyData;
 
 enum class CryptoKeyClass {
     AES,
+    EC,
     HMAC,
     RSA
 };
 
 enum class KeyAlgorithmClass {
     AES,
+    EC,
     HMAC,
     HRSA,
     RSA,
diff --git a/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp b/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp
new file mode 100644 (file)
index 0000000..199bd7f
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoAlgorithmECDH.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "CryptoAlgorithmEcKeyParams.h"
+#include "CryptoKeyEC.h"
+#include "ExceptionCode.h"
+
+namespace WebCore {
+
+Ref<CryptoAlgorithm> CryptoAlgorithmECDH::create()
+{
+    return adoptRef(*new CryptoAlgorithmECDH);
+}
+
+CryptoAlgorithmIdentifier CryptoAlgorithmECDH::identifier() const
+{
+    return s_identifier;
+}
+
+void CryptoAlgorithmECDH::generateKey(const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&)
+{
+    const auto& ecParameters = downcast<CryptoAlgorithmEcKeyParams>(parameters);
+
+    if (usages & (CryptoKeyUsageEncrypt | CryptoKeyUsageDecrypt | CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageWrapKey | CryptoKeyUsageUnwrapKey)) {
+        exceptionCallback(SYNTAX_ERR);
+        return;
+    }
+
+    auto result = CryptoKeyEC::generatePair(CryptoAlgorithmIdentifier::ECDH, ecParameters.namedCurve, extractable, usages);
+    if (result.hasException()) {
+        exceptionCallback(result.releaseException().code());
+        return;
+    }
+
+    auto pair = result.releaseReturnValue();
+    pair.publicKey->setUsagesBitmap(0);
+    pair.privateKey->setUsagesBitmap(pair.privateKey->usagesBitmap() & (CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits));
+    callback(WTFMove(pair));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
diff --git a/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h b/Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.h
new file mode 100644 (file)
index 0000000..941eb04
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CryptoAlgorithm.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class CryptoAlgorithmECDH final : public CryptoAlgorithm {
+public:
+    static constexpr const char* s_name = "ECDH";
+    static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::ECDH;
+    static Ref<CryptoAlgorithm> create();
+
+private:
+    CryptoAlgorithmECDH() = default;
+    CryptoAlgorithmIdentifier identifier() const final;
+
+    void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
diff --git a/Source/WebCore/crypto/gnutls/CryptoKeyECGnuTLS.cpp b/Source/WebCore/crypto/gnutls/CryptoKeyECGnuTLS.cpp
new file mode 100644 (file)
index 0000000..8197cf4
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoKeyEC.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "CryptoKeyPair.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+struct _PlatformECKeyGnuTLS {
+};
+
+CryptoKeyEC::~CryptoKeyEC()
+{
+    notImplemented();
+}
+
+std::optional<CryptoKeyPair> CryptoKeyEC::platformGeneratePair(CryptoAlgorithmIdentifier, NamedCurve, bool, CryptoKeyUsageBitmap)
+{
+    notImplemented();
+
+    return std::nullopt;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
diff --git a/Source/WebCore/crypto/keys/CryptoKeyEC.cpp b/Source/WebCore/crypto/keys/CryptoKeyEC.cpp
new file mode 100644 (file)
index 0000000..3b6dff9
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoKeyEC.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "CryptoAlgorithmRegistry.h"
+#include "CryptoKeyData.h"
+#include "ExceptionCode.h"
+
+namespace WebCore {
+
+static const char* const P256 = "P-256";
+static const char* const P384 = "P-384";
+
+CryptoKeyEC::CryptoKeyEC(CryptoAlgorithmIdentifier identifier, NamedCurve curve, CryptoKeyType type, PlatformECKey platformKey, bool extractable, CryptoKeyUsageBitmap usages)
+    : CryptoKey(identifier, type, extractable, usages)
+    , m_platformKey(platformKey)
+    , m_curve(curve)
+{
+}
+
+ExceptionOr<CryptoKeyPair> CryptoKeyEC::generatePair(CryptoAlgorithmIdentifier identifier, const String& namedCurve, bool extractable, CryptoKeyUsageBitmap usages)
+{
+    NamedCurve curve;
+    if (namedCurve == P256)
+        curve = NamedCurve::P256;
+    else if (namedCurve == P384)
+        curve = NamedCurve::P384;
+    else
+        return Exception { NOT_SUPPORTED_ERR };
+
+    auto result = platformGeneratePair(identifier, curve, extractable, usages);
+    if (!result)
+        return Exception { OperationError };
+
+    return WTFMove(*result);
+}
+
+std::unique_ptr<KeyAlgorithm> CryptoKeyEC::buildAlgorithm() const
+{
+    String name = CryptoAlgorithmRegistry::singleton().name(algorithmIdentifier());
+    switch (m_curve) {
+    case NamedCurve::P256:
+        return std::make_unique<EcKeyAlgorithm>(name, String(P256));
+    case NamedCurve::P384:
+        return std::make_unique<EcKeyAlgorithm>(name, String(P384));
+    }
+
+    ASSERT_NOT_REACHED();
+    return nullptr;
+}
+
+std::unique_ptr<CryptoKeyData> CryptoKeyEC::exportData() const
+{
+    // A dummy implementation for now.
+    return std::make_unique<CryptoKeyData>(CryptoKeyData::Format::OctetSequence);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
diff --git a/Source/WebCore/crypto/keys/CryptoKeyEC.h b/Source/WebCore/crypto/keys/CryptoKeyEC.h
new file mode 100644 (file)
index 0000000..52b48d9
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CryptoKey.h"
+#include "CryptoKeyPair.h"
+#include "ExceptionOr.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#if OS(DARWIN) && !PLATFORM(GTK)
+typedef struct _CCECCryptor *CCECCryptorRef;
+typedef CCECCryptorRef PlatformECKey;
+#endif
+
+#if PLATFORM(GTK)
+typedef struct _PlatformECKeyGnuTLS PlatformECKeyGnuTLS;
+typedef PlatformECKeyGnuTLS *PlatformECKey;
+#endif
+
+
+namespace WebCore {
+
+class EcKeyAlgorithm : public KeyAlgorithm {
+public:
+    EcKeyAlgorithm(const String& name, const String& curve)
+        : KeyAlgorithm(name)
+        , m_curve(curve)
+    {
+    }
+
+    KeyAlgorithmClass keyAlgorithmClass() const override { return KeyAlgorithmClass::EC; }
+
+    const String& namedCurve() const { return m_curve; }
+
+private:
+    String m_curve;
+};
+
+class CryptoKeyEC final : public CryptoKey {
+public:
+    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=169231
+    enum class NamedCurve {
+        P256,
+        P384,
+    };
+
+    static Ref<CryptoKeyEC> create(CryptoAlgorithmIdentifier identifier, NamedCurve curve, CryptoKeyType type, PlatformECKey platformKey, bool extractable, CryptoKeyUsageBitmap usages)
+    {
+        return adoptRef(*new CryptoKeyEC(identifier, curve, type, platformKey, extractable, usages));
+    }
+    virtual ~CryptoKeyEC();
+
+    static ExceptionOr<CryptoKeyPair> generatePair(CryptoAlgorithmIdentifier, const String&, bool extractable, CryptoKeyUsageBitmap);
+
+private:
+    CryptoKeyEC(CryptoAlgorithmIdentifier, NamedCurve, CryptoKeyType, PlatformECKey, bool extractable, CryptoKeyUsageBitmap);
+
+    CryptoKeyClass keyClass() const final { return CryptoKeyClass::EC; }
+
+    std::unique_ptr<KeyAlgorithm> buildAlgorithm() const final;
+    std::unique_ptr<CryptoKeyData> exportData() const final;
+
+    static std::optional<CryptoKeyPair> platformGeneratePair(CryptoAlgorithmIdentifier, NamedCurve, bool extractable, CryptoKeyUsageBitmap);
+
+    PlatformECKey m_platformKey;
+    NamedCurve m_curve;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CRYPTO_KEY(CryptoKeyEC, CryptoKeyClass::EC)
+
+SPECIALIZE_TYPE_TRAITS_KEY_ALGORITHM(EcKeyAlgorithm, KeyAlgorithmClass::EC)
+
+#endif // ENABLE(SUBTLE_CRYPTO)
index 006356c..c7c753a 100644 (file)
@@ -32,6 +32,7 @@
 #include "CryptoAlgorithmAES_CFB.h"
 #include "CryptoAlgorithmAES_GCM.h"
 #include "CryptoAlgorithmAES_KW.h"
+#include "CryptoAlgorithmECDH.h"
 #include "CryptoAlgorithmHMAC.h"
 #include "CryptoAlgorithmRSAES_PKCS1_v1_5.h"
 #include "CryptoAlgorithmRSASSA_PKCS1_v1_5.h"
@@ -50,6 +51,7 @@ void CryptoAlgorithmRegistry::platformRegisterAlgorithms()
     registerAlgorithm<CryptoAlgorithmAES_CFB>();
     registerAlgorithm<CryptoAlgorithmAES_GCM>();
     registerAlgorithm<CryptoAlgorithmAES_KW>();
+    registerAlgorithm<CryptoAlgorithmECDH>();
     registerAlgorithm<CryptoAlgorithmHMAC>();
     registerAlgorithm<CryptoAlgorithmRSAES_PKCS1_v1_5>();
     registerAlgorithm<CryptoAlgorithmRSASSA_PKCS1_v1_5>();
diff --git a/Source/WebCore/crypto/mac/CryptoKeyECMac.cpp b/Source/WebCore/crypto/mac/CryptoKeyECMac.cpp
new file mode 100644 (file)
index 0000000..6382a6f
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CryptoKeyEC.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "CommonCryptoUtilities.h"
+
+namespace WebCore {
+
+CryptoKeyEC::~CryptoKeyEC()
+{
+    CCECCryptorRelease(m_platformKey);
+}
+
+std::optional<CryptoKeyPair> CryptoKeyEC::platformGeneratePair(CryptoAlgorithmIdentifier identifier, NamedCurve curve, bool extractable, CryptoKeyUsageBitmap usages)
+{
+    size_t size;
+    switch (curve) {
+    case NamedCurve::P256:
+        size = 256;
+        break;
+    case NamedCurve::P384:
+        size = 384;
+        break;
+    }
+
+    CCECCryptorRef ccPublicKey;
+    CCECCryptorRef ccPrivateKey;
+    CCCryptorStatus status = CCECCryptorGeneratePair(size, &ccPublicKey, &ccPrivateKey);
+    if (status)
+        return std::nullopt;
+
+    auto publicKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Public, ccPublicKey, true, usages);
+    auto privateKey = CryptoKeyEC::create(identifier, curve, CryptoKeyType::Private, ccPrivateKey, extractable, usages);
+    return CryptoKeyPair { WTFMove(publicKey), WTFMove(privateKey) };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
diff --git a/Source/WebCore/crypto/parameters/CryptoAlgorithmEcKeyParams.h b/Source/WebCore/crypto/parameters/CryptoAlgorithmEcKeyParams.h
new file mode 100644 (file)
index 0000000..c4b580f
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CryptoAlgorithmParameters.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class CryptoAlgorithmEcKeyParams final : public CryptoAlgorithmParameters {
+public:
+    String namedCurve;
+
+    Class parametersClass() const final { return Class::EcKeyParams; }
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(EcKeyParams)
+
+#endif // ENABLE(SUBTLE_CRYPTO)
diff --git a/Source/WebCore/crypto/parameters/EcKeyParams.idl b/Source/WebCore/crypto/parameters/EcKeyParams.idl
new file mode 100644 (file)
index 0000000..5bfa0c9
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This is a unified dictionary for EcKeyImportParams and EcKeyGenParams.
+// https://www.w3.org/TR/WebCryptoAPI/#EcKeyImportParams-dictionary, and
+// https://www.w3.org/TR/WebCryptoAPI/#EcKeyGenParams-dictionary
+[
+    Conditional=SUBTLE_CRYPTO,
+    ImplementedAs=CryptoAlgorithmEcKeyParams
+] dictionary EcKeyParams : CryptoAlgorithmParameters {
+    required DOMString namedCurve;
+};