test: Add RSA 3072bits test

This commit is contained in:
microshine 2021-11-24 12:17:47 +03:00
parent 40b1911433
commit a8a6d06461
1 changed files with 12 additions and 0 deletions

View File

@ -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"]);