Update SubtleCrypto::generateKey to match the latest spec
[WebKit-https.git] / LayoutTests / crypto / subtle / hmac-generate-key-sha512.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test-pre.js"></script>
5 <script src="../resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10
11 <script>
12 description("Test generating a HMAC key with sha-512.");
13
14 jsTestIsAsync = true;
15
16 var extractable = true;
17
18 debug("\nGenerating a key...");
19 crypto.subtle.generateKey({name: "hmac", hash: "sha-512"}, extractable, ["sign", "verify"]).then(function(result) {
20     key = result;
21
22     shouldBe("key.type", "'secret'");
23     shouldBe("key.extractable", "true");
24     shouldBe("key.algorithm.name", "'HMAC'");
25     shouldBe("key.algorithm.length", "1024");
26     shouldBe("key.algorithm.hash.name", "'SHA-512'");
27     shouldBe("key.usages", '["sign", "verify"]');
28
29     finishJSTest();
30 });
31 </script>
32
33 <script src="../../resources/js-test-post.js"></script>
34 </body>
35 </html>