blob: d6e2fbd91b7b061968c13b278618100611cec179 [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 JWK RSAES-PKCS1-v1_5 public key with leading zero");
jsTestIsAsync = true;
var jwkKey = {
kty: "RSA",
n: "AAAAxAlQI4j-tH2AqgPdl1ZTn4MqndY0zQjYdLVtmo9_-FSC4GaEsnekUWoL9Mt7UrGvIl0oXFKvALzJuXZhOYHjeE-KoVM6BJR8yPe_5qsGwAZeU-PxyJwmQET6s26Awcc0NEynZfgfcf2bm4CS6BzvBVXTzFSTPUu4_3xX4T7nRQfPJwv2SrVgnaIBFxmIFR0n4YIVwTP3bq8GcQK3mI7k9XcbvOxLLplC19IH98BMrWIQfLgEnzR3ZC4PX7Te8AqK459u7bYpLQKTUw81MwSbEdVLNDd1MtitsWbks7t192ogm7sAAVoskbuppLrQyzY-tW3p4Ezgbla41V4Ba9BfCw",
e: "AQAB"
};
var extractable = true;
debug("Importing a key...");
crypto.subtle.importKey("jwk", jwkKey, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]).then(function(result) {
publicKey = result;
shouldBe("publicKey.type", "'public'");
shouldBe("publicKey.extractable", "true");
shouldBe("publicKey.algorithm.name", "'RSAES-PKCS1-v1_5'");
shouldBe("publicKey.algorithm.modulusLength", "2048");
shouldBe("bytesToHexString(publicKey.algorithm.publicExponent)", "'010001'");
shouldBeUndefined("publicKey.algorithm.hash");
shouldBe("publicKey.usages", "['encrypt']");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>