Truly independent web browser
<!doctype html>
<script src="../include.js"></script>
<script>
promiseTest(async () => {
const algorithm = { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" };
const { privateKey } = await crypto.subtle.generateKey(
{ ...algorithm, modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]) },
true,
["sign", "verify"]
);
const { kty, n, e, d } = await crypto.subtle.exportKey("jwk", privateKey);
const key = await crypto.subtle.importKey("jwk", { kty, n, e, d }, algorithm, true, ["sign"]);
try {
await crypto.subtle.exportKey("pkcs8", key);
println("pkcs8: exported");
} catch (e) {
println(`pkcs8: ${e.name}`);
}
});
</script>