RFR: 8377318: Force bad padding exception in TestPKCS5PaddingError.java at all times

Mikhail Yankelevich myankelevich at openjdk.org
Mon Feb 9 22:02:19 UTC 2026


On Fri, 6 Feb 2026 20:36:04 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

>> Currently implementation of the test relies on changing the last byte of the cypher to mess up the padding lines. However if the last bit is already 0 the padding will not be taken into account and the result will have no error but will be a garbage output. Current test doesn't take this into account. 
>> 
>> The fix should encode the test text without padding and decode with padding to make sure that the bad padding exception is thrown.
>> 
>> Kudos to @djelinski for assisting with finding the issue vs RFC!
>> 
>> Also added a bug id which was missing
>
> test/jdk/sun/security/pkcs11/Cipher/TestPKCS5PaddingError.java line 26:
> 
>> 24: /*
>> 25:  * @test
>> 26:  * @bug 6687725 8365883
> 
> nit: the bug id for this PR is 8377318

That's the BPE ticket, I forgot to include it there. This pr is noreg-self so shouldn't be under `@bug`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29612#discussion_r2775939287



More information about the security-dev mailing list