blob: 7fa13c50459a089bf16d71ef92637dc0515f8513 [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 exporting a P-521 ECDH public key with SPKI format.");
jsTestIsAsync = true;
var algorithmKeyGen = {
name: "ECDH",
namedCurve: "P-521"
};
var extractable = true;
var keyPair;
debug("Generating a key pair...");
crypto.subtle.generateKey(algorithmKeyGen, extractable, ["deriveKey", "deriveBits"]).then(function(result) {
keyPair = result;
debug("Exporting the public key...");
return crypto.subtle.exportKey("spki", keyPair.publicKey);
}).then(function(result) {
publicKey = result;
shouldBe("publicKey.byteLength", "158");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>