blob: b26dd35a8090e7f250a04022ab1192928eae539a [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/common.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("Test importing a JWK AES-KW key with legnth 256");
jsTestIsAsync = true;
var jwkKey = {
kty: "oct",
k: "YWJjZGVmZ2gxMjM0NTY3OGFiY2RlZmdoMTIzNDU2Nzg",
alg: "A256KW",
};
var extractable = true;
debug("Importing a key...");
crypto.subtle.importKey("jwk", jwkKey, "aes-kw", extractable, ["wrapKey", "unwrapKey"]).then(function(result) {
key = result;
shouldBe("key.type", "'secret'");
shouldBe("key.extractable", "true");
shouldBe("key.algorithm.name", "'AES-KW'");
shouldBe("key.algorithm.length", "256");
shouldBe("key.usages", "['unwrapKey', 'wrapKey']");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>