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 11 matching lines...) Expand all Loading... |
22 extractable = true; | 22 extractable = true; |
23 // Note there are duplicates | 23 // Note there are duplicates |
24 keyUsages = ['encrypt', 'encrypt', 'encrypt', 'sign']; | 24 keyUsages = ['encrypt', 'encrypt', 'encrypt', 'sign']; |
25 | 25 |
26 return crypto.subtle.importKey(keyFormat, data, algorithm, extractable, keyU
sages); | 26 return crypto.subtle.importKey(keyFormat, data, algorithm, extractable, keyU
sages); |
27 }).then(function(result) { | 27 }).then(function(result) { |
28 key = result; | 28 key = result; |
29 shouldBe("key.type", "'secret'") | 29 shouldBe("key.type", "'secret'") |
30 shouldBe("key.extractable", "true") | 30 shouldBe("key.extractable", "true") |
31 shouldBe("key.algorithm.name", "'HMAC'") | 31 shouldBe("key.algorithm.name", "'HMAC'") |
32 shouldBe("key.algorithm.hash.name", "'SHA-256'") | |
33 shouldBe("key.usages.join(',')", "'encrypt,sign'") | 32 shouldBe("key.usages.join(',')", "'encrypt,sign'") |
34 | 33 |
35 // Same test as above, but with an keyUsages, and AES-CBC. | 34 // Same test as above, but with an keyUsages, and AES-CBC. |
36 keyFormat = "raw"; | 35 keyFormat = "raw"; |
37 data = asciiToUint8Array("16 bytes of key!"); | 36 data = asciiToUint8Array("16 bytes of key!"); |
38 algorithm = aesCbc; | 37 algorithm = aesCbc; |
39 extractable = true; | 38 extractable = true; |
40 keyUsages = []; | 39 keyUsages = []; |
41 | 40 |
42 return crypto.subtle.importKey(keyFormat, data, algorithm, extractable, keyU
sages); | 41 return crypto.subtle.importKey(keyFormat, data, algorithm, extractable, keyU
sages); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 shouldRejectPromiseWithNull("crypto.subtle.importKey(keyFormat, data, {name:
'hmac'}, extractable, keyUsages)"); | 112 shouldRejectPromiseWithNull("crypto.subtle.importKey(keyFormat, data, {name:
'hmac'}, extractable, keyUsages)"); |
114 | 113 |
115 // SHA-1 doesn't support the importKey operation. | 114 // SHA-1 doesn't support the importKey operation. |
116 shouldThrow("crypto.subtle.importKey(keyFormat, data, {name: 'sha-1'}, extra
ctable, keyUsages)"); | 115 shouldThrow("crypto.subtle.importKey(keyFormat, data, {name: 'sha-1'}, extra
ctable, keyUsages)"); |
117 }).then(finishJSTest, failAndFinishJSTest); | 116 }).then(finishJSTest, failAndFinishJSTest); |
118 | 117 |
119 </script> | 118 </script> |
120 | 119 |
121 </body> | 120 </body> |
122 </html> | 121 </html> |
OLD | NEW |