40 lines
1.3 KiB
HTML
40 lines
1.3 KiB
HTML
<!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>
|