RFR: 8331008: KDF Implementation

Sean Mullan mullan at openjdk.org
Thu May 9 13:23:55 UTC 2024


On Tue, 23 Apr 2024 20:42:51 GMT, Kevin Driver <kdriver at openjdk.org> wrote:

> Introduce an API for Key Derivation Functions (KDFs), which are cryptographic algorithms for deriving additional keys from a secret key and other data. See [JEP 478](https://openjdk.org/jeps/478).

src/java.base/share/classes/javax/crypto/KDF.java line 147:

> 145:      *     algorithm.
> 146:      */
> 147:     public static KDF getInstance(String algorithm) throws NoSuchAlgorithmException {

All the `getInstance` methods should throw `NullPointerException` if `algorithm` is `null`.

src/java.base/share/classes/javax/crypto/KDF.java line 150:

> 148:         KDF instance = null;
> 149:         try {
> 150:             instance = getInstance(algorithm, (AlgorithmParameterSpec) null);

You can return the instance directly, no need to store it in a local variable.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18924#discussion_r1595430522
PR Review Comment: https://git.openjdk.org/jdk/pull/18924#discussion_r1595431991



More information about the security-dev mailing list