48 lines
1.5 KiB
HTML
48 lines
1.5 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 importing a JWK RSA-OAEP public key with SHA-1 and then export it in JWK format");
|
|
|
|
jsTestIsAsync = true;
|
|
|
|
var jwkKey = {
|
|
kty: "RSA",
|
|
alg: "RSA-OAEP",
|
|
key_ops: ["encrypt", "wrapKey"],
|
|
ext: true,
|
|
n: "p55Xl-DyqKL06TE8GCuXd_e-ruTqVB19iDH6DwTIknTyM0fl8EY6qsyOBNTxjpLDsOldEJ8QblG78WY7xYTZtNn-fimz5eG80bwSZ6FUO10z3ikeKzPPC7K4AA196rMoiEu2G4mSfqeg5zz6_iqHf8u_md_n8yk_iPaXJ9RVT-W4zEQQ6WSlsOtYa7blSSAlq0JYDJciNeE0RGqUU-UjcxUWIEnT2ODHGRzSfKHgc8O3fGt4dpVm0op1yItBcSAY-0_f1p_YrVDo8bsyq2uodyDGYhcuQgYJ0NjMgT_rb8rUPpR3bUitd-IZJd_NO9i_NmvbnQfgl6kfnxe_2kM4Tw",
|
|
e: "AQAB"
|
|
};
|
|
var extractable = true;
|
|
|
|
debug("Importing a key...");
|
|
crypto.subtle.importKey("jwk", jwkKey, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"]).then(function(cryptoKey) {
|
|
debug("Exporting a key...");
|
|
return crypto.subtle.exportKey("jwk", cryptoKey);
|
|
}).then(function(result) {
|
|
exportedJwkKey = result;
|
|
|
|
shouldBe("exportedJwkKey.kty", "jwkKey.kty");
|
|
shouldBe("exportedJwkKey.alg", "jwkKey.alg");
|
|
shouldBe("exportedJwkKey.key_ops", "jwkKey.key_ops");
|
|
shouldBe("exportedJwkKey.ext", "jwkKey.ext");
|
|
shouldBe("exportedJwkKey.n", "jwkKey.n");
|
|
shouldBe("exportedJwkKey.e", "jwkKey.e");
|
|
|
|
finishJSTest();
|
|
});
|
|
|
|
</script>
|
|
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|