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

Mikhail Yankelevich myankelevich at openjdk.org
Tue Feb 3 11:10:43 UTC 2026


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

>> 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.
>
> Actually, what do you think about throwing an exception here, something like 
> 
> 
> throw new RuntimeException("Expected IBSE thrown");
> 
> 
> it shouldn't happen, so failing the test should be valid IMO

Changed now, what do you think?

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

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



More information about the security-dev mailing list