43 lines
1.2 KiB
HTML
43 lines
1.2 KiB
HTML
<!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 wrapping a JWK key with AES-CFB using an imported key");
|
|
|
|
jsTestIsAsync = true;
|
|
|
|
var extractable = true;
|
|
var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
|
|
var aesCfbParams = {
|
|
name: "aes-cfb-8",
|
|
iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
|
|
}
|
|
var expectWrappedKey = "96a17ede3414d990741d2fe5f1d93e74999ed6ca6071db6dc0cf0bcf9178b1ac037076d18ffe0e247ee570c2d551bc7621b0d791df9c7bc7c021ea1fda83e4c41d8704112777a86413dd7b20088479a615b83942d3903ef08f81f4";
|
|
|
|
crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["wrapKey"]).then(function(result) {
|
|
wrappingKey = result;
|
|
return crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt"]);
|
|
}).then(function(result) {
|
|
key = result;
|
|
return crypto.subtle.wrapKey("jwk", key, wrappingKey, aesCfbParams);
|
|
}).then(function(result) {
|
|
wrappedKey = result;
|
|
|
|
shouldBe("bytesToHexString(wrappedKey)", "expectWrappedKey");
|
|
|
|
finishJSTest();
|
|
});
|
|
|
|
</script>
|
|
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|