RFR: 8365883: Fix P11Cipher to throw BadPaddingException for PKCS11 CKR_ENCRYPTED_DATA_INVALID error [v2]

Valerie Peng valeriep at openjdk.org
Tue Feb 3 22:21:31 UTC 2026


On Tue, 3 Feb 2026 11:10:41 GMT, Mikhail Yankelevich <myankelevich at openjdk.org> wrote:

>> Underlying issue: if provider returns `PKCS11Exception: CKR_ENCRYPTED_DATA_INVALID` instead of BadPaddingException - `java.security.ProviderException: doFinal()` is thrown
>
> Mikhail Yankelevich has updated the pull request incrementally with one additional commit since the last revision:
> 
>   test changes

test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java line 74:

> 72: 
> 73:         // Checking for SunJCE first
> 74:         System.out.println("Checking SunJCE provider");

nit: how about printing out the value of `sunJCEProvider` instead of "SunJCE"?

test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java line 92:

> 90:                     SecretKey key = kg.generateKey();
> 91:                     Cipher c1 = Cipher.getInstance(currTest.transformation,
> 92:                             System.getProperty("test.provider.name", "SunJCE"));

nit: this can just be `sunJCEProvider`. No need for another System.getProperty(...) call?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29503#discussion_r2761229162
PR Review Comment: https://git.openjdk.org/jdk/pull/29503#discussion_r2761232522



More information about the security-dev mailing list