35 lines
906 B
HTML
35 lines
906 B
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 importing a raw AES-CBC key with legnth 128 and then export it in JWK 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("jwk", cryptoKey);
|
|
}).then(function(result) {
|
|
exportedJwkKey = result;
|
|
|
|
shouldBe("Base64URL.parse(exportedJwkKey.k)", "rawKey");
|
|
|
|
finishJSTest();
|
|
});
|
|
|
|
</script>
|
|
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html> |