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 25 matching lines...) Expand all Loading... |
36 error = result; | 36 error = result; |
37 shouldBeNull("error"); | 37 shouldBeNull("error"); |
38 | 38 |
39 // Invalid unwrappingKey | 39 // Invalid unwrappingKey |
40 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, unw
rappedKeyAlgorithm, extractable, keyUsages); | 40 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, unw
rappedKeyAlgorithm, extractable, keyUsages); |
41 }).then(failAndFinishJSTest, function(result) { | 41 }).then(failAndFinishJSTest, function(result) { |
42 error = result; | 42 error = result; |
43 shouldBeNull("error"); | 43 shouldBeNull("error"); |
44 | 44 |
45 // Invalid keyUsages (also, unwrappedKeyAlgorithm is set to null). | 45 // Invalid keyUsages (also, unwrappedKeyAlgorithm is set to null). |
46 shouldThrow("crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorith
m, null, extractable, 9)"); | 46 return crypto.subtle.unwrapKey('raw', wrappedKey, 'hi', unwrapAlgorithm, nul
l, extractable, 9); |
| 47 }).then(failAndFinishJSTest, function(result) { |
| 48 error = result; |
| 49 shouldBeTypeError("error"); |
47 | 50 |
48 // Invalid unwrapAlgorithm | 51 // Invalid unwrapAlgorithm |
49 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, null, unwra
ppedKeyAlgorithm, extractable, keyUsages); | 52 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, null, unwra
ppedKeyAlgorithm, extractable, keyUsages); |
50 }).then(failAndFinishJSTest, function(result) { | 53 }).then(failAndFinishJSTest, function(result) { |
51 error = result; | 54 error = result; |
52 shouldBeNull("error"); | 55 shouldBeNull("error"); |
53 | 56 |
54 // Invalid unwrappedKeyAlgorithm (specified but bad). | 57 // Invalid unwrappedKeyAlgorithm (specified but bad). |
55 shouldThrow("crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, unwra
pAlgorithm, 3, extractable, keyUsages)"); | 58 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, unwrapAlgor
ithm, 3, extractable, keyUsages); |
| 59 }).then(failAndFinishJSTest, function(result) { |
| 60 error = result; |
| 61 shouldBeTypeError("error"); |
56 | 62 |
57 // Invalid format | 63 // Invalid format |
58 return crypto.subtle.unwrapKey('bad-format', wrappedKey, unwrappingKey, unwr
apAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages); | 64 return crypto.subtle.unwrapKey('bad-format', wrappedKey, unwrappingKey, unwr
apAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages); |
59 }).then(failAndFinishJSTest, function(result) { | 65 }).then(failAndFinishJSTest, function(result) { |
60 error = result; | 66 error = result; |
61 shouldBeNull("error"); | 67 shouldBeNull("error"); |
62 | 68 |
63 // SHA-1 isn't a valid unwrapKey algorithm. | 69 // SHA-1 isn't a valid unwrapKey algorithm. |
64 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, {name: 'SHA
-1'}, unwrappedKeyAlgorithm, extractable, keyUsages); | 70 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, {name: 'SHA
-1'}, unwrappedKeyAlgorithm, extractable, keyUsages); |
65 }).then(failAndFinishJSTest, function(result) { | 71 }).then(failAndFinishJSTest, function(result) { |
66 error = result; | 72 error = result; |
67 shouldBeNull("error"); | 73 shouldBeNull("error"); |
68 | 74 |
69 // Mismatch between the unwrappingKey's algorithm and unwrapAlgorithm. | 75 // Mismatch between the unwrappingKey's algorithm and unwrapAlgorithm. |
70 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0}; | 76 aesCtrAlgorithm = {name: 'AES-CTR', counter: new Uint8Array(16), length: 0}; |
71 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, aesCtrAlgor
ithm, unwrappedKeyAlgorithm, extractable, keyUsages); | 77 return crypto.subtle.unwrapKey('raw', wrappedKey, unwrappingKey, aesCtrAlgor
ithm, unwrappedKeyAlgorithm, extractable, keyUsages); |
72 }).then(failAndFinishJSTest, function(result) { | 78 }).then(failAndFinishJSTest, function(result) { |
73 error = result; | 79 error = result; |
74 shouldBeNull("error"); | 80 shouldBeNull("error"); |
75 }).then(finishJSTest, failAndFinishJSTest); | 81 }).then(finishJSTest, failAndFinishJSTest); |
76 | 82 |
77 </script> | 83 </script> |
78 | 84 |
79 </body> | 85 </body> |
80 </html> | 86 </html> |
OLD | NEW |