blob: 475c1f22814f10b10c0e55bff9960aecab27d130 [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 ECDSA verifying operation with a P-384 public key");
jsTestIsAsync = true;
var extractable = true;
var jwkPublicKey = {
kty: "EC",
crv: "P-384",
x: "5ugBBtfAK6EkhCcZRmpq_ULgoGH4iBfhH1z6RAnJgiWKRO8tVPvOJHZKGSw05puS",
y: "e5gXPiwGTKqwj_Ixvf_swUz2pVuWIcd9Z_hccP6EDKV1hph2bItMIOz4M1Pf7ErZ",
};
var ecdsaParams = {
name: "ECDSA",
hash: "SHA-256",
}
var data = asciiToUint8Array("Hello, World!");
var signature = hexStringToUint8Array("ae30b4edb6872a83f8333f67d20043649efa5f599bdeaf6164f8c2eb61ae552696c23710d94d25cbc1997285c8b07c773da820b5639176be4ec6b59cda4d436a97dd43f7de18b08d1e5f9c69d7358672bdecac2765e12cb0895a05fd5a636620");
crypto.subtle.importKey("jwk", jwkPublicKey, { name: "ECDSA", namedCurve: "P-384" }, extractable, ["verify"]).then(function(key) {
return crypto.subtle.verify(ecdsaParams, key, signature, data);
}).then(function(result) {
verified = result;
shouldBeTrue("verified");
finishJSTest();
}, failAndFinishJSTest);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>