RS256: Generated RSA Keys(2048bit) have sometimes 2047 modulus length #493
-
When verifying JWT tokens (compactVerify) that have been signed with an 2048bit RSA key, key length check fails stating that the modulus length is 2047. In other frameworks I have noticed that they go down the route of allowing 2047bit length RSA keys to mitigate such errors. Is it be possible change the value in Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The key is either 2048 and above or it isnt, and the private key's modulus is the same as the public key's modulus, so their lengths are always the same :) This check is entirely intentional and per the JWA specification. Please share more details if you can. |
Beta Was this translation helpful? Give feedback.
-
Yes, I mixed key length and modulus length. I think what happens is described here: https://randomoracle.wordpress.com/2019/12/04/off-by-one-the-curious-case-of-2047-bit-rsa-keys/ Thanks in advance. |
Beta Was this translation helpful? Give feedback.
The key is either 2048 and above or it isnt, and the private key's modulus is the same as the public key's modulus, so their lengths are always the same :)
This check is entirely intentional and per the JWA specification.
Please share more details if you can.