From a8a6d064611ed2cf605e81da096cad44036aaf64 Mon Sep 17 00:00:00 2001 From: microshine Date: Wed, 24 Nov 2021 12:17:47 +0300 Subject: [PATCH] test: Add RSA 3072bits test --- test/crypto.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/crypto.ts b/test/crypto.ts index 93b1280..69cde13 100644 --- a/test/crypto.ts +++ b/test/crypto.ts @@ -75,6 +75,18 @@ context("Crypto", () => { context("generateKey", () => { + it("RSA 3072bits", async () => { + const alg: globalThis.RsaHashedKeyGenParams = { + name: "RSASSA-PKCS1-v1_5", + hash: "SHA-256", + publicExponent: new Uint8Array([1,0,1]), + modulusLength: 3072, + }; + const keys = await crypto.subtle.generateKey(alg, false, ["sign", "verify"]); + + assert.strictEqual((keys.privateKey.algorithm as RsaHashedKeyAlgorithm).modulusLength, 3072); + }); + it("Ed25519", async () => { const keys = await crypto.subtle.generateKey({ name: "eddsa", namedCurve: "ed25519" } as globalThis.EcKeyGenParams, false, ["sign", "verify"]);