RFR: 8358076: KeyFactory.getInstance("EdDSA").generatePublic(null) throws NPE

Anthony Scarpino ascarpino at openjdk.org
Thu May 29 22:44:27 UTC 2025


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.

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

Commit messages:
 - add null and update syntax

Changes: https://git.openjdk.org/jdk/pull/25533/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25533&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8358076
  Stats: 200 lines in 4 files changed: 51 ins; 20 del; 129 mod
  Patch: https://git.openjdk.org/jdk/pull/25533.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25533/head:pull/25533

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


More information about the security-dev mailing list