aes-postMessage.html 768 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../resources/js-test-pre.js"></script>
<script src="resources/common.js"></script>
</head>
<body>
<script>

description("Test sending crypto keys via postMessage.");

jsTestIsAsync = true;

window.addEventListener("message", function(evt) {
    key = evt.data;
    shouldBe("key.type", "'secret'");
    shouldBe("key.extractable", "true");
19
    shouldBe("key.algorithm.name", "'AES-CBC'");
20
    shouldBe("key.algorithm.length", "128");
21
    shouldBe("key.usages", '["decrypt", "encrypt", "sign", "verify"]');
22 23 24 25 26 27 28 29 30 31 32

    finishJSTest();
}, false);

importTestKeys().then(function(keys) {
    postMessage(keys.aesCbc, "*");
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>