RFR: 8365883: Fix P11Cipher to throw BadPaddingException for PKCS11 CKR_ENCRYPTED_DATA_INVALID error
Valerie Peng
valeriep at openjdk.org
Sat Jan 31 00:11:23 UTC 2026
On Fri, 30 Jan 2026 10:57:23 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
test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java line 107:
> 105: c2.doFinal(cipherText, 0, cipherText.length - 2);
> 106: } catch (IllegalBlockSizeException ibe) {
> 107: // expected
Can we also add a `System.out.println("Expected IBSE thrown");` for information sake? Same goes for the other expected exception block on line 119.
test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java line 127:
> 125: } catch (NoSuchAlgorithmException nsae) {
> 126: System.out.println("Skipping unsupported algorithm: " +
> 127: nsae);
nit: why so much indent?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29503#discussion_r2748505729
PR Review Comment: https://git.openjdk.org/jdk/pull/29503#discussion_r2748513559
More information about the security-dev
mailing list