RFR: 8358076: KeyFactory.getInstance("EdDSA").generatePublic(null) throws NPE
Anthony Scarpino
ascarpino at openjdk.org
Thu May 29 23:55:51 UTC 2025
On Thu, 29 May 2025 23:32:59 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> I need a code review to throw `InvalidKeySpecException` when null is passed with `generatePublic()` and `generatePrivate()`. This change takes the opportunity to modernize the KeyFactory code by using `switch` syntax for `instanceof` checking, as well as, keeping the previous design of the implementation method handling the null case. There are existing JCK test cover this case, so no regression test is added.
>
> src/java.base/share/classes/sun/security/ec/ECKeyFactory.java line 223:
>
>> 221: }
>> 222: case null -> throw new InvalidKeySpecException(
>> 223: "keySpec most not be null");
>
> `s/most/must/`. Add every other `case null` in this PR.
Sigh.. one typo that is cut and pasted repeatedly. Sure.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25533#discussion_r2114909524
More information about the security-dev
mailing list