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

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


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

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

Commit messages:
 - Merge branch 'master' into JDK-8377318
 - JDK-8377318: Force bad padding exception in TestPKCS5PaddingError.java at all times

Changes: https://git.openjdk.org/jdk/pull/29612/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29612&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8377318
  Stats: 16 lines in 1 file changed: 9 ins; 1 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/29612.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29612/head:pull/29612

PR: https://git.openjdk.org/jdk/pull/29612



More information about the security-dev mailing list