Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: LayoutTests/crypto/clone-ecKey-private.html

Issue 754563003: Add LayoutTests for WebCrypto's ECDH algorithm. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase onto master Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/crypto/clone-ecKey-private-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/crypto/clone-ecKey-private.html
diff --git a/LayoutTests/crypto/clone-ecKey-private.html b/LayoutTests/crypto/clone-ecKey-private.html
index 997130470c96ae4b9e7991292a9f50438753cb6a..bee675e5249f2901a4f7d98d23f8caa419de5082 100644
--- a/LayoutTests/crypto/clone-ecKey-private.html
+++ b/LayoutTests/crypto/clone-ecKey-private.html
@@ -13,14 +13,22 @@ description("Tests structured cloning of EC private keys");
jsTestIsAsync = true;
-// Tests the 12 permutations of keys generated by:
+// ECDSA and ECDH support different key usages. Pick either sign or deriveBits depending on the algorithm.
+function signOrDeriveBits(algorithmName) {
+ if (algorithmName == "ECDSA")
+ return ['sign'];
+ if (algorithmName == "ECDH")
+ return ['deriveBits'];
+}
+
+// Tests the 24 permutations of keys generated by:
// kPossibleAlgorithms x kPossibleExtractable x kPossibleKeyUsages x kPossibleCurves
//
// For practical reasons these tests are not exhaustive.
-var kPossibleAlgorithms = ['ECDSA'];
+var kPossibleAlgorithms = ['ECDSA', 'ECDH'];
var kPossibleExtractable = [true, false];
-var kPossibleKeyUsages = [[], ['sign']];
+var kPossibleKeyUsages = [[], signOrDeriveBits];
var kPossibleNamedCurves = ['P-256', 'P-384', 'P-521'];
// A mapping from curve name, to PKCS8 data (hex-encoded) for a valid private key.
@@ -38,6 +46,9 @@ function runTest(algorithmName, namedCurve, extractable, keyUsages)
var results = {};
+ if (typeof keyUsages == "function")
+ keyUsages = keyUsages(algorithmName);
+
return crypto.subtle.importKey('pkcs8', importData, importAlgorithm, extractable, keyUsages).then(function(importedKey) {
results.importedKey = importedKey;
importedKey.extraProperty = 'hi';
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/crypto/clone-ecKey-private-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698