On Wed, 11 May 2022 22:02:42 GMT, Valerie Peng <valer...@openjdk.org> wrote:
>> This change refactors the PBES2Core and PKCS12PBECipherCore classes in >> SunJCE provider as requested in the bug record. Functionality should remain >> the same with a clearer and simplified code/control flow with less lines of >> code. This should improve readability and maintenance. I enhanced one >> existing regression test to test more scenarios. This test would pass before >> the proposed change and continues to pass with the proposed changes. > > 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`. 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(...) ... }`. ------------- PR: https://git.openjdk.java.net/jdk/pull/8521