tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

NetBSD openjdk SecureRandom /dev/random "Resource temporarily unavailable" issue



With the default openjdk8 settings the following code

private static final int SALT_LENGTH = 32;
private static final String RANDOM_FACTORY = "SHA1PRNG";
byte[] saltBytes =
SecureRandom.getInstance(RANDOM_FACTORY).generateSeed(SALT_LENGTH);

Fails with an exception:

register: Error registering subscriber: java.io.IOException: Resource
temporarily unavailable
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:255)
        at sun.security.provider.SeedGenerator$URLSeedGenerator.getSeedBytes(SeedGenerator.java:539)
        at sun.security.provider.SeedGenerator.generateSeed(SeedGenerator.java:144)
        at sun.security.provider.SecureRandom.engineGenerateSeed(SecureRandom.java:139)
        at java.security.SecureRandom.generateSeed(SecureRandom.java:533)

Adjusting lib/security/java.security to switch securerandom.source
from file:/dev/random to file:/dev/urandom works around the issue.

Does anyone know if NetBSD's /dev/random behaving differently to other
platforms here?

David


Home | Main Index | Thread Index | Old Index