PeculiarVentures/webcrypto

No support for modulusLength 3072 bit

danhnn opened this issue · 3 comments

Currently, we want to use 3072-bit for RSA key's modulusLength but as I checked the current source code:

throw new TypeError("modulusLength: Must be 1024, 2048, or 4096");

We only support 1024, 2048, and 4096 modulusLength. Could I ask that why we don't support 3072-bit value here?

@danhnn Thank you for pointing to this.

Chrome

image

We should update the module

@danhnn I've fixed and published @peculiar/webcrypto@1.2.3.

const alg = {
  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"]);

Please try it

Thanks, @microshine!