Search in sources :

Example 1 with EntropySourceProvider

use of org.bouncycastle.crypto.prng.EntropySourceProvider in project ddf by codice.

the class RandomNumberGenerator method createSeed.

public static byte[] createSeed() {
    EntropySourceProvider esp = new BasicEntropySourceProvider(new SecureRandom(), true);
    byte[] nonce = new byte[256];
    new SecureRandom().nextBytes(nonce);
    DualECSP800DRBG bcRbg = new DualECSP800DRBG(new SHA256Digest(), 256, esp.get(256), null, nonce);
    byte[] seed = new byte[256];
    bcRbg.generate(seed, null, true);
    return seed;
}
Also used : DualECSP800DRBG(org.bouncycastle.crypto.prng.drbg.DualECSP800DRBG) SHA256Digest(org.bouncycastle.crypto.digests.SHA256Digest) BasicEntropySourceProvider(org.bouncycastle.crypto.prng.BasicEntropySourceProvider) SecureRandom(java.security.SecureRandom) BasicEntropySourceProvider(org.bouncycastle.crypto.prng.BasicEntropySourceProvider) EntropySourceProvider(org.bouncycastle.crypto.prng.EntropySourceProvider)

Aggregations

SecureRandom (java.security.SecureRandom)1 SHA256Digest (org.bouncycastle.crypto.digests.SHA256Digest)1 BasicEntropySourceProvider (org.bouncycastle.crypto.prng.BasicEntropySourceProvider)1 EntropySourceProvider (org.bouncycastle.crypto.prng.EntropySourceProvider)1 DualECSP800DRBG (org.bouncycastle.crypto.prng.drbg.DualECSP800DRBG)1