blob: 1367f2c16e1c2bda1620df7c2b07f8ec07a113b9 [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 type="text/javascript">
description("Test exporting an ECDSA public key with raw format.");
jsTestIsAsync = true;
var algorithmKeyGen = {
name: "ECDSA",
namedCurve: "P-256"
};
var extractable = true;
var keyPair;
debug("Generating a key pair...");
crypto.subtle.generateKey(algorithmKeyGen, extractable, ["sign", "verify"]).then(function(result) {
keyPair = result;
debug("Exporting the public key...");
return crypto.subtle.exportKey("raw", keyPair.publicKey);
}).then(function(result) {
publicKey = result;
shouldBe("publicKey.byteLength", "65");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>