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 EC private keys"); | 12 description("Tests structured cloning of EC private keys"); |
13 | 13 |
14 jsTestIsAsync = true; | 14 jsTestIsAsync = true; |
15 | 15 |
16 // ECDSA and ECDH support different key usages. Pick either sign or deriveBits d
epending on the algorithm. | 16 // ECDSA and ECDH support different key usages. Pick either sign or deriveBits d
epending on the algorithm. |
17 function signOrDeriveBits(algorithmName) { | 17 function signOrDeriveBits(algorithmName) { |
18 if (algorithmName == "ECDSA") | 18 if (algorithmName == "ECDSA") |
19 return ['sign']; | 19 return ['sign']; |
20 if (algorithmName == "ECDH") | 20 if (algorithmName == "ECDH") |
21 return ['deriveBits']; | 21 return ['deriveBits']; |
22 } | 22 } |
23 | 23 |
24 // Tests the 24 permutations of keys generated by: | 24 // Tests the 12 permutations of keys generated by: |
25 // kPossibleAlgorithms x kPossibleExtractable x kPossibleKeyUsages x kPossible
Curves | 25 // kPossibleAlgorithms x kPossibleExtractable x kPossibleKeyUsages x kPossible
Curves |
26 // | 26 // |
27 // For practical reasons these tests are not exhaustive. | 27 // For practical reasons these tests are not exhaustive. |
28 | 28 |
29 var kPossibleAlgorithms = ['ECDSA', 'ECDH']; | 29 var kPossibleAlgorithms = ['ECDSA', 'ECDH']; |
30 var kPossibleExtractable = [true, false]; | 30 var kPossibleExtractable = [true, false]; |
31 var kPossibleKeyUsages = [[], signOrDeriveBits]; | 31 var kPossibleKeyUsages = [signOrDeriveBits]; |
32 var kPossibleNamedCurves = ['P-256', 'P-384', 'P-521']; | 32 var kPossibleNamedCurves = ['P-256', 'P-384', 'P-521']; |
33 | 33 |
34 // A mapping from curve name, to PKCS8 data (hex-encoded) for a valid private ke
y. | 34 // A mapping from curve name, to PKCS8 data (hex-encoded) for a valid private ke
y. |
35 var kKeyDataForCurve = { | 35 var kKeyDataForCurve = { |
36 "P-256": "308187020100301306072A8648CE3D020106082A8648CE3D030107046D306B0201
0104201FE33950C5F461124AE992C2BDFDF1C73B1615F571BD567E60D19AA1F48CDF42A144034200
047C110C66DCFDA807F6E69E45DDB3C74F69A1484D203E8DC5ADA8E9A9DD7CB3C70DF448986E51BD
E5D1576F99901F9C2C6A806A47FD907643A72B835597EFC8C6", | 36 "P-256": "308187020100301306072A8648CE3D020106082A8648CE3D030107046D306B0201
0104201FE33950C5F461124AE992C2BDFDF1C73B1615F571BD567E60D19AA1F48CDF42A144034200
047C110C66DCFDA807F6E69E45DDB3C74F69A1484D203E8DC5ADA8E9A9DD7CB3C70DF448986E51BD
E5D1576F99901F9C2C6A806A47FD907643A72B835597EFC8C6", |
37 "P-384": "3081B6020100301006072A8648CE3D020106052B8104002204819E30819B020101
0430A492CE8FA90084C227E1A32F7974D39E9FF67A7E8705EC3419B35FB607582BEBD461E0B1520A
C76EC2DD4E9B63EBAE71A16403620004E55FEE6C49D8D523F5CE7BF9C0425CE4FF650708B7DE5CFB
095901523979A7F042602DB30854735369813B5C3F5EF86828F59CC5DC509892A988D38A8E2519DE
3D0C4FD0FBDB0993E38F18506C17606C5E24249246F1CE94983A5361C5BE983E", | 37 "P-384": "3081B6020100301006072A8648CE3D020106052B8104002204819E30819B020101
0430A492CE8FA90084C227E1A32F7974D39E9FF67A7E8705EC3419B35FB607582BEBD461E0B1520A
C76EC2DD4E9B63EBAE71A16403620004E55FEE6C49D8D523F5CE7BF9C0425CE4FF650708B7DE5CFB
095901523979A7F042602DB30854735369813B5C3F5EF86828F59CC5DC509892A988D38A8E2519DE
3D0C4FD0FBDB0993E38F18506C17606C5E24249246F1CE94983A5361C5BE983E", |
38 "P-521": "3081EE020100301006072A8648CE3D020106052B810400230481D63081D3020101
044201BD56BD106118EDA246155BD43B42B8E13F0A6E25DD3BB376026FAB4DC92B6157BC6DFEC2D1
5DD3D0CF2A39AA68494042AF48BA9601118DA82C6F2108A3A203AD74A181890381860004012FBCAE
FFA6A51F3EE4D3D2B51C5DEC6D7C726CA353FC014EA2BF7CFBB9B910D32CBFA6A00FE39B6CDB8946
F22775398B2E233C0CF144D78C8A7742B5C7A3BB5D23009CDEF823DD7BF9A79E8CCEACD2E4527C23
1D0AE5967AF0958E931D7DDCCF2805A3E618DC3039FEC9FEBBD33052FE4C0FEE98F033106064982D
88F4E03549D4A64D" | 38 "P-521": "3081EE020100301006072A8648CE3D020106052B810400230481D63081D3020101
044201BD56BD106118EDA246155BD43B42B8E13F0A6E25DD3BB376026FAB4DC92B6157BC6DFEC2D1
5DD3D0CF2A39AA68494042AF48BA9601118DA82C6F2108A3A203AD74A181890381860004012FBCAE
FFA6A51F3EE4D3D2B51C5DEC6D7C726CA353FC014EA2BF7CFBB9B910D32CBFA6A00FE39B6CDB8946
F22775398B2E233C0CF144D78C8A7742B5C7A3BB5D23009CDEF823DD7BF9A79E8CCEACD2E4527C23
1D0AE5967AF0958E931D7DDCCF2805A3E618DC3039FEC9FEBBD33052FE4C0FEE98F033106064982D
88F4E03549D4A64D" |
39 }; | 39 }; |
40 | 40 |
41 function runTest(algorithmName, namedCurve, extractable, keyUsages) | 41 function runTest(algorithmName, namedCurve, extractable, keyUsages) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 }); | 98 }); |
99 }); | 99 }); |
100 }); | 100 }); |
101 | 101 |
102 lastPromise.then(finishJSTest, failAndFinishJSTest); | 102 lastPromise.then(finishJSTest, failAndFinishJSTest); |
103 | 103 |
104 </script> | 104 </script> |
105 | 105 |
106 </body> | 106 </body> |
107 </html> | 107 </html> |
OLD | NEW |