RFR: 8359388: Stricter checking for cipher transformations [v2]

Valerie Peng valeriep at openjdk.org
Mon Jun 16 22:20:10 UTC 2025


> Based on the javadoc of `javax.crypto.Cipher` class, the cipher transformation should be either "algorithm/mode/padding" or
> "algorithm". When parsing the transformation, space(s) is trimmed off and empty strings are considered as "unspecified". This PR adds checks to ensure that transformations with empty "mode" and/or "padding" value in the "algorithm/mode/padding" form leads to `NoSuchAlgorithmException`. This reverts some changes made in [https://bugs.openjdk.org/browse/JDK-8358159](https://bugs.openjdk.org/browse/JDK-8358159) which allows empty mode and/or padding in the transformations.
> 
> 
> Thanks in advance for the review~

Valerie Peng has updated the pull request incrementally with one additional commit since the last revision:

  Updated test per Mikhail's review comments.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25808/files
  - new: https://git.openjdk.org/jdk/pull/25808/files/245bf361..8d8640c6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25808&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25808&range=00-01

  Stats: 39 lines in 1 file changed: 9 ins; 8 del; 22 mod
  Patch: https://git.openjdk.org/jdk/pull/25808.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25808/head:pull/25808

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


More information about the security-dev mailing list