8079107: Update TestKeyPairGenerator.java to use random number generator library
authordarcy
Thu, 30 Apr 2015 16:51:53 -0700
changeset 30049 dde45bde92e2
parent 30048 3424bede284d
child 30050 adea7866d41a
8079107: Update TestKeyPairGenerator.java to use random number generator library Reviewed-by: mullan
jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java
--- a/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Wed Apr 29 16:34:49 2015 -0700
+++ b/jdk/test/sun/security/pkcs11/rsa/TestKeyPairGenerator.java	Thu Apr 30 16:51:53 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];