| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../resources/js-test.js"></script> | |
| 5 <script src="resources/common.js"></script> | |
| 6 <script src="resources/keys.js"></script> | |
| 7 </head> | |
| 8 <body> | |
| 9 <p id="description"></p> | |
| 10 <div id="console"></div> | |
| 11 | |
| 12 <script> | |
| 13 description("Tests cypto.subtle.exportKey."); | |
| 14 | |
| 15 jsTestIsAsync = true; | |
| 16 | |
| 17 addTask(importTestKeys().then(function(result) { | |
| 18 keys = result; | |
| 19 | |
| 20 // Invalid export formats. | |
| 21 shouldRejectPromiseWithNull("crypto.subtle.exportKey(3, keys.aesCbcJustDecry
pt)"); | |
| 22 shouldRejectPromiseWithNull("crypto.subtle.exportKey(null, keys.aesCbcJustDe
crypt)"); | |
| 23 shouldRejectPromiseWithNull("crypto.subtle.exportKey('invalid', keys.aesCbcJ
ustDecrypt)"); | |
| 24 | |
| 25 // Invalid keys | |
| 26 shouldThrow("crypto.subtle.exportKey('raw', null)"); | |
| 27 shouldThrow("crypto.subtle.exportKey('raw', 3)"); | |
| 28 | |
| 29 shouldBe("keys.aesCbcJustDecrypt.extractable", "false") | |
| 30 shouldRejectPromiseWithNull("crypto.subtle.exportKey('raw', keys.aesCbcJustD
ecrypt)"); | |
| 31 | |
| 32 return crypto.subtle.exportKey('raw', keys.aesCbc); | |
| 33 }).then(function(result) { | |
| 34 bytesShouldMatchHexString("Key bytes", "3136206279746573206f66206b657921", r
esult); | |
| 35 | |
| 36 return crypto.subtle.exportKey('spki', keys.rsaSsaSha1Public); | |
| 37 }).then(function(result) { | |
| 38 bytesShouldMatchHexString("Key bytes", kKeyData.rsa1.spki, result); | |
| 39 })); | |
| 40 | |
| 41 completeTestWhenAllTasksDone(); | |
| 42 | |
| 43 </script> | |
| 44 | |
| 45 </body> | |
| 46 </html> | |
| OLD | NEW |