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 11 matching lines...) Expand all Loading... |
22 var extractable = false; | 22 var extractable = false; |
23 var algorithm = {name: 'aes-cbc'}; | 23 var algorithm = {name: 'aes-cbc'}; |
24 | 24 |
25 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage
s); | 25 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage
s); |
26 }).then(function(result) { | 26 }).then(function(result) { |
27 key = result; | 27 key = result; |
28 | 28 |
29 // Bad iv | 29 // Bad iv |
30 return crypto.subtle.encrypt({name: 'AES-CBC', iv: null}, key, data); | 30 return crypto.subtle.encrypt({name: 'AES-CBC', iv: null}, key, data); |
31 }).then(failAndFinishJSTest, function(result) { | 31 }).then(failAndFinishJSTest, function(result) { |
32 error = result; | 32 logError(result); |
33 shouldBeNull("error"); | |
34 | 33 |
35 // Missing iv | 34 // Missing iv |
36 return crypto.subtle.decrypt({name: 'AES-CBC'}, key, data); | 35 return crypto.subtle.decrypt({name: 'AES-CBC'}, key, data); |
37 }).then(failAndFinishJSTest, function(result) { | 36 }).then(failAndFinishJSTest, function(result) { |
38 error = result; | 37 logError(result); |
39 shouldBeNull("error"); | |
40 | 38 |
41 // iv is not a buffer | 39 // iv is not a buffer |
42 return crypto.subtle.encrypt({name: 'AES-CBC', iv: 3}, key, data); | 40 return crypto.subtle.encrypt({name: 'AES-CBC', iv: 3}, key, data); |
43 }).then(failAndFinishJSTest, function(result) { | 41 }).then(failAndFinishJSTest, function(result) { |
44 error = result; | 42 logError(result); |
45 shouldBeNull("error"); | |
46 | 43 |
47 // iv is too short | 44 // iv is too short |
48 return crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array(0)}, key,
data); | 45 return crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array(0)}, key,
data); |
49 }).then(failAndFinishJSTest, function(result) { | 46 }).then(failAndFinishJSTest, function(result) { |
50 error = result; | 47 logError(result); |
51 shouldBeNull("error"); | |
52 }).then(finishJSTest, failAndFinishJSTest); | 48 }).then(finishJSTest, failAndFinishJSTest); |
53 | 49 |
54 </script> | 50 </script> |
55 | 51 |
56 </body> | 52 </body> |
57 </html> | 53 </html> |
OLD | NEW |