RFR: 8155191: SunPKCS11's SecureRandom#nextBytes(byte[]) accepts null argument

Valerie Peng valeriep at openjdk.org
Thu May 4 02:07:22 UTC 2023


Just a trivial change for enforcing consistent NullPointerException behavior for the SecureRandom.nextBytes(byte[]) method.

Other similar methods such as Random.nextByte(byte[]) and its other subclasses all throw NPE for null byte[] argument. Most JDK default providers' SecureRandom impls also check and throw NPE. Thus, this should be moved up and enforced by the SecureRandom class to ensure consistency.

CSR has been filed.

Thanks,
Valerie

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

Commit messages:
 - 8155191: SunPKCS11's SecureRandom#nextBytes(byte[]) accepts null argument

Changes: https://git.openjdk.org/jdk/pull/13788/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13788&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8155191
  Stats: 138 lines in 5 files changed: 127 ins; 4 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/13788.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13788/head:pull/13788

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


More information about the security-dev mailing list