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 10 matching lines...) Expand all Loading... |
21 var usages = ['encrypt', 'decrypt']; | 21 var usages = ['encrypt', 'decrypt']; |
22 var extractable = false; | 22 var extractable = false; |
23 var algorithm = {name: 'aes-gcm'}; | 23 var algorithm = {name: 'aes-gcm'}; |
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 return crypto.subtle.encrypt({name: 'AES-gcm'}, key, data); | 29 return crypto.subtle.encrypt({name: 'AES-gcm'}, key, data); |
30 }).then(failAndFinishJSTest, function(result) { | 30 }).then(failAndFinishJSTest, function(result) { |
31 error = result; | 31 logError(result); |
32 shouldBeNull("error"); | |
33 | 32 |
34 return crypto.subtle.encrypt({name: 'AES-gcm', iv: 3}, key, data); | 33 return crypto.subtle.encrypt({name: 'AES-gcm', iv: 3}, key, data); |
35 }).then(failAndFinishJSTest, function(result) { | 34 }).then(failAndFinishJSTest, function(result) { |
36 error = result; | 35 logError(result); |
37 shouldBeNull("error"); | |
38 | 36 |
39 return crypto.subtle.encrypt({name: 'AES-gcm', iv: 'foo'}, key, data); | 37 return crypto.subtle.encrypt({name: 'AES-gcm', iv: 'foo'}, key, data); |
40 }).then(failAndFinishJSTest, function(result) { | 38 }).then(failAndFinishJSTest, function(result) { |
41 error = result; | 39 logError(result); |
42 shouldBeNull("error"); | |
43 | 40 |
44 return crypto.subtle.encrypt({name: 'AeS-gcm', iv: new Uint8Array(16), addit
ionalData: '5'}, key, data); | 41 return crypto.subtle.encrypt({name: 'AeS-gcm', iv: new Uint8Array(16), addit
ionalData: '5'}, key, data); |
45 }).then(failAndFinishJSTest, function(result) { | 42 }).then(failAndFinishJSTest, function(result) { |
46 error = result; | 43 logError(result); |
47 shouldBeNull("error"); | |
48 | 44 |
49 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit
ionalData: new Uint8Array(1), tagLength: 'foo'}, key, data); | 45 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit
ionalData: new Uint8Array(1), tagLength: 'foo'}, key, data); |
50 }).then(failAndFinishJSTest, function(result) { | 46 }).then(failAndFinishJSTest, function(result) { |
51 error = result; | 47 logError(result); |
52 shouldBeNull("error"); | |
53 | 48 |
54 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit
ionalData: new Uint8Array(1), tagLength: -1}, key, data); | 49 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit
ionalData: new Uint8Array(1), tagLength: -1}, key, data); |
55 }).then(failAndFinishJSTest, function(result) { | 50 }).then(failAndFinishJSTest, function(result) { |
56 error = result; | 51 logError(result); |
57 shouldBeNull("error"); | |
58 | 52 |
59 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit
ionalData: new Uint8Array(1), tagLength: 8000}, key, data); | 53 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit
ionalData: new Uint8Array(1), tagLength: 8000}, key, data); |
60 }).then(failAndFinishJSTest, function(result) { | 54 }).then(failAndFinishJSTest, function(result) { |
61 error = result; | 55 logError(result); |
62 shouldBeNull("error"); | |
63 }).then(finishJSTest, failAndFinishJSTest); | 56 }).then(finishJSTest, failAndFinishJSTest); |
64 | 57 |
65 </script> | 58 </script> |
66 | 59 |
67 </body> | 60 </body> |
68 </html> | 61 </html> |
OLD | NEW |