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 24 matching lines...) Expand all Loading... |
35 wrappingKey = result; | 35 wrappingKey = result; |
36 return importKeyToWrap(); | 36 return importKeyToWrap(); |
37 }).then(function(result) { | 37 }).then(function(result) { |
38 key = result; | 38 key = result; |
39 | 39 |
40 wrapAlgorithm = {name: 'aes-cbc', iv: new Uint8Array(16)}; | 40 wrapAlgorithm = {name: 'aes-cbc', iv: new Uint8Array(16)}; |
41 | 41 |
42 // Invalid key | 42 // Invalid key |
43 return crypto.subtle.wrapKey('raw', 1, wrappingKey, wrapAlgorithm); | 43 return crypto.subtle.wrapKey('raw', 1, wrappingKey, wrapAlgorithm); |
44 }).then(failAndFinishJSTest, function(result) { | 44 }).then(failAndFinishJSTest, function(result) { |
45 error = result; | 45 logError(result); |
46 shouldBeNull("error"); | |
47 | 46 |
48 // Invalid wrappingKey | 47 // Invalid wrappingKey |
49 return crypto.subtle.wrapKey('raw', key, '', wrapAlgorithm); | 48 return crypto.subtle.wrapKey('raw', key, '', wrapAlgorithm); |
50 }).then(failAndFinishJSTest, function(result) { | 49 }).then(failAndFinishJSTest, function(result) { |
51 error = result; | 50 logError(result); |
52 shouldBeNull("error"); | |
53 | 51 |
54 // Invalid wrapAlgorithm | 52 // Invalid wrapAlgorithm |
55 return crypto.subtle.wrapKey('raw', key, wrappingKey, undefined); | 53 return crypto.subtle.wrapKey('raw', key, wrappingKey, undefined); |
56 }).then(failAndFinishJSTest, function(result) { | 54 }).then(failAndFinishJSTest, function(result) { |
57 error = result; | 55 logError(result); |
58 shouldBeNull("error"); | |
59 | 56 |
60 // Invalid format for wrapKey | 57 // Invalid format for wrapKey |
61 return crypto.subtle.wrapKey('bad-format', key, wrappingKey, wrapAlgorithm); | 58 return crypto.subtle.wrapKey('bad-format', key, wrappingKey, wrapAlgorithm); |
62 }).then(failAndFinishJSTest, function(result) { | 59 }).then(failAndFinishJSTest, function(result) { |
63 error = result; | 60 logError(result); |
64 shouldBeNull("error"); | |
65 | 61 |
66 // SHA-1 isn't a valid wrapKey algorithm. | 62 // SHA-1 isn't a valid wrapKey algorithm. |
67 return crypto.subtle.wrapKey('raw', key, wrappingKey, {name: 'SHA-1'}); | 63 return crypto.subtle.wrapKey('raw', key, wrappingKey, {name: 'SHA-1'}); |
68 }).then(failAndFinishJSTest, function(result) { | 64 }).then(failAndFinishJSTest, function(result) { |
69 error = result; | 65 logError(result); |
70 shouldBeNull("error"); | |
71 | 66 |
72 // Wrap algorithm doesn't match the wrapping key's algorithm (AES-CBC key | 67 // Wrap algorithm doesn't match the wrapping key's algorithm (AES-CBC key |
73 // with AES-CTR wrap algorithm) | 68 // with AES-CTR wrap algorithm) |
74 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0}; | 69 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0}; |
75 return crypto.subtle.wrapKey('raw', key, wrappingKey, aesCtrAlgorithm); | 70 return crypto.subtle.wrapKey('raw', key, wrappingKey, aesCtrAlgorithm); |
76 }).then(failAndFinishJSTest, function(result) { | 71 }).then(failAndFinishJSTest, function(result) { |
77 error = result; | 72 logError(result); |
78 shouldBeNull("error"); | |
79 }).then(finishJSTest, failAndFinishJSTest); | 73 }).then(finishJSTest, failAndFinishJSTest); |
80 | 74 |
81 </script> | 75 </script> |
82 | 76 |
83 </body> | 77 </body> |
84 </html> | 78 </html> |
OLD | NEW |