OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src="../../resources/js-test.js"></script> | |
5 <script src="resources/common.js"></script> | |
6 </head> | |
7 <body> | |
8 <p id="description"></p> | |
9 <div id="console"></div> | |
10 | |
11 <script> | |
12 description("Test inputs to HKDF importKey()"); | |
13 | |
14 jsTestIsAsync = true; | |
15 | |
16 var extractable = true; | |
17 raw_bytes = new Uint8Array([1, 2]); | |
eroman
2015/01/07 01:18:44
rawBytes
nharper
2015/01/09 22:41:47
Done.
| |
18 | |
19 var p = Promise.resolve(null); | |
20 p.then(function() { | |
21 debug("\nimportKey() should fail with 'encrypt' usage..."); | |
eroman
2015/01/07 01:18:43
I find these comments more useful when it says wha
nharper
2015/01/09 22:41:47
Done.
| |
22 return crypto.subtle.importKey("raw", raw_bytes, "HKDF", extractable, ['encryp t']); | |
eroman
2015/01/07 01:18:44
indent by 4
nharper
2015/01/09 22:41:47
Done.
| |
23 }).then(failAndFinishJSTest, function(result) { | |
24 logError(result); | |
25 | |
26 debug("\nimportKey() with null key..."); | |
eroman
2015/01/07 01:18:44
null key --> null data (or null key data)
nharper
2015/01/09 22:41:47
Done.
| |
27 return crypto.subtle.importKey("raw", null, "HKDF", extractable, ['deriveKey'] ); | |
28 }).then(failAndFinishJSTest, function(result) { | |
29 logError(result); | |
30 | |
31 debug("\nimportKey() with jwk type..."); | |
eroman
2015/01/07 01:18:44
type --> format
nharper
2015/01/09 22:41:47
Done.
| |
32 return crypto.subtle.importKey("jwk", {kty: "HKDF"}, "HKDF", extractable, ['de riveKey']); | |
33 }).then(failAndFinishJSTest, function(result) { | |
34 logError(result); | |
35 | |
36 debug("\nimportKey() with spki type..."); | |
eroman
2015/01/07 01:18:44
type -> format
nharper
2015/01/09 22:41:47
Done.
| |
37 return crypto.subtle.importKey("spki", raw_bytes, "HKDF", extractable, ['deriv eKey']); | |
38 }).then(failAndFinishJSTest, function(result) { | |
39 logError(result); | |
40 | |
41 debug("\nimportKey() with empty usages..."); | |
42 return crypto.subtle.importKey("raw", raw_bytes, "HKDF", extractable, []); | |
43 }).then(failAndFinishJSTest, function(result) { | |
44 logError(result); | |
45 | |
46 debug("\nimportKey() correctly"); | |
47 return crypto.subtle.importKey("raw", raw_bytes, "HKDF", extractable, ['derive Key']); | |
eroman
2015/01/07 01:18:44
Consider naming this import-failures? (and removin
nharper
2015/01/09 22:41:47
Done.
| |
48 }).then(finishJSTest, failAndFinishJSTest); | |
49 | |
50 </script> | |
51 | |
52 </body> | |
53 </html> | |
OLD | NEW |