blob: d71e23b0e6b6aac2d1d8c31a7865dbbf6acc1581 [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 raw AES-CBC key with legnth 128 and then export it in raw format");
jsTestIsAsync = true;
var rawKey = hexStringToUint8Array("909152300357f94c2f64321c2d395370");
var extractable = true;
debug("Importing a key...");
crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(cryptoKey) {
debug("Exporting a key...");
return crypto.subtle.exportKey("raw", cryptoKey);
}).then(function(result) {
exportedRawKey = new Uint8Array(result);
shouldBe("exportedRawKey", "rawKey");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>