4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../resources/common.js"></script>
8 <p id=
"description"></p>
9 <div id=
"console"></div>
12 description("Test inputs to HKDF importKey()");
16 var extractable
= true;
17 rawBytes
= new Uint8Array([1, 2]);
19 var p
= Promise
.resolve(null);
21 debug("\nimportKey() with 'encrypt' usage...");
22 return crypto
.subtle
.importKey("raw", rawBytes
, "HKDF", extractable
, ['encrypt']);
23 }).then(failAndFinishJSTest
, function(result
) {
26 debug("\nimportKey() with null key data...");
27 return crypto
.subtle
.importKey("raw", null, "HKDF", extractable
, ['deriveKey']);
28 }).then(failAndFinishJSTest
, function(result
) {
31 debug("\nimportKey() with jwk format...");
32 return crypto
.subtle
.importKey("jwk", {kty
: "HKDF"}, "HKDF", extractable
, ['deriveKey']);
33 }).then(failAndFinishJSTest
, function(result
) {
36 debug("\nimportKey() with spki format...");
37 return crypto
.subtle
.importKey("spki", rawBytes
, "HKDF", extractable
, ['deriveKey']);
38 }).then(failAndFinishJSTest
, function(result
) {
41 debug("\nimportKey() with empty usages...");
42 return crypto
.subtle
.importKey("raw", rawBytes
, "HKDF", extractable
, []);
43 }).then(failAndFinishJSTest
, function(result
) {
45 }).then(finishJSTest
, failAndFinishJSTest
);