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("Test unwrapping an HKDF key"); | 12 description("Test unwrapping an HKDF key"); |
13 | 13 |
14 jsTestIsAsync = true; | 14 jsTestIsAsync = true; |
15 | 15 |
16 kHkdfKey = hexStringToUint8Array("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b")
; | 16 kHkdfKey = hexStringToUint8Array("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b")
; |
17 kIv = new Uint8Array(16); | 17 kIv = new Uint8Array(16); |
18 | 18 |
19 var extractable = true; | |
20 var derivingKeyAlgorithm = { | 19 var derivingKeyAlgorithm = { |
21 name: "HKDF", | 20 name: "HKDF", |
22 hash: "SHA-256", | 21 hash: "SHA-256", |
23 salt: new Uint8Array(), | 22 salt: new Uint8Array(), |
24 info: new Uint8Array() | 23 info: new Uint8Array() |
25 }; | 24 }; |
26 | 25 |
27 Promise.resolve(null).then(function(result) { | 26 Promise.resolve(null).then(function(result) { |
28 // Create a key to use for wrapping/unwrapping | 27 // Create a key to use for wrapping/unwrapping |
29 return crypto.subtle.generateKey({name: "AES-GCM", length: 256}, false, ['en
crypt', 'unwrapKey']); | 28 return crypto.subtle.generateKey({name: "AES-GCM", length: 256}, false, ['en
crypt', 'unwrapKey']); |
(...skipping 22 matching lines...) Expand all Loading... |
52 debug("\nUnwrap an HKDF key using pkcs8 as the format."); | 51 debug("\nUnwrap an HKDF key using pkcs8 as the format."); |
53 return crypto.subtle.unwrapKey("pkcs8", wrappedKey, wrappingKey, {name: "AES
-GCM", length: 256, iv: kIv}, "HKDF", false, ['deriveBits']); | 52 return crypto.subtle.unwrapKey("pkcs8", wrappedKey, wrappingKey, {name: "AES
-GCM", length: 256, iv: kIv}, "HKDF", false, ['deriveBits']); |
54 }).then(failAndFinishJSTest, function(result) { | 53 }).then(failAndFinishJSTest, function(result) { |
55 logError(result); | 54 logError(result); |
56 }).then(finishJSTest, failAndFinishJSTest); | 55 }).then(finishJSTest, failAndFinishJSTest); |
57 | 56 |
58 </script> | 57 </script> |
59 | 58 |
60 </body> | 59 </body> |
61 </html> | 60 </html> |
OLD | NEW |