Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.bouncycastle.crypto.prng;
 
 
 
 public class SP800SecureRandom
     extends SecureRandom
 {
    private final DRBGProvider drbgProvider;
    private final boolean predictionResistant;
    private final SecureRandom randomSource;
    private final EntropySource entropySource;
    private SP80090DRBG drbg;
    SP800SecureRandom(SecureRandom randomSourceEntropySource entropySourceDRBGProvider drbgProviderboolean predictionResistant)
    {
        this. = randomSource;
        this. = entropySource;
        this. = drbgProvider;
        this. = predictionResistant;
    }
    public void setSeed(byte[] seed)
    {
        synchronized (this)
        {
            if ( != null)
            {
                this..setSeed(seed);
            }
        }
    }
    public void setSeed(long seed)
    {
        synchronized (this)
        {
            // this will happen when SecureRandom() is created
            if ( != null)
            {
                this..setSeed(seed);
            }
        }
    }
    public void nextBytes(byte[] bytes)
    {
        synchronized (this)
        {
            if ( == null)
            {
                 = .get();
            }
            // check if a reseed is required...
            if (.generate(bytesnull) < 0)
            {
                .reseed(null);
                .generate(bytesnull);
            }
        }
    }
    public byte[] generateSeed(int numBytes)
    {
        byte[] bytes = new byte[numBytes];
        this.nextBytes(bytes);
        return bytes;
    }
New to GrepCode? Check out our FAQ X