blob: ec2bbc1d75d5056810f5be9c12bcb0547b68b7c8 [file] [log] [blame]
<!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-521 using ECDH algorithm.");
jsTestIsAsync = true;
var nonExtractable = false;
debug("Generating a key pair...");
crypto.subtle.generateKey({ name: "ECDH", namedCurve: "P-521"}, 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-521'");
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-521'");
shouldBe("keyPair.privateKey.usages", "['deriveBits', 'deriveKey']");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>