blob: 87551bdebb75b91c096ec531eceec816ded69173 [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-224 using an imported key");
jsTestIsAsync = true;
var extractable = false;
var text = asciiToUint8Array("Hello, World!");
var rsaImportParams = {
name: "RSASSA-PKCS1-v1_5",
hash: "SHA-224",
}
var jwkKey = {
kty: "RSA",
alg: "RS224",
use: "sig",
key_ops: ["verify"],
ext: true,
n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
e: "AQAB",
};
var signature = hexStringToUint8Array("3cb10634bbb4022b64e0af31d0c0533837e14c8a9a4d7b9ef8c6816133843ef58603887fb05f7215bf39e803326367d95ea8894dda321b753a62dcc3214c7e85a134bf741c883f1ee0037dde6334d62b8efe54dcb59c8510e4d733b35466ad5a064686616898d73e25138cc6fd572d52df5e80f70d3d803ae9100516b4bde58cafc068c655f0cdbd2249ae61eb1a952d49df493b3c3c4a15ffb900d4f489df797498a0e7333c58cb953c2f3b169290ae7dd51e3c53bdb0bdf4311ae3fd5d7a1c3de038f696c05190db1c60056f664c6421580385b9fe54e1b2f41eef9eb83d18c6d28745d9c0eb2c15b45f5949b78762558488ae09877f4305f8c9068576e6e5");
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>