blob: 4d883696d690d4236d3fd6493b413c323a522c0e [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 exporting a 128 bits AES-KW key with JWK format");
jsTestIsAsync = true;
var extractable = true;
debug("Generating a key...");
crypto.subtle.generateKey({name: "aes-kw", length: 128}, extractable, ["unwrapKey", "wrapKey"]).then(function(key) {
debug("Exporting a key...");
return crypto.subtle.exportKey("jwk", key);
}).then(function(result) {
key = result;
shouldBe("key.kty", "'oct'");
shouldBe("key.key_ops", "['unwrapKey', 'wrapKey']");
shouldBe("key.alg", "'A128KW'");
shouldBe("key.ext", "true");
shouldBe("Base64URL.parse(key.k).byteLength", "16");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>