Set Default SecureRandom Algorithm - #1580
Conversation
a87d847 to
bd1ba68
Compare
8a4f265 to
632c68b
Compare
| assertTrue (acceptableValues.contains(secureRandom.getAlgorithm()), "SecureRandom not SunJCE - " + secureRandom.getAlgorithm()); | ||
|
|
||
| //Now Put OpenJCEPlus first in the list. | ||
| Provider provider = (Provider) Class.forName("com.ibm.crypto.plus.provider.OpenJCEPlus").getDeclaredConstructor().newInstance(); |
There was a problem hiding this comment.
Why are we using reflection here?
There was a problem hiding this comment.
We don't have too, It is just one of a few ways this can be done.
There was a problem hiding this comment.
Wouldn't it be simpler to do Provider provider = new com.ibm.crypto.plus.provider.OpenJCEPlus();
There was a problem hiding this comment.
Ether way works. This does follow how we do it in our test code though.
| assertTrue (acceptableValues.contains(secureRandom.getAlgorithm()), "SecureRandom not SunJCE"); | ||
|
|
||
| //Now Put OpenJCEPlus first in the list. | ||
| Provider provider = (Provider) Class.forName("com.ibm.crypto.plus.provider.OpenJCEPlusFIPS").getDeclaredConstructor().newInstance(); |
There was a problem hiding this comment.
We don't have too, It is just one of a few ways this can be done.
| - **name**: Unique identifier for the provider (required) | ||
| - **description**: Human-readable description of the provider (required) | ||
| - **default**: Whether to load default provider attributes (optional, values: `true`, `false`, `1`, `0`) | ||
| - **securerandomdefault**: Determines which Secure Random Algorithm is the default one if this provider is first in the provider list |
There was a problem hiding this comment.
Should we also document that if it's not set, it defaults to a value? That is if we decide that we won't honour user-specifies order if it's not.
There was a problem hiding this comment.
We can not determine the one that will be selected. It is random. So, not sure what to say here.
There was a problem hiding this comment.
If I'm getting this right, when someone doesn't specify this in the configuration, this defaults to SHA256DRBG. Should we mention this in this md file?
There was a problem hiding this comment.
As indicated in the comment with out this setting the default could be either SHA256DRBG or SHA512DRBG what is selected is random. It could be either one.
Add code to be able to set the Default SecureRandom algorithm from provider. fixes: IBM#1553 Signed-off-by: johnpeck-us-ibm <johnpeck@us.ibm.com>
a1f0a6c to
4637204
Compare
Add code to be able to set the Default SecureRandom algorithm from provider.
fixes: #1553
Signed-off-by: johnpeck-us-ibm johnpeck@us.ibm.com