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 structured cloning of HMAC keys"); | 12 description("Tests structured cloning of HMAC keys"); |
13 | 13 |
14 jsTestIsAsync = true; | 14 jsTestIsAsync = true; |
15 | 15 |
16 // Tests the 48 permutations of keys generated by: | 16 // Tests the 48 permutations of keys generated by: |
17 // kPossibleHashAlgorithms x kPossibleExtractable x kPossibleKeyUsages x kPoss
ibleKeyData | 17 // kPossibleHashAlgorithms x kPossibleExtractable x kPossibleKeyUsages x kPoss
ibleKeyData |
18 // | 18 // |
19 // For practical reasons these tests are not exhaustive. | 19 // For practical reasons these tests are not exhaustive. |
20 | 20 |
21 var k128BitData = "30112233445566778899aabbccddeeff" | 21 var k128BitData = "30112233445566778899aabbccddeeff" |
22 var k256BitData = "00112233445546778899aabbccddeeff000102030405060708090a0b0c0d0
e0f"; | 22 var k256BitData = "00112233445546778899aabbccddeeff000102030405060708090a0b0c0d0
e0f"; |
23 | 23 |
24 var kPossibleHashAlgorithms = ['SHA-1', 'SHA-256', 'SHA-512']; | 24 var kPossibleHashAlgorithms = ['SHA-1', 'SHA-256', 'SHA-512']; |
25 var kPossibleExtractable = [true, false]; | 25 var kPossibleExtractable = [true, false]; |
26 var kPossibleKeyUsages = [[], ['sign'], ['verify'], ['sign', 'verify']]; | 26 var kPossibleKeyUsages = [['sign'], ['verify'], ['sign', 'verify']]; |
27 var kPossibleKeyData = [ | 27 var kPossibleKeyData = [ |
28 k128BitData, | 28 k128BitData, |
29 k256BitData | 29 k256BitData |
30 ]; | 30 ]; |
31 | 31 |
32 function runTest(hashName, extractable, keyUsages, keyData) | 32 function runTest(hashName, extractable, keyUsages, keyData) |
33 { | 33 { |
34 var importData = hexStringToUint8Array(keyData); | 34 var importData = hexStringToUint8Array(keyData); |
35 var importAlgorithm = { name: 'HMAC', hash: {name: hashName } }; | 35 var importAlgorithm = { name: 'HMAC', hash: {name: hashName } }; |
36 | 36 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 }); | 87 }); |
88 }); | 88 }); |
89 }); | 89 }); |
90 | 90 |
91 lastPromise.then(finishJSTest, failAndFinishJSTest); | 91 lastPromise.then(finishJSTest, failAndFinishJSTest); |
92 | 92 |
93 </script> | 93 </script> |
94 | 94 |
95 </body> | 95 </body> |
96 </html> | 96 </html> |
OLD | NEW |