OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../fast/js/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("Tests cypto.subtle.exportKey."); |
| 13 |
| 14 jsTestIsAsync = true; |
| 15 |
| 16 importTestKeys().then(function(result) { |
| 17 keys = result; |
| 18 |
| 19 // Invalid export formats. |
| 20 shouldThrow("crypto.subtle.exportKey(3, keys.aesCbcJustDecrypt)"); |
| 21 shouldThrow("crypto.subtle.exportKey(null, keys.aesCbcJustDecrypt)"); |
| 22 shouldThrow("crypto.subtle.exportKey('invalid', keys.aesCbcJustDecrypt)"); |
| 23 |
| 24 // Invalid keys |
| 25 shouldThrow("crypto.subtle.exportKey('raw', null)"); |
| 26 shouldThrow("crypto.subtle.exportKey('raw', 3)"); |
| 27 |
| 28 shouldBe("keys.aesCbcJustDecrypt.extractable", "false") |
| 29 shouldThrow("crypto.subtle.exportKey('raw', keys.aesCbcJustDecrypt)"); |
| 30 |
| 31 return crypto.subtle.exportKey('raw', keys.hmacSha1); |
| 32 }).then(function(result) { |
| 33 keyData = result; |
| 34 shouldBe("keyData.byteLength", "3"); |
| 35 |
| 36 return crypto.subtle.exportKey('pkcs8', keys.hmacSha1); |
| 37 }).then(function(result) { |
| 38 keyData = result; |
| 39 shouldBe("keyData.byteLength", "5"); |
| 40 }).then(finishJSTest, failAndFinishJSTest); |
| 41 |
| 42 </script> |
| 43 |
| 44 <script src="../fast/js/resources/js-test-post.js"></script> |
| 45 </body> |
| 46 </html> |
OLD | NEW |