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 |
11 <script> | 11 <script> |
12 description("Tests generateKey() with bad AES-KW parameters."); | 12 description("Tests generateKey() with bad AES-KW parameters."); |
13 jsTestIsAsync = true; | 13 jsTestIsAsync = true; |
14 | 14 |
15 extractable = true; | 15 extractable = true; |
16 keyUsages = ['wrapKey', 'unwrapKey']; | 16 keyUsages = ['wrapKey', 'unwrapKey']; |
17 | 17 |
18 Promise.resolve(null).then(function() { | 18 Promise.resolve(null).then(function() { |
| 19 debug("\ngenerateKey() without length..."); |
19 return crypto.subtle.generateKey({ name: 'aes-kw' }, extractable, keyUsages)
; | 20 return crypto.subtle.generateKey({ name: 'aes-kw' }, extractable, keyUsages)
; |
20 }).then(failAndFinishJSTest, function(result) { | 21 }).then(failAndFinishJSTest, function(result) { |
21 logError(result); | 22 logError(result); |
22 | 23 |
| 24 debug("\ngenerateKey() with a length of 70000..."); |
23 return crypto.subtle.generateKey({ name: 'aes-kw', length: 70000 }, extracta
ble, keyUsages); | 25 return crypto.subtle.generateKey({ name: 'aes-kw', length: 70000 }, extracta
ble, keyUsages); |
24 }).then(failAndFinishJSTest, function(result) { | 26 }).then(failAndFinishJSTest, function(result) { |
25 logError(result); | 27 logError(result); |
26 | 28 |
| 29 debug("\ngenerateKey() with a length of -3..."); |
27 return crypto.subtle.generateKey({ name: 'aes-kw', length: -3 }, extractable
, keyUsages); | 30 return crypto.subtle.generateKey({ name: 'aes-kw', length: -3 }, extractable
, keyUsages); |
28 }).then(failAndFinishJSTest, function(result) { | 31 }).then(failAndFinishJSTest, function(result) { |
29 logError(result); | 32 logError(result); |
30 | 33 |
| 34 debug("\ngenerateKey() with length that is minus Infinity..."); |
31 return crypto.subtle.generateKey({ name: 'aes-kw', length: -Infinity }, extr
actable, keyUsages); | 35 return crypto.subtle.generateKey({ name: 'aes-kw', length: -Infinity }, extr
actable, keyUsages); |
32 }).then(failAndFinishJSTest, function(result) { | 36 }).then(failAndFinishJSTest, function(result) { |
33 logError(result); | 37 logError(result); |
34 }).then(finishJSTest, failAndFinishJSTest); | 38 }).then(finishJSTest, failAndFinishJSTest); |
35 | 39 |
36 </script> | 40 </script> |
37 | 41 |
38 </body> | 42 </body> |
39 </html> | 43 </html> |
OLD | NEW |