RFR: 8324648: Avoid NoSuchMethodError when instantiating NativePRNG
Oli Gillespie
ogillespie at openjdk.org
Thu Jan 25 12:13:36 UTC 2024
On Wed, 24 Jan 2024 19:50:55 GMT, Chen Liang <liach at openjdk.org> wrote:
> I see that the existing caller code has a check for `ctorParamClass`. Why must we declare `SecureRandomParameters.class` as the `ctorParamClass` for these 3 randoms instead of using `null`?
>From [lookup code](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/security/Provider.java#L1951-L1957):
// Looking for the constructor with a params first and fallback
// to one without if not found. This is to support the enhanced
// SecureRandom where both styles of constructors are supported.
// Before jdk9, there was no params support (only getInstance(alg))
// and an impl only had the params-less constructor. Since jdk9,
// there is getInstance(alg,params) and an impl can contain
// an Impl(params) constructor.
The `EngineDescription` is looked up by `type` which in this case is `SecureRandom`, there's no way right now to choose specific parameters for different implementers. Are you proposing that I extend the engine lookup to include algorithm, so we can have specific `EngineDescription` for `SecureRandom->NativePRNG`? I don't know this code well enough to know if that's feasible, but it definitely seems more complex.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17560#issuecomment-1910079405
More information about the security-dev
mailing list