RFR: 8331008: Implement JEP 478: Key Derivation Function API (Preview) [v34]

Weijun Wang weijun at openjdk.org
Mon May 13 22:43:43 UTC 2024


On Mon, 13 May 2024 22:34:04 GMT, Kevin Driver <kdriver at openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/HkdfKeyDerivation.java line 237:
>> 
>>> 235:             } catch (InvalidKeyException ike) {
>>> 236:                 throw new InvalidParameterSpecException(
>>> 237:                     "Issue encountered when combining ikm or salt values into single keys");
>> 
>> add cause (ike) to exception.
>
> What is the preferred mechanism for this? This type does not have a Throwable parameter, so I can't pass `ike` to the ctor.

Unfortunately, in this case, you have to store the exception to a variable, call` setCause` on it, and then return it.

>> src/java.base/share/classes/com/sun/crypto/provider/HkdfKeyDerivation.java line 407:
>> 
>>> 405:     }
>>> 406: 
>>> 407:     public static final class HkdfSHA256 extends HkdfKeyDerivation {
>> 
>> Can these classes be package-private instead of public?
>
> It looks like they must be public, at least with the way things are organized currently.

I think so. I remember JCA requires the class to be public.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18924#discussion_r1599170282
PR Review Comment: https://git.openjdk.org/jdk/pull/18924#discussion_r1599168630



More information about the security-dev mailing list