@Test public void testEngineGenerateSeedReadsFromRandomDevice() throws Exception { if (!(OsUtils.isLinux())) { System.err.println("WARNING: Skipping test, can't run on this OS"); return; } byte[] entropy = TestUtils.getRandomBytes(SEED_BYTES); File urandom = new File(testDir, "urandom"); urandom.delete(); FileOutputStream out = new FileOutputStream(urandom); out.write(entropy); out.flush(); out.close(); assertTrue(urandom.exists()); assertEquals(SEED_BYTES, urandom.length()); LinuxSecureRandomSpi engine = new LinuxSecureRandomSpi(urandom, RANDOM_DEVICE); byte[] b = engine.engineGenerateSeed(SEED_BYTES); assertArrayEquals(entropy, b); }
@Override protected byte[] engineGenerateSeed(int len) { byte[] seed = new byte[len]; engineNextBytes(seed); return seed; }
LinuxSecureRandomSpi extends SecureRandomSpi { @Override protected byte[] engineGenerateSeed(int len) { byte[] seed = new byte[len]; engineNextBytes(seed); return seed; } }
LinuxSecureRandomSpi extends SecureRandomSpi { @Override protected byte[] engineGenerateSeed(int len) { byte[] seed = new byte[len]; engineNextBytes(seed); return seed; } LinuxSecureRandomSpi();   LinuxSecureRandomSpi(File inputDevice, File outputDevice); }
LinuxSecureRandomSpi extends SecureRandomSpi { @Override protected byte[] engineGenerateSeed(int len) { byte[] seed = new byte[len]; engineNextBytes(seed); return seed; } LinuxSecureRandomSpi();   LinuxSecureRandomSpi(File inputDevice, File outputDevice);  }
LinuxSecureRandomSpi extends SecureRandomSpi { @Override protected byte[] engineGenerateSeed(int len) { byte[] seed = new byte[len]; engineNextBytes(seed); return seed; } LinuxSecureRandomSpi();   LinuxSecureRandomSpi(File inputDevice, File outputDevice);   }