blob: 2752e6fab0068d766e9883d2d73e660e3dc48f8d [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 importing a JWK ECDSA public key with ES384");
jsTestIsAsync = true;
var jwkKey = {
kty: "EC",
use: "sig",
ext: true,
crv: "P-384",
x: "1bHwFrsaPRjYq-zFOyLXK8Ugv3EqbVF075ct7ouTl_pwyhjeBu03JHjKTsyVbNWK",
y: "OPQLbvRDpocNk4FRQLUVRBbqiauWcnUn7cAC2uSOH6GpSLoTo6B-4LtHq0ydd-iu",
alg: "ES384"
};
var extractable = true;
debug("Importing a key...");
crypto.subtle.importKey("jwk", jwkKey, { name: "ECDSA", namedCurve: "P-384" }, extractable, ['verify']).then(function(result) {
publicKey = result;
shouldBe("publicKey.toString()", "'[object CryptoKey]'");
shouldBe("publicKey.type", "'public'");
shouldBe("publicKey.extractable", "true");
shouldBe("publicKey.algorithm.name", "'ECDSA'");
shouldBe("publicKey.algorithm.namedCurve", "'P-384'");
shouldBe("publicKey.usages", "['verify']");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>