blob: 59f46f8975a4249127964007de1c163964973e1c [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 verification with RSASSA-PKCS1-v1_5 SHA-384 using an imported key");
jsTestIsAsync = true;
var extractable = false;
var text = asciiToUint8Array("Hello, World!");
var rsaImportParams = {
name: "RSASSA-PKCS1-v1_5",
hash: "SHA-384",
}
var jwkKey = {
kty: "RSA",
alg: "RS384",
use: "sig",
key_ops: ["verify"],
ext: true,
n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
e: "AQAB",
};
var signature = hexStringToUint8Array("8517104ae42b39e958e01a78158f90077b7711a60634873c3ae62565900dc1c7a3e75626b30e1281fa396594bbab742a5fc3be39dee3d981b9e4e83248bf69ed3671dee86a8f03c6a9b4465bf7b3dcd1dd04c3446e77aa340f20f9bd203966dd3dec2d4d135ea1c916f218a711ccaa167332f021ed7163ba61ffed6c0c48c4097ff979eea349011febf10398c3abcec9b4540ff0767fa9a29e7b119b8fdb8eb55786d311058dc509ce58da8abf50fe0ab2f1b092a24d3f8ae2f1f533a1ef0b7e191a43bb710acb376f4f5e620ffff602d9865a93e90f5d264309559a6acd4071058abb3ce0935a06df59b6c7c273cb033bc6d6a18b32559a8d4b14da2bfa2b15");
crypto.subtle.importKey("jwk", jwkKey, rsaImportParams, extractable, ["verify"]).then(function(key) {
return crypto.subtle.verify("RSASSA-PKCS1-v1_5", key, signature, text);
}).then(function(result) {
verified = result;
shouldBeTrue("verified");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>