OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../fast/js/resources/js-test-pre.js"></script> | 4 <script src="../fast/js/resources/js-test-pre.js"></script> |
| 5 <script src="resources/common.js"></script> |
5 </head> | 6 </head> |
6 <body> | 7 <body> |
7 <p id="description"></p> | 8 <p id="description"></p> |
8 <div id="console"></div> | 9 <div id="console"></div> |
9 | 10 |
10 <script> | 11 <script> |
11 description("Tests algorithm normalization."); | 12 description("Tests algorithm normalization."); |
12 | 13 |
13 jsTestIsAsync = true; | 14 jsTestIsAsync = true; |
14 | 15 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 function importAesCbcKey(keyUsages) | 161 function importAesCbcKey(keyUsages) |
161 { | 162 { |
162 var keyFormat = "spki"; | 163 var keyFormat = "spki"; |
163 var data = new Uint8Array([]); | 164 var data = new Uint8Array([]); |
164 var algorithm = {name: "aes-cbc"}; | 165 var algorithm = {name: "aes-cbc"}; |
165 var extractable = false; | 166 var extractable = false; |
166 | 167 |
167 return crypto.subtle.importKey(keyFormat, data, algorithm, extractable, keyU
sages); | 168 return crypto.subtle.importKey(keyFormat, data, algorithm, extractable, keyU
sages); |
168 } | 169 } |
169 | 170 |
170 function importHmacSha1Key() | |
171 { | |
172 var keyFormat = "spki"; | |
173 var data = new Uint8Array([]); | |
174 var algorithm = {name: 'hmac', hash: {name: 'sha-1'}}; | |
175 var extractable = false; | |
176 var keyUsages = ['encrypt', 'decrypt', 'sign', 'verify']; | |
177 | |
178 return crypto.subtle.importKey(keyFormat, data, algorithm, extractable, keyU
sages); | |
179 } | |
180 | |
181 function failedKeyImport(value) | 171 function failedKeyImport(value) |
182 { | 172 { |
183 debug("Failed importing key: " + value); | 173 debug("Failed importing key: " + value); |
184 finishJSTest(); | 174 finishJSTest(); |
185 } | 175 } |
186 | 176 |
187 // Import two keys before starting the tests: one for AES-CBC, and one for | 177 // Import two keys before starting the tests: one for AES-CBC, and one for |
188 // HMAC SHA1. | 178 // HMAC SHA1. |
189 Promise.every(importAesCbcKey(['encrypt', 'decrypt', 'sign', 'verify']), importA
esCbcKey(['decrypt', 'sign', 'verify']), importHmacSha1Key()).then(function(keys
) | 179 Promise.every(importAesCbcKey(['encrypt', 'decrypt', 'sign', 'verify']), importA
esCbcKey(['decrypt', 'sign', 'verify']), importHmacSha1Key()).then(function(keys
) |
190 { | 180 { |
191 aesCbcKey = keys[0]; | 181 aesCbcKey = keys[0]; |
192 aesCbcKeyNoEncrypt = keys[1]; | 182 aesCbcKeyNoEncrypt = keys[1]; |
193 hmacSha1Key = keys[2]; | 183 hmacSha1Key = keys[2]; |
194 | 184 |
195 runTests(); | 185 runTests(); |
196 finishJSTest(); | 186 finishJSTest(); |
197 | 187 |
198 }, failedKeyImport); | 188 }, failedKeyImport); |
199 | 189 |
200 </script> | 190 </script> |
201 | 191 |
202 <script src="../fast/js/resources/js-test-post.js"></script> | 192 <script src="../fast/js/resources/js-test-post.js"></script> |
203 </body> | 193 </body> |
204 </html> | 194 </html> |
OLD | NEW |