Qual é o / dev / urandom equivalente no nível do Windows JVM

4

Recentemente, me deparei com problemas porque a falta de entropia e bloqueio de rand IO causou interrupções. No Linux, posso fazer o seguinte:

JAVA_OPTS=-Djava.security.egd=/dev/urandom ./myStartScript.sh

Qual é o equivalente no Windows? Estamos executando o aplicativo em servidores Linux e Windows, servidores Linux usando o OpenJDK JRE e servidores Windows usando o Oracle JRE.

Encontrei muitas sugestões sobre CryptGenRandom , mas como posso passar isso para o aplicativo no nível da JVM?

    
por pydoge 27.02.2018 / 18:03

1 resposta

2

Encontrei a documentação em jre / lib / security / java.security que confirma isso. Aqui está a citação

Select the primary source of seed data for the "SHA1PRNG" and "NativePRNG" SecureRandom implementations in the "Sun" provider. (Other SecureRandom implementations might also use this property.)

On Unix-like systems (for example, Solaris/Linux/MacOS), the "NativePRNG" and "SHA1PRNG" implementations obtains seed data from special device files such as file:/dev/random.

On Windows systems, specifying the URLs "file:/dev/random" or "file:/dev/urandom" will enable the native Microsoft CryptoAPI seeding mechanism for SHA1PRNG.

By default, an attempt is made to use the entropy gathering device specified by the "securerandom.source" Security property. If an exception occurs while accessing the specified URL:

 SHA1PRNG:
     the traditional system/thread activity algorithm will be used.

 NativePRNG:
     a default value of /dev/random will be used.  If neither
     are available, the implementation will be disabled.
     "file" is the only currently supported protocol type.
    
por 19.09.2018 / 19:31