[NC-1374] Use default java secureRandom (#34)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Jason Frame 6 years ago committed by GitHub
parent d39de8a89a
commit 7870407ef4
  1. 3
      build.gradle
  2. 9
      crypto/src/main/java/net/consensys/pantheon/crypto/SecureRandomProvider.java

@ -305,8 +305,7 @@ applicationDefaultJvmArgs = [
"-Dpantheon.home=PANTHEON_HOME",
// We shutdown log4j ourselves, as otherwise his shutdown hook runs before our own and whatever
// happens during shutdown is not logged.
"-Dlog4j.shutdownHookEnabled=false",
"-Djava.security.egd=file:/dev/urandom"
"-Dlog4j.shutdownHookEnabled=false"
]
run {

@ -3,7 +3,7 @@ package net.consensys.pantheon.crypto;
import java.security.SecureRandom;
public class SecureRandomProvider {
private static final SecureRandom publicSecureRandom = new PRNGSecureRandom();
private static final SecureRandom publicSecureRandom = secureRandom();
// Returns a shared instance of secure random intended to be used where the value is used publicly
public static SecureRandom publicSecureRandom() {
@ -11,6 +11,11 @@ public class SecureRandomProvider {
}
public static SecureRandom createSecureRandom() {
return new PRNGSecureRandom();
return secureRandom();
}
@SuppressWarnings("DoNotCreateSecureRandomDirectly")
private static SecureRandom secureRandom() {
return new SecureRandom();
}
}

Loading…
Cancel
Save