JDK 9 RFR of JDK-8079107: Update TestKeyPairGenerator.java to use random number generator library

Sean Mullan sean.mullan at oracle.com
Thu Apr 30 19:25:29 UTC 2015


Looks fine to me.

--Sean

On 04/29/2015 08:24 PM, joe darcy wrote:
> Hello,
>
> Please review the patch below to address
>
>      JDK-8079107: Update TestKeyPairGenerator.java to use random number
> generator library
>
> The patch implements the recommendations recently sent to jdk9-dev:
>
> http://mail.openjdk.java.net/pipermail/jdk9-dev/2015-April/002164.html
>
> Thanks,
>
> -Joe
>
> diff -r 409888e3ba56 test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java
> --- a/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java    Wed Apr
> 29 16:34:49 2015 -0700
> +++ b/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java    Wed Apr
> 29 17:22:35 2015 -0700
> @@ -24,9 +24,11 @@
>   /**
>    * @test
>    * @bug 4856966
> - * @summary Verify that the RSA KeyPairGenerator works
> + * @summary Verify that the RSA KeyPairGenerator works (use -Dseed=X to
> set PRNG seed)
>    * @author Andreas Sterbenz
>    * @library ..
> + * @library /lib/testlibrary
> + * @build jdk.testlibrary.*
>    * @run main/othervm TestKeyPairGenerator
>    * @key intermittent randomness
>    */
> @@ -106,7 +108,7 @@
>           int[] keyLengths = {512, 512, 1024};
>           BigInteger[] pubExps = {null, BigInteger.valueOf(3), null};
>           KeyPair[] keyPairs = new KeyPair[3];
> -        new Random().nextBytes(data);
> +        RandomFactory.getRandom().nextBytes(data);
>           KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",
> provider);
>           for (int i = 0; i < keyLengths.length; i++) {
>               int len = keyLengths[i];
>


More information about the security-dev mailing list