RFR: 8331008: Implement JEP 478: Key Derivation Function API (Preview) [v65]
Alan Bateman
alanb at openjdk.org
Wed May 15 08:25:15 UTC 2024
On Tue, 14 May 2024 22:14:47 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).
>
> Kevin Driver has updated the pull request incrementally with one additional commit since the last revision:
>
> re-enable Delayed Provider test
The changes in the PR have been updated 64 times so far, hard to keep up :-) Just a few comments on the current API, revision 4bb0d78b
- The KDF.deriveXXX methods mention "Delayed provider selection". Is this idempotent? If I create a KDF and several threads race to derive keys or data, is it guaranteed that the same provider will be selection for any ordering of these threads? What does KDF::getProviderName if no provider has been selected?
- KDFSpi. Can "cryptographic service provider" link to anything? I mentioned this in a previous comment but there is nothing to show that this provider interface fits in. It's not a factory for a KDF so you can't just implement it and plop an implementation on your class path. What does KDFSpi::engineDeriveKey throw if the value of "alg" is not a recognised algorithm name?
- HKDFParameterSpec.Builder.extractOnly. Is it an error to call the build methods (currently named extractOnly and thenExpand) before adding key material? Asking if these methods need to throw IllegalStateException if they don't yet have the key material.
- HKDFParameterSpec.Extract ikms and salts methods, are you planning to document the ordering of the elements?
- HKDFParameterSpec.Extract.info uses the phrase "or null if not specified". An ExtractThenExpand object can be created with optional context/info, it looks like an Extract can't be created with context/info. Just trying to see if it is possible to get a non-null context/info here.
- HKDFParameterSpec.buildExtract. The naming is a bit unusual here. Look at Thread.ofPlatform and Thread.ofVirtual for ideas, it might be that this method should be OfExtract.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18924#issuecomment-2111874611
More information about the security-dev
mailing list