OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
5 <script src="resources/common.js"></script> | 5 <script src="resources/common.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <p id="description"></p> | 8 <p id="description"></p> |
9 <div id="console"></div> | 9 <div id="console"></div> |
10 | 10 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC'}, keys.aesCbc, data)"); | 205 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC'}, keys.aesCbc, data)"); |
206 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: 3}, keys.aesCbc, da
ta)"); | 206 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: 3}, keys.aesCbc, da
ta)"); |
207 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array[0]},
keys.aesCbc, data)"); | 207 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array[0]},
keys.aesCbc, data)"); |
208 | 208 |
209 // --------------------------------------------------- | 209 // --------------------------------------------------- |
210 // AES-CTR normalization failures (AesCtrParams) | 210 // AES-CTR normalization failures (AesCtrParams) |
211 // --------------------------------------------------- | 211 // --------------------------------------------------- |
212 | 212 |
213 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: null}, keys.ae
sCtr, data)"); | 213 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: null}, keys.ae
sCtr, data)"); |
214 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR'}, keys.aesCtr, data)"); | 214 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR'}, keys.aesCtr, data)"); |
215 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
[0]}, keys.aesCtr, data)"); | 215 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
(0)}, keys.aesCtr, data)"); |
216 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
[16]}, keys.aesCtr, data)"); | 216 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
(16), length: 0}, keys.aesCtr, data)"); |
217 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
[16]}, keys.aesCtr, data)"); | 217 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
(16), length: 18}, keys.aesCtr, data)"); |
218 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
[16], length: 0}, keys.aesCtr, data)"); | 218 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
(16), length: 256}, keys.aesCtr, data)"); |
219 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
[16], length: 18}, keys.aesCtr, data)"); | 219 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
(16), length: -3}, keys.aesCtr, data)"); |
220 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
[16], length: -3}, keys.aesCtr, data)"); | 220 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
(16), length: Infinity}, keys.aesCtr, data)"); |
221 shouldThrow("crypto.subtle.encrypt({name: 'AES-CTR', counter: new Uint8Array
[16], length: Infinity}, keys.aesCtr, data)"); | |
222 | 221 |
223 // Try calling with the wrong key type. | 222 // Try calling with the wrong key type. |
224 aesCbc = {name: 'AES-CBC', iv: new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15])}; | 223 aesCbc = {name: 'AES-CBC', iv: new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15])}; |
225 shouldThrow("crypto.subtle.encrypt(aesCbc, keys.hmacSha1, data)"); | 224 shouldThrow("crypto.subtle.encrypt(aesCbc, keys.hmacSha1, data)"); |
226 | 225 |
227 // Key doesn't support encrypt. | 226 // Key doesn't support encrypt. |
228 shouldThrow("crypto.subtle.encrypt(aesCbc, keys.aesCbcJustDecrypt, data)"); | 227 shouldThrow("crypto.subtle.encrypt(aesCbc, keys.aesCbcJustDecrypt, data)"); |
229 | 228 |
230 // If no key was specified AND the algorithm was bogus, should complain | 229 // If no key was specified AND the algorithm was bogus, should complain |
231 // about the missing key first. | 230 // about the missing key first. |
232 shouldThrow("crypto.subtle.encrypt({name: 'bogus'}, null, data)"); | 231 shouldThrow("crypto.subtle.encrypt({name: 'bogus'}, null, data)"); |
233 } | 232 } |
234 | 233 |
235 allTests.push(importTestKeys().then(testNormalizationFailures)); | 234 allTests.push(importTestKeys().then(testNormalizationFailures)); |
236 | 235 |
237 // ------------------------------------------------- | 236 // ------------------------------------------------- |
238 // Wait until all the tests have been run. | 237 // Wait until all the tests have been run. |
239 // ------------------------------------------------- | 238 // ------------------------------------------------- |
240 | 239 |
241 Promise.all(allTests).then(finishJSTest, failAndFinishJSTest); | 240 Promise.all(allTests).then(finishJSTest, failAndFinishJSTest); |
242 | 241 |
243 </script> | 242 </script> |
244 | 243 |
245 </body> | 244 </body> |
OLD | NEW |