45 lines
1.0 KiB
HTML
45 lines
1.0 KiB
HTML
<!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 importing a JWK HMAC key with SHA-512");
|
|
|
|
jsTestIsAsync = true;
|
|
|
|
var jwkKey = {
|
|
kty: "oct",
|
|
k: "YWJjZGVmZ2gxMjM0NTY3OA",
|
|
alg: "HS512",
|
|
use: "sig",
|
|
key_ops: ["sign", "verify"],
|
|
ext: true,
|
|
};
|
|
var extractable = true;
|
|
|
|
debug("Importing a key...");
|
|
crypto.subtle.importKey("jwk", jwkKey, {name: "hmac", hash: "sha-512"}, extractable, ["sign", "verify"]).then(function(result) {
|
|
key = result;
|
|
|
|
shouldBe("key.type", "'secret'");
|
|
shouldBe("key.extractable", "true");
|
|
shouldBe("key.algorithm.name", "'HMAC'");
|
|
shouldBe("key.algorithm.length", "128");
|
|
shouldBe("key.algorithm.hash.name", "'SHA-512'");
|
|
shouldBe("key.usages", "['sign', 'verify']");
|
|
|
|
finishJSTest();
|
|
});
|
|
|
|
</script>
|
|
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|