Example usage for org.bouncycastle.crypto.prng.drbg DualECSP800DRBG generate

List of usage examples for org.bouncycastle.crypto.prng.drbg DualECSP800DRBG generate

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.prng.drbg DualECSP800DRBG generate.

Prototype

public int generate(byte[] output, byte[] additionalInput, boolean predictionResistant) 

Source Link

Document

Populate a passed in array with random data.

Usage

From source file:org.codice.ddf.platform.util.RandomNumberGenerator.java

License:Open Source License

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;//from w ww  .  java 2  s .c o m
}