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

Jason Frame 6 years ago committed by GitHub
parent 6c8422d5f2
commit 90705bbcb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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", "-Dpantheon.home=PANTHEON_HOME",
// We shutdown log4j ourselves, as otherwise his shutdown hook runs before our own and whatever // We shutdown log4j ourselves, as otherwise his shutdown hook runs before our own and whatever
// happens during shutdown is not logged. // happens during shutdown is not logged.
"-Dlog4j.shutdownHookEnabled=false", "-Dlog4j.shutdownHookEnabled=false"
"-Djava.security.egd=file:/dev/urandom"
] ]
run { run {

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

Loading…
Cancel
Save