| <!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: "AGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdoYWJjZGVmZ2g", |
| 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> |