Top Description Inners Fields Constructors Methods
org.bouncycastle.crypto.fips

public final Class FipsSecureRandom

extends SecureRandom
Class Inheritance
Imports
java.security.Provider, .SecureRandom, .SecureRandomSpi, org.bouncycastle.crypto.EntropySource, org.bouncycastle.crypto.util.EntropyUtil

Base class for DRBG/RNG SecureRandom implementations that use FIPS approved algorithms.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final DRBG
private final boolean
private final SecureRandom

Constructor Summary

AccessConstructor and Description
pack-priv
FipsSecureRandom(SecureRandom randomSource, DRBG drbg, EntropySource entropySource, boolean predictionResistant)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

number of bits produced each cycle.
getBlockSize
()

Return the block size of the underlying DRBG

public int

Returns:

the security strength (in bits) of the DRBG.
getSecurityStrength
()

Return the security strength of the DRBG.

public void
nextBytes(byte[] bytes, byte[] additionalInput)

public void
reseed()

Overrides java.security.SecureRandom.reseed.

Force a reseed.
public void
reseed(byte[]
additional input to be used in conjunction with reseed.
additionalInput
)

Force a reseed with additional input.

public void
setSeed(long
the seed.
seed
)

Overrides java.security.SecureRandom.setSeed.

Reseeds this random object, using the eight bytes contained in the given long seed.
Inherited from java.security.SecureRandom:
generateSeedgetAlgorithmgetInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetInstanceStronggetParametersgetProvidergetSeednextnextBytesnextBytesreseedsetSeedtoString

Field Detail

drbgback to summary
private final DRBG drbg
predictionResistantback to summary
private final boolean predictionResistant
randomSourceback to summary
private final SecureRandom randomSource

Constructor Detail

FipsSecureRandomback to summary
pack-priv FipsSecureRandom(SecureRandom randomSource, DRBG drbg, EntropySource entropySource, boolean predictionResistant)

Method Detail

getBlockSizeback to summary
public int getBlockSize()

Return the block size of the underlying DRBG

Returns:int

number of bits produced each cycle.

getSecurityStrengthback to summary
public int getSecurityStrength()

Return the security strength of the DRBG.

Returns:int

the security strength (in bits) of the DRBG.

nextBytesback to summary
public void nextBytes(byte[] bytes, byte[] additionalInput)
reseedback to summary
public void reseed()

Overrides java.security.SecureRandom.reseed.

Force a reseed.

reseedback to summary
public void reseed(byte[] additionalInput)

Force a reseed with additional input.

Parameters
additionalInput:byte[]

additional input to be used in conjunction with reseed.

setSeedback to summary
public void setSeed(long seed)

Overrides java.security.SecureRandom.setSeed.

Doc from java.security.SecureRandom.setSeed.

Reseeds this random object, using the eight bytes contained in the given long seed. The given seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.

A PRNG SecureRandom will not seed itself automatically if setSeed is called before any nextBytes or reseed calls. The caller should make sure that the seed argument contains enough entropy for the security of this SecureRandom.

This method is defined for compatibility with java.util.Random.

Parameters
seed:long

the seed.

org.bouncycastle.crypto.fips back to summary

private Class FipsSecureRandom.RandomProvider

extends Provider
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.security.Provider:
clearcomputecomputeIfAbsentcomputeIfPresentconfigureelementsentrySetforEachgetgetInfogetNamegetOrDefaultgetPropertygetServicegetServicesgetVersiongetVersionStrisConfiguredkeyskeySetloadmergeputputAllputIfAbsentputServiceremoveremoveremoveServicereplacereplacereplaceAlltoStringvalues

Constructor Detail

RandomProviderback to summary
pack-priv RandomProvider()
org.bouncycastle.crypto.fips back to summary

private Class FipsSecureRandom.RandomSpi

extends SecureRandomSpi
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final DRBG
private final EntropySource
private final boolean
private final SecureRandom

Constructor Summary

AccessConstructor and Description
pack-priv
RandomSpi(SecureRandom randomSource, DRBG drbg, EntropySource entropySource, boolean predictionResistant)

Method Summary

Modifier and TypeMethod and Description
protected byte[]
engineGenerateSeed(int
the number of seed bytes to generate.
numBytes
)

Implements abstract java.security.SecureRandomSpi.engineGenerateSeed.

Returns the given number of seed bytes.
protected void
engineNextBytes(byte[]
the array to be filled in with random bytes.
bytes
)

Implements abstract java.security.SecureRandomSpi.engineNextBytes.

Generates a user-specified number of random bytes.
protected void
engineSetSeed(byte[]
the seed.
seed
)

Implements abstract java.security.SecureRandomSpi.engineSetSeed.

Reseeds this random object with the given seed.
Inherited from java.security.SecureRandomSpi:
engineGetParametersengineNextBytesengineReseedtoString

Field Detail

drbgback to summary
private final DRBG drbg
entropySourceback to summary
private final EntropySource entropySource
predictionResistantback to summary
private final boolean predictionResistant
randomSourceback to summary
private final SecureRandom randomSource

Constructor Detail

RandomSpiback to summary
pack-priv RandomSpi(SecureRandom randomSource, DRBG drbg, EntropySource entropySource, boolean predictionResistant)

Method Detail

engineGenerateSeedback to summary
protected byte[] engineGenerateSeed(int numBytes)

Implements abstract java.security.SecureRandomSpi.engineGenerateSeed.

Doc from java.security.SecureRandomSpi.engineGenerateSeed.

Returns the given number of seed bytes. This call may be used to seed other random number generators.

Parameters
numBytes:int

the number of seed bytes to generate.

Returns:byte[]

the seed bytes.

Annotations
@Override
engineNextBytesback to summary
protected void engineNextBytes(byte[] bytes)

Implements abstract java.security.SecureRandomSpi.engineNextBytes.

Doc from java.security.SecureRandomSpi.engineNextBytes.

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 bytes is greater than this limit, the implementation should invoke its generation process multiple times to completely fill the buffer before returning from this method.

Parameters
bytes:byte[]

the array to be filled in with random bytes.

Annotations
@Override
engineSetSeedback to summary
protected void engineSetSeed(byte[] seed)

Implements abstract java.security.SecureRandomSpi.engineSetSeed.

Doc from java.security.SecureRandomSpi.engineSetSeed.

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.

Parameters
seed:byte[]

the seed.

Annotations
@Override