6404fb0830cb4a9e46600e290a06c214d2bcdd5b
[WebKit-https.git] / LayoutTests / crypto / subtle / aes-postMessage.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="../../resources/js-test-pre.js"></script>
6 <script src="resources/common.js"></script>
7 </head>
8 <body>
9 <script>
10
11 description("Test sending crypto keys via postMessage.");
12
13 jsTestIsAsync = true;
14
15 window.addEventListener("message", function(evt) {
16     key = evt.data;
17     shouldBe("key.type", "'secret'");
18     shouldBe("key.extractable", "true");
19     shouldBe("key.algorithm.name", "'AES-CBC'");
20     shouldBe("key.algorithm.length", "128");
21     shouldBe("key.usages", '["encrypt", "decrypt", "sign", "verify"]');
22
23     finishJSTest();
24 }, false);
25
26 importTestKeys().then(function(keys) {
27     postMessage(keys.aesCbc, "*");
28 });
29 </script>
30 <script src="../../resources/js-test-post.js"></script>
31 </body>
32 </html>