blob: 15c6298614d1d22e1570fea85802672d32bf28f4 [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 256 bits AES-CFB key with JWK format");
jsTestIsAsync = true;
var extractable = true;
debug("Generating a key...");
crypto.subtle.generateKey({name: "aes-cfb-8", length: 256}, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).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", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
shouldBe("key.alg", "'A256CFB8'");
shouldBe("key.ext", "true");
shouldBe("Base64URL.parse(key.k).byteLength", "32");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>