RFR: 4936767: Parameters for MessageDigest

Weijun Wang weijun at openjdk.org
Wed Nov 15 20:49:30 UTC 2023


On Wed, 15 Nov 2023 18:56:11 GMT, Sean Mullan <mullan at openjdk.org> wrote:

>> Add parameters to `MessageDigest` and introduce `SHAKE256-LEN` with an integer parameter.
>
> src/java.base/share/classes/java/security/MessageDigest.java line 436:
> 
>> 434:      *         {@code MessageDigestSpi} implementation for the
>> 435:      *         specified algorithm and parameters
>> 436:      *
> 
> Is there a reason why you didn't throw IAPE when params are bad?

This is following the `SecureRandom` style where there are both `getInstance` methods that has or has not the parameters argument. If you think IAPE is better I can also throw it. `CertStore` does this way and it has a dedicated method to extract the cause of the NSAE thrown by `GetInstance.getInstance` and rethrow it. See https://github.com/openjdk/jdk/blob/9486969bd3cb084c89a7255de0c664c980d1e661/src/java.base/share/classes/java/security/cert/CertStore.java#L249

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16660#discussion_r1394778408



More information about the security-dev mailing list