RFR: 8360463: Ambiguity in Cipher.getInstance() specification between NoSuchAlgorithmException and NoSuchPaddingException [v6]
Valerie Peng
valeriep at openjdk.org
Wed Sep 3 18:58:44 UTC 2025
On Thu, 28 Aug 2025 12:52:37 GMT, Sean Mullan <mullan at openjdk.org> wrote:
>> Valerie Peng has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Applied javadoc changes to getInstance(String) method and made the impl
>> to match the javadoc
>
> test/jdk/com/sun/crypto/provider/Cipher/ChaCha20/unittest/ChaCha20CipherUnitTest.java line 91:
>
>> 89: System.out.println("Expected transformation: " + transformation);
>> 90: }
>> 91: } catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
>
> I think it would be good to enhance this test to distinguish between the expected exceptions for each transformation.
Well, which exception is thrown depends on which provider is used and how it registers its implementations. Pinpointing the exact Exception would require running the test against a specific provider which we know how the implementations are registered. Without tying the test to a specific provider, existing transformations in this test may lead to either NSAE or NSPE, thus I just add NSPE to the catch clause. I can add more transformations which would lead to only NSAE assuming this is what you want to see?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26489#discussion_r2319901498
More information about the security-dev
mailing list