RFR: 8331008: Implement JEP 478: Key Derivation Function API (Preview) [v22]
Weijun Wang
weijun at openjdk.org
Tue Sep 3 22:07:37 UTC 2024
On Fri, 30 Aug 2024 23:26:12 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).
>>
>> 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:
>
> change impl class to use byte arrays rather than SecretKey objects where possible
test/jdk/com/sun/crypto/provider/KDF/BasicHKDFFunctions.java line 54:
> 52: var okm2 = kdf.deriveKey("OKM", extractAndExpand);
> 53:
> 54: if (!Arrays.equals(prk.getEncoded(), expectedPrk)) {
You can use `Asserts.assertEqualsByteArray` in `/test/lib`.
test/jdk/com/sun/crypto/provider/KDF/BasicHKDFFunctions.java line 67:
> 65: test(HKDFParameterSpec.ofExtract().extractOnly());
> 66: // test expand with empty info
> 67: test(HKDFParameterSpec.ofExtract().thenExpand(new byte[0], 32));
Do you want to test `info == null` also?
test/jdk/com/sun/crypto/provider/KDF/HKDFKnownAnswerTests.java line 86:
> 84: "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5",
> 85: "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf"
> 86: +
I usually don't see `+` in separate lines. Put it at the end of the previous line.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1742657556
PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1742657911
PR Review Comment: https://git.openjdk.org/jdk/pull/20301#discussion_r1742661085
More information about the security-dev
mailing list