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

Xue-Lei Andrew Fan xuelei at openjdk.org
Tue Jul 18 16:29:13 UTC 2023


On Tue, 18 Jul 2023 10:46:52 GMT, Ferenc Rakoczi <duke at openjdk.org> wrote:

>> 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.

I don't have a preference to change the BadPaddingException  to something else.  But if you want it, I may prefer to use checked exception, for example GeneralSecurityException,  so that the compiler could check it.

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

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



More information about the security-dev mailing list