jiewen_tan@apple.com | fd1f4ea | 2017-04-06 18:56:33 +0000 | [diff] [blame] | 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 exporting a 256 bits AES-CTR key with raw format"); |
| 13 | |
| 14 | jsTestIsAsync = true; |
| 15 | |
| 16 | var extractable = true; |
| 17 | |
| 18 | debug("Generating a key..."); |
| 19 | crypto.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> |