Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenJDK 1.8 which configuaration will take effect, when set /dev/urandom?

Tags:

java

we know that there are two options to let SecureRandom to use /dev/urandom instead of /dev/random:

  1. change JRE_PATH/lib/security/java.security file
  2. set jvm property -Djava.security.egd

but which one take effect when setting both ?

like image 215
WestFarmer Avatar asked Sep 12 '25 13:09

WestFarmer


1 Answers

The documentation in <java_dir>/jre/lib/security/java.security clearly says:

The entropy gathering device can also be specified with the System property "java.security.egd". For example:

% java -Djava.security.egd=file:/dev/random MainClass

Specifying this System property will override the "securerandom.source" Security property.

So the system property will always have precedence when set.

like image 79
Stefan Ferstl Avatar answered Sep 14 '25 04:09

Stefan Ferstl