blob: d27faa50c84f378dc9268916b4cc6b9c00af97ec [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 generating a HMAC key with sha-1.");
jsTestIsAsync = true;
var extractable = true;
debug("\nGenerating a key...");
crypto.subtle.generateKey({name: "hmac", hash: "sha-1"}, 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", "512");
shouldBe("key.algorithm.hash.name", "'SHA-1'");
shouldBe("key.usages", '["sign", "verify"]');
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>