org.bouncycastle.drbg.gather_pause_secs - is to stop the entropy collection thread from grabbing all available entropy on the system. The original motivation for the hybrid infrastructure was virtual machines sometimes produce very few bits of entropy a second, the original approach (which "worked" at least for BC) was to just read on the second thread and allow things to progress around it, but it did tend to hog the system if other processes were using /dev/random. By default the thread will pause for 5 seconds between 64 bit reads, increasing this time will reduce the demands on the system entropy pool. Ideally the pause will be set to large enough to allow everyone to work together, but small enough to ensure the provider's DRBG is being regularly reseeded.
org.bouncycastle.drbg.entropysource - is the class name for an implementation of EntropySourceProvider. For example, one could be provided which just reads directly from /dev/random and the extra infrastructure used here could be avoided.
org.bouncycastle.drbg.entropy_thread - if true the provider will start a single daemon thread for handling entropy requests, rather than starting a thread periodically when samples are required.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| public static class | |
| private static class | |
| public static class | |
| public static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static EntropyDaemon | |
| private static Thread | |
| private static final String[][] | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static SecureRandom | |
| private static EntropySourceProvider | |
| private static EntropySourceProvider | |
| private static EntropySourceProvider | |
| private static final Object[] | |
| private static byte[] | |
| private static byte[] | |
| private static void |
| entropyDaemon | back to summary |
|---|---|
| private static EntropyDaemon entropyDaemon | |
| entropyThread | back to summary |
|---|---|
| private static Thread entropyThread | |
| initialEntropySourceNames | back to summary |
|---|---|
| private static final String[][] initialEntropySourceNames | |
| PREFIX | back to summary |
|---|---|
| private static final String PREFIX | |
| DRBG | back to summary |
|---|---|
| public DRBG() | |
| createBaseRandom | back to summary |
|---|---|
| private static SecureRandom createBaseRandom(boolean isPredictionResistant) | |
| createCoreEntropySourceProvider | back to summary |
|---|---|
| private static EntropySourceProvider createCoreEntropySourceProvider() | |
| createEntropySource | back to summary |
|---|---|
| private static EntropySourceProvider createEntropySource() | |
| createInitialEntropySource | back to summary |
|---|---|
| private static EntropySourceProvider createInitialEntropySource() | |
| findSource | back to summary |
|---|---|
| private static final Object[] findSource() | |
| generateDefaultPersonalizationString | back to summary |
|---|---|
| private static byte[] generateDefaultPersonalizationString(byte[] seed) | |
| generateNonceIVPersonalizationString | back to summary |
|---|---|
| private static byte[] generateNonceIVPersonalizationString(byte[] seed) | |
| sleep | back to summary |
|---|---|
| private static void sleep(long ms) throws InterruptedException | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| CoreSecureRandom | back to summary |
|---|---|
| pack-priv CoreSecureRandom(Object[] initialEntropySourceAndSpi) | |
| Modifier and Type | Field and Description |
|---|---|
| private static final SecureRandom |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected byte[] | engineGenerateSeed(int
the number of seed bytes to generate. numBytes)Implements abstract java. |
| protected void | engineNextBytes(byte[]
the array to be filled in with random bytes. bytes)Implements abstract java. |
| protected void | engineSetSeed(byte[]
the seed. bytes)Implements abstract java. |
| random | back to summary |
|---|---|
| private static final SecureRandom random | |
| Default | back to summary |
|---|---|
| public Default() | |
| engineGenerateSeed | back to summary |
|---|---|
| protected byte[] engineGenerateSeed(int numBytes) Implements abstract java. Doc from java. Returns the given number of seed bytes. This call may be used to seed other random number generators.
| |
| engineNextBytes | back to summary |
|---|---|
| protected void engineNextBytes(byte[] bytes) Implements abstract java. Doc from java. Generates a user-specified number of random bytes.
Some random number generators can only generate a limited amount
of random bytes per invocation. If the size of
| |
| engineSetSeed | back to summary |
|---|---|
| protected void engineSetSeed(byte[] bytes) Implements abstract java. Doc from java. Reseeds this random object with the given seed. The seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.
| |
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | |
| private final int | |
| private final SP800SecureRandom | |
| private final DRBG. | |
| private final AtomicInteger | |
| private final AtomicBoolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | entropySize()
Implements org. |
| public byte[] | getEntropy()
Implements org. |
| public boolean | isPredictionResistant()
Implements org. |
| additionalInput | back to summary |
|---|---|
| private final byte[] additionalInput | |
| bytesRequired | back to summary |
|---|---|
| private final int bytesRequired | |
| drbg | back to summary |
|---|---|
| private final SP800SecureRandom drbg | |
| entropySource | back to summary |
|---|---|
| private final DRBG. | |
| samples | back to summary |
|---|---|
| private final AtomicInteger samples | |
| seedAvailable | back to summary |
|---|---|
| private final AtomicBoolean seedAvailable | |
| HybridEntropySource | back to summary |
|---|---|
| pack-priv HybridEntropySource(final EntropyDaemon entropyDaemon, final int bitsRequired) | |
| entropySize | back to summary |
|---|---|
| public int entropySize() Implements org. Doc from org. Return the number of bits of entropy this source can produce.
| |
| getEntropy | back to summary |
|---|---|
| public byte[] getEntropy() Implements org. Doc from org. Return a byte array of entropy.
| |
| isPredictionResistant | back to summary |
|---|---|
| public boolean isPredictionResistant() Implements org. Doc from org. Return whether or not this entropy source is regarded as prediction resistant.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final AtomicReference | |
| private final EntropyDaemon | |
| private final IncrementalEntropySource | |
| private final AtomicBoolean | |
| private final AtomicBoolean |
| Access | Constructor and Description |
|---|---|
| pack-priv | SignallingEntropySource(EntropyDaemon entropyDaemon, AtomicBoolean seedAvailable, EntropySourceProvider baseRandom, int bitsRequired)
|
| Modifier and Type | Method and Description |
|---|---|
| public int | entropySize()
Implements org. |
| public byte[] | getEntropy()
Implements org. |
| public byte[] | getEntropy(long
time in milliseconds to pause in build up seed. pause)Implements org. |
| public boolean | isPredictionResistant()
Implements org. |
| pack-priv void |
| byteLength | back to summary |
|---|---|
| private final int byteLength | |
| entropy | back to summary |
|---|---|
| private final AtomicReference<V> entropy | |
| entropyDaemon | back to summary |
|---|---|
| private final EntropyDaemon entropyDaemon | |
| entropySource | back to summary |
|---|---|
| private final IncrementalEntropySource entropySource | |
| scheduled | back to summary |
|---|---|
| private final AtomicBoolean scheduled | |
| seedAvailable | back to summary |
|---|---|
| private final AtomicBoolean seedAvailable | |
| SignallingEntropySource | back to summary |
|---|---|
| pack-priv SignallingEntropySource(EntropyDaemon entropyDaemon, AtomicBoolean seedAvailable, EntropySourceProvider baseRandom, int bitsRequired) | |
| entropySize | back to summary |
|---|---|
| public int entropySize() Implements org. Doc from org. Return the number of bits of entropy this source can produce.
| |
| getEntropy | back to summary |
|---|---|
| public byte[] getEntropy() Implements org. Doc from org. Return a byte array of entropy.
| |
| getEntropy | back to summary |
|---|---|
| public byte[] getEntropy(long pause) throws InterruptedException Implements org. Doc from org. Pause allows for a gap between fetches. We only want this after we've initialised.
| |
| isPredictionResistant | back to summary |
|---|---|
| public boolean isPredictionResistant() Implements org. Doc from org. Return whether or not this entropy source is regarded as prediction resistant.
| |
| schedule | back to summary |
|---|---|
| pack-priv void schedule() | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | configure(ConfigurableProvider provider)
Implements abstract org. |
| Mappings | back to summary |
|---|---|
| public Mappings() | |
| configure | back to summary |
|---|---|
| public void configure(ConfigurableProvider provider) Implements abstract org. | |
| Modifier and Type | Field and Description |
|---|---|
| private static final SecureRandom |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected byte[] | engineGenerateSeed(int
the number of seed bytes to generate. numBytes)Implements abstract java. |
| protected void | engineNextBytes(byte[]
the array to be filled in with random bytes. bytes)Implements abstract java. |
| protected void | engineSetSeed(byte[]
the seed. bytes)Implements abstract java. |
| random | back to summary |
|---|---|
| private static final SecureRandom random | |
| NonceAndIV | back to summary |
|---|---|
| public NonceAndIV() | |
| engineGenerateSeed | back to summary |
|---|---|
| protected byte[] engineGenerateSeed(int numBytes) Implements abstract java. Doc from java. Returns the given number of seed bytes. This call may be used to seed other random number generators.
| |
| engineNextBytes | back to summary |
|---|---|
| protected void engineNextBytes(byte[] bytes) Implements abstract java. Doc from java. Generates a user-specified number of random bytes.
Some random number generators can only generate a limited amount
of random bytes per invocation. If the size of
| |
| engineSetSeed | back to summary |
|---|---|
| protected void engineSetSeed(byte[] bytes) Implements abstract java. Doc from java. Reseeds this random object with the given seed. The seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.
| |
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | |
| private final int | |
| private final SP800SecureRandom | |
| private final DRBG. | |
| private final AtomicInteger | |
| private final AtomicBoolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | entropySize()
Implements org. |
| public byte[] | getEntropy()
Implements org. |
| public boolean | isPredictionResistant()
Implements org. |
| additionalInput | back to summary |
|---|---|
| private final byte[] additionalInput | |
| bytesRequired | back to summary |
|---|---|
| private final int bytesRequired | |
| drbg | back to summary |
|---|---|
| private final SP800SecureRandom drbg | |
| entropySource | back to summary |
|---|---|
| private final DRBG. | |
| samples | back to summary |
|---|---|
| private final AtomicInteger samples | |
| seedAvailable | back to summary |
|---|---|
| private final AtomicBoolean seedAvailable | |
| OneShotHybridEntropySource | back to summary |
|---|---|
| pack-priv OneShotHybridEntropySource(final int bitsRequired) | |
| entropySize | back to summary |
|---|---|
| public int entropySize() Implements org. Doc from org. Return the number of bits of entropy this source can produce.
| |
| getEntropy | back to summary |
|---|---|
| public byte[] getEntropy() Implements org. Doc from org. Return a byte array of entropy.
| |
| isPredictionResistant | back to summary |
|---|---|
| public boolean isPredictionResistant() Implements org. Doc from org. Return whether or not this entropy source is regarded as prediction resistant.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final AtomicReference | |
| private final IncrementalEntropySource | |
| private final AtomicBoolean | |
| private final AtomicBoolean |
| Access | Constructor and Description |
|---|---|
| pack-priv | OneShotSignallingEntropySource(AtomicBoolean seedAvailable, EntropySourceProvider baseRandom, int bitsRequired)
|
| Modifier and Type | Method and Description |
|---|---|
| public int | entropySize()
Implements org. |
| public byte[] | getEntropy()
Implements org. |
| public byte[] | getEntropy(long
time in milliseconds to pause in build up seed. pause)Implements org. |
| public boolean | isPredictionResistant()
Implements org. |
| pack-priv void |
| byteLength | back to summary |
|---|---|
| private final int byteLength | |
| entropy | back to summary |
|---|---|
| private final AtomicReference<V> entropy | |
| entropySource | back to summary |
|---|---|
| private final IncrementalEntropySource entropySource | |
| scheduled | back to summary |
|---|---|
| private final AtomicBoolean scheduled | |
| seedAvailable | back to summary |
|---|---|
| private final AtomicBoolean seedAvailable | |
| OneShotSignallingEntropySource | back to summary |
|---|---|
| pack-priv OneShotSignallingEntropySource(AtomicBoolean seedAvailable, EntropySourceProvider baseRandom, int bitsRequired) | |
| entropySize | back to summary |
|---|---|
| public int entropySize() Implements org. Doc from org. Return the number of bits of entropy this source can produce.
| |
| getEntropy | back to summary |
|---|---|
| public byte[] getEntropy() Implements org. Doc from org. Return a byte array of entropy.
| |
| getEntropy | back to summary |
|---|---|
| public byte[] getEntropy(long pause) throws InterruptedException Implements org. Doc from org. Pause allows for a gap between fetches. We only want this after we've initialised.
| |
| isPredictionResistant | back to summary |
|---|---|
| public boolean isPredictionResistant() Implements org. Doc from org. Return whether or not this entropy source is regarded as prediction resistant.
| |
| schedule | back to summary |
|---|---|
| pack-priv void schedule() | |
| Modifier and Type | Field and Description |
|---|---|
| private final InputStream |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public EntropySource | |
| private int |
| seedStream | back to summary |
|---|---|
| private final InputStream seedStream | |
| URLSeededEntropySourceProvider | back to summary |
|---|---|
| pack-priv URLSeededEntropySourceProvider(final URL url) | |
| get | back to summary |
|---|---|
| public EntropySource get(final int bitsRequired) Implements org. | |
| privilegedRead | back to summary |
|---|---|
| private int privilegedRead(final byte[] data, final int off, final int len) | |