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

Valerie Peng valeriep at openjdk.org
Wed Jul 2 16:31:55 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 to use List.of() per Sean's comment.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25808/files
  - new: https://git.openjdk.org/jdk/pull/25808/files/7d9e36b8..def1f55b

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

  Stats: 9 lines in 1 file changed: 0 ins; 2 del; 7 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