blob: a1dc58506f5dd2a8e7eb92f049697057705dba97 [file] [log] [blame]
jiewen_tan@apple.comfd1f4ea2017-04-06 18:56:33 +00001<!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>
12description("Test exporting a 256 bits AES-CTR key with raw format");
13
14jsTestIsAsync = true;
15
16var extractable = true;
17
18debug("Generating a key...");
19crypto.subtle.generateKey({name: "aes-ctr", length: 256}, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(key) {
20 debug("Exporting a key...");
21 return crypto.subtle.exportKey("raw", key);
22}).then(function(result) {
23 key = result;
24
25 shouldBe("key.byteLength", "32");
26
27 finishJSTest();
28});
29</script>
30
31<script src="../../resources/js-test-post.js"></script>
32</body>
33</html>