blob: 8b2986937d83e5738f63e20e8198ff1488ef85db [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 signing operation with a P-384 private key");
jsTestIsAsync = true;
var extractable = true;
var jwkPrivateKey = {
kty: "EC",
crv: "P-384",
x: "5ugBBtfAK6EkhCcZRmpq_ULgoGH4iBfhH1z6RAnJgiWKRO8tVPvOJHZKGSw05puS",
y: "e5gXPiwGTKqwj_Ixvf_swUz2pVuWIcd9Z_hccP6EDKV1hph2bItMIOz4M1Pf7ErZ",
d: "4sxEb3O0Wavpb6lWKWkaAX9z_nM1VXnIx9A8ldBzeUqnWX7ZYQt6auwodiXPMaiV",
};
var ecdsaParams = {
name: "ECDSA",
hash: "SHA-256",
}
var data = asciiToUint8Array("Hello, World!");
crypto.subtle.importKey("jwk", jwkPrivateKey, { name: "ECDSA", namedCurve: "P-384" }, extractable, ["sign"]).then(function(key) {
return crypto.subtle.sign(ecdsaParams, key, data);
}).then(function(result) {
signature = result;
shouldBe("signature.byteLength", "96");
finishJSTest();
}, failAndFinishJSTest);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>