RFR: 8002277: Refactor two PBE classes to simplify maintenance [v2]
Weijun Wang
weijun at openjdk.java.net
Tue May 10 00:12:48 UTC 2022
On Mon, 9 May 2022 23:23:05 GMT, Valerie Peng <valeriep at openjdk.org> wrote:
>> src/java.base/share/classes/com/sun/crypto/provider/PBES2Core.java line 229:
>>
>>> 227: if (key instanceof javax.crypto.interfaces.PBEKey pbeKey) {
>>> 228: salt = check(pbeKey.getSalt()); // may be null
>>> 229: iCount = check(pbeKey.getIterationCount()); // may be 0
>>
>> It seems the return value is never 0.
>
> Oh, the comment about "may be 0" is meant toward the pbeKey.getInterationCount() call... Hmm, I will make it clearer.
I see. Another question, shall we reset `salt` and `iCount` at the beginning? If `params` is null and `key` is not `PBEKey` and there is an existing positive `iCount`, it will not be set to `DEFAULT_COUNT`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8521
More information about the security-dev
mailing list