RFR: 6227536: KeyGenerator.init() methods do not throw IllegalArgumentException for keysize == 0

Mark Powers duke at openjdk.org
Thu Jul 28 19:07:45 UTC 2022


On Thu, 28 Jul 2022 17:32:57 GMT, Kevin Driver <kdriver at openjdk.org> wrote:

> As mentioned in the bug report, this issue *should not* be a framework-level issue, since potentially an individual provider could create a keysize of zero to have a certain significance. 
> 
> In the changes made here, the check is for `keysize <= 0` and this message indicates this is a check characteristic to the `SunJCE` provider.

src/java.base/share/classes/com/sun/crypto/provider/HmacMD5KeyGenerator.java line 92:

> 90:     protected void engineInit(int keysize, SecureRandom random) {
> 91: 
> 92:         if(keysize <= 0) {

Add space after` if`.

src/java.base/share/classes/com/sun/crypto/provider/HmacSHA1KeyGenerator.java line 92:

> 90:     protected void engineInit(int keysize, SecureRandom random) {
> 91: 
> 92:         if(keysize <= 0) {

Space after `if`.

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

PR: https://git.openjdk.org/jdk/pull/9679



More information about the security-dev mailing list