diff options
author | Sergio Giro <sgiro@google.com> | 2015-06-26 15:50:48 +0100 |
---|---|---|
committer | Sergio Giro <sgiro@google.com> | 2015-06-26 16:59:42 +0100 |
commit | 9f7d5418c438af6fb3b7d74b06e109f1f6a38594 (patch) | |
tree | 636f0ecb66521c8d06cfe719fdfa4293ab976986 /luni | |
parent | 04dd85923b7af9f5009d9aa557f60731e619780a (diff) | |
download | libcore-9f7d5418c438af6fb3b7d74b06e109f1f6a38594.zip libcore-9f7d5418c438af6fb3b7d74b06e109f1f6a38594.tar.gz libcore-9f7d5418c438af6fb3b7d74b06e109f1f6a38594.tar.bz2 |
libcore: use default SecureRandom in KeyGen DSA tests
While generating key pairs, BouncyCastle checks that random numbers
are strong enough. Tests were using a mock random generator that
generates the constant 10.
Bug: 19657861
(cherry picked from commit 098bc41d846f847a6551209d65dbb74bfea3bb00)
Change-Id: Ifd1401f9b386e4039b8f51af65e5e7dc5fad15e2
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/test/java/tests/security/interfaces/DSAPrivateKeyTest.java | 4 | ||||
-rw-r--r-- | luni/src/test/java/tests/security/interfaces/DSAPublicKeyTest.java | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/luni/src/test/java/tests/security/interfaces/DSAPrivateKeyTest.java b/luni/src/test/java/tests/security/interfaces/DSAPrivateKeyTest.java index 6cebda5..5f4abdd 100644 --- a/luni/src/test/java/tests/security/interfaces/DSAPrivateKeyTest.java +++ b/luni/src/test/java/tests/security/interfaces/DSAPrivateKeyTest.java @@ -32,9 +32,7 @@ public class DSAPrivateKeyTest extends TestCase { */ public void test_getX() throws Exception { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA"); - keyGen.initialize(new DSAParameterSpec(Util.P, Util.Q, Util.G), - new SecureRandom(new MySecureRandomSpi(), null) { - }); + keyGen.initialize(new DSAParameterSpec(Util.P, Util.Q, Util.G), new SecureRandom()); KeyPair keyPair = keyGen.generateKeyPair(); DSAPrivateKey key = (DSAPrivateKey) keyPair.getPrivate(); assertNotNull("Invalid X value", key.getX()); diff --git a/luni/src/test/java/tests/security/interfaces/DSAPublicKeyTest.java b/luni/src/test/java/tests/security/interfaces/DSAPublicKeyTest.java index 9fe4910..09e936d 100644 --- a/luni/src/test/java/tests/security/interfaces/DSAPublicKeyTest.java +++ b/luni/src/test/java/tests/security/interfaces/DSAPublicKeyTest.java @@ -42,9 +42,7 @@ public class DSAPublicKeyTest extends TestCase { // Case 1: check with predefined p, q, g, x keyGen = KeyPairGenerator.getInstance("DSA"); - keyGen.initialize(new DSAParameterSpec(Util.P, Util.Q, Util.G), - new SecureRandom(new MySecureRandomSpi(), null) { - }); + keyGen.initialize(new DSAParameterSpec(Util.P, Util.Q, Util.G), new SecureRandom()); keys = keyGen.generateKeyPair(); priv = (DSAPrivateKey) keys.getPrivate(); publ = (DSAPublicKey) keys.getPublic(); |