On Tue, 7 Oct 2025 17:45:54 GMT, Valerie Peng <[email protected]> wrote:

>> This PR updates the cipher transformation parsing and verification logic to 
>> be stricter and throws NoSuchAlgorithmException (NSAE) when additional 
>> slash(es) is found. With the existing parsing logic, the extra slash(es) is 
>> likely to end up in the last component, i.e. the padding scheme, and lead to 
>> NoSuchPaddingException (NSPE) from the underlying CipherSpi object. 
>> 
>> Out of the supported cipher algorithms for all JDK providers, PBES2 cipher 
>> algorithms and RSA cipher with OAEP paddings may contain truncated SHA-512 
>> in their transformations. This proposed fix would check for truncated SHA in 
>> both algorithm and padding schemes and throws NSAE if any extra slash is 
>> found. 
>> 
>> Thanks in advance for the review~
>
> Valerie Peng has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Updated based on Weijun's suggestion.

src/java.base/share/classes/javax/crypto/Cipher.java line 290:

> 288: 
> 289:     // for special handling SHA-512/224, SHA-512/256, SHA512/224, 
> SHA512/256
> 290:     private static final String SHA512TRUNCATED = "512/2";

Is this constant still used?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27615#discussion_r2411552299

Reply via email to