RFR: 8302017: Allocate BadPaddingException only if it will be thrown [v2]

Ferenc Rakoczi duke at openjdk.org
Tue Jul 18 10:50:21 UTC 2023


On Mon, 17 Jul 2023 23:06:57 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/rsa/RSASignature.java line 233:
>> 
>>> 231:             }
>>> 232:             return status;
>>> 233:         } catch (javax.crypto.BadPaddingException e) {
>> 
>> Can this exception still be thrown?
>
> Yes, BadPaddingException is still thrown by RSACore class.

That exception is thrown by RSACore.parseMsg() if the Message is larger than the modulus. I think it is at least debatable whether it should be a BadPaddingException. I would rather use an IllegalArgumentException there.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14839#discussion_r1266594911


More information about the security-dev mailing list