blob: 477da386280c3c7eb2d0a6bcb2e4a7edd911ed6e [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 exporting a RSAES-PKCS1-v1_5 private key with PKCS8 format.");
jsTestIsAsync = true;
var algorithmKeyGen = {
name: "RSAES-PKCS1-v1_5",
// RsaKeyGenParams
modulusLength: 2048,
publicExponent: new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
};
var extractable = true;
var keyPair;
debug("Generating a key pair...");
crypto.subtle.generateKey(algorithmKeyGen, extractable, ["decrypt", "encrypt"]).then(function(result) {
keyPair = result;
debug("Exporting the private key...");
return crypto.subtle.exportKey("pkcs8", keyPair.privateKey);
}).then(function(result) {
privateKey = result;
shouldBeType("privateKey", "ArrayBuffer");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>