RFR: 8002277: Refactor two PBE classes to simplify maintenance [v5]

Valerie Peng valeriep at openjdk.java.net
Thu May 12 03:24:33 UTC 2022


On Wed, 11 May 2022 23:45:00 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> Valerie Peng has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Changed to extend various CipherSpi implementations.
>
> src/java.base/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java line 171:
> 
>> 169: 
>> 170:     // holder for the derived key and iv
>> 171:     private static class KeyAndIv implements Closeable {
> 
> You can make this a `record`.

Sure, good suggestion~

> src/java.base/share/classes/com/sun/crypto/provider/PKCS12PBECipherCore.java line 317:
> 
>> 315:             Arrays.fill(derivedKey, (byte)0);
>> 316: 
>> 317:             KeyAndIv result;
> 
> I think the fancy 2022 way is to `return switch (...) { case "RC4" -> new KeyAndIv(...) ... }`.

Ok~

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

PR: https://git.openjdk.java.net/jdk/pull/8521



More information about the security-dev mailing list