On Tue, 13 Aug 2024 15:24:11 GMT, Kevin Driver <kdri...@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).
>> 
>> Work was begun in [another PR](https://github.com/openjdk/jdk/pull/18924).
>
> Kevin Driver has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   addressed several review comments, namely: - renaming the getParameters 
> method - renaming the AlgorithmParameterSpec object - address some javadoc 
> exception messages - add some information to KDF class private constructor 
> javadocs - other general cleanup

src/java.base/share/classes/com/sun/crypto/provider/HkdfKeyDerivation.java line 
300:

> 298:         }
> 299:         Mac hmacObj = Mac.getInstance(hmacAlgName);
> 300:         hmacObj.init(new SecretKeySpec(salt, "HKDF-Salt"));

Why use "HKDF-Salt" as key algorithm name? This is just internal key for the 
Hmac object and maybe it's safer to just use the `hmacAlgName` as the key 
algorithm? The key algorithm does not affect the Hmac operation anyway.

src/java.base/share/classes/com/sun/crypto/provider/HkdfKeyDerivation.java line 
312:

> 310:      * Perform the HMAC-Expand operation.  At the end of the operation, 
> the
> 311:      * keyStream instance variable will contain the complete KDF output 
> based on
> 312:      * the input values and desired length.

These lines are outdated? I can't find any `keyStream` instance variable.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1719073308
PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1719075233

Reply via email to