Top Description Inners Fields Constructors Methods
org.bouncycastle.util.test

public Class FixedSecureRandom

extends SecureRandom
Class Inheritance
Known Direct Subclasses
org.bouncycastle.util.test.TestRandomBigInteger, org.bouncycastle.util.test.TestRandomData
Imports
java.io.ByteArrayOutputStream, .IOException, java.security.Provider, .SecureRandom, org.bouncycastle.util.Pack, org.bouncycastle.util.encoders.Hex

A secure random that returns pre-seeded data to calls of nextBytes() or generateSeed().

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
FixedSecureRandom.BigInteger

BigInteger Source - in this case we expect requests for data that will be used for BigIntegers.

public static class
FixedSecureRandom.Data

Data Source - in this case we just expect requests for byte arrays.

private static class
private static class
public static class
FixedSecureRandom.Source

Base class for sources of fixed "Randomness"

Field Summary

Modifier and TypeField and Description
private byte[]
private int
private static BigInteger
private static BigInteger
private static final boolean
private static final boolean
private static final boolean
private static BigInteger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static byte[]
expandToBitLength(int bitLength, byte[] v)

public byte[]
generateSeed(int
the number of seed bytes to generate.
numBytes
)

Overrides java.security.SecureRandom.generateSeed.

Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself.
public boolean
public void
nextBytes(byte[]
the array to be filled in with random bytes.
bytes
)

Overrides java.security.SecureRandom.nextBytes.

Overrides default java.util.random.RandomGenerator.nextBytes.

Generates a user-specified number of random bytes.
public int
nextInt()

Overrides java.util.Random.nextInt.

Overrides default java.util.random.RandomGenerator.nextInt.

Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.
public long
nextLong()

Overrides java.util.Random.nextLong.

Implements java.util.random.RandomGenerator.nextLong.

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.
private int
Inherited from java.security.SecureRandom:
getAlgorithmgetInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetInstanceStronggetParametersgetProvidergetSeednextnextBytesreseedreseedsetSeedsetSeedtoString

Field Detail

_databack to summary
private byte[] _data
_indexback to summary
private int _index
ANDROIDback to summary
private static BigInteger ANDROID
CLASSPATHback to summary
private static BigInteger CLASSPATH
isAndroidStyleback to summary
private static final boolean isAndroidStyle
isClasspathStyleback to summary
private static final boolean isClasspathStyle
isRegularStyleback to summary
private static final boolean isRegularStyle
REGULARback to summary
private static BigInteger REGULAR

Constructor Detail

FixedSecureRandomback to summary
public FixedSecureRandom(FixedSecureRandom.Source... sources)

Method Detail

expandToBitLengthback to summary
private static byte[] expandToBitLength(int bitLength, byte[] v)
generateSeedback to summary
public byte[] generateSeed(int numBytes)

Overrides java.security.SecureRandom.generateSeed.

Doc from java.security.SecureRandom.generateSeed.

Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself. 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.

isExhaustedback to summary
public boolean isExhausted()
nextBytesback to summary
public void nextBytes(byte[] bytes)

Overrides java.security.SecureRandom.nextBytes.

Overrides default java.util.random.RandomGenerator.nextBytes.

Doc from java.security.SecureRandom.nextBytes.

Generates a user-specified number of random bytes.

Parameters
bytes:byte[]

the array to be filled in with random bytes.

nextIntback to summary
public int nextInt()

Overrides java.util.Random.nextInt.

Overrides default java.util.random.RandomGenerator.nextInt.

Doc from java.util.Random.nextInt.

Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence. The general contract of nextInt is that one int value is pseudorandomly generated and returned. All 232 possible int values are produced with (approximately) equal probability.

Returns:int

the next pseudorandom, uniformly distributed int value from this random number generator's sequence

nextLongback to summary
public long nextLong()

Overrides java.util.Random.nextLong.

Implements java.util.random.RandomGenerator.nextLong.

Doc from java.util.Random.nextLong.

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence. The general contract of nextLong is that one long value is pseudorandomly generated and returned.

Returns:long

the next pseudorandom, uniformly distributed long value from this random number generator's sequence

nextValueback to summary
private int nextValue()
org.bouncycastle.util.test back to summary

public Class FixedSecureRandom.BigInteger

extends Source
Class Inheritance

BigInteger Source - in this case we expect requests for data that will be used for BigIntegers. The FixedSecureRandom will attempt to compensate for platform differences here.

Field Summary

Inherited from org.bouncycastle.util.test.FixedSecureRandom.Source:
data

Constructor Summary

AccessConstructor and Description
public
BigInteger(byte[] data)

public
BigInteger(int bitLength, byte[] data)

public
BigInteger(String hexData)

public
BigInteger(int bitLength, String hexData)

Constructor Detail

BigIntegerback to summary
public BigInteger(byte[] data)
BigIntegerback to summary
public BigInteger(int bitLength, byte[] data)
BigIntegerback to summary
public BigInteger(String hexData)
BigIntegerback to summary
public BigInteger(int bitLength, String hexData)
org.bouncycastle.util.test back to summary

public Class FixedSecureRandom.Data

extends Source
Class Inheritance

Data Source - in this case we just expect requests for byte arrays.

Field Summary

Inherited from org.bouncycastle.util.test.FixedSecureRandom.Source:
data

Constructor Summary

AccessConstructor and Description
public
Data(byte[] data)

Constructor Detail

Databack to summary
public Data(byte[] data)
org.bouncycastle.util.test back to summary

private Class FixedSecureRandom.DummyProvider

extends Provider
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.security.Provider:
clearcomputecomputeIfAbsentcomputeIfPresentconfigureelementsentrySetforEachgetgetInfogetNamegetOrDefaultgetPropertygetServicegetServicesgetVersiongetVersionStrisConfiguredkeyskeySetloadmergeputputAllputIfAbsentputServiceremoveremoveremoveServicereplacereplacereplaceAlltoStringvalues

Constructor Detail

DummyProviderback to summary
pack-priv DummyProvider()
org.bouncycastle.util.test back to summary

private Class FixedSecureRandom.RandomChecker

extends SecureRandom
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv byte[]
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
nextBytes(byte[]
the array to be filled in with random bytes.
bytes
)

Overrides java.security.SecureRandom.nextBytes.

Overrides default java.util.random.RandomGenerator.nextBytes.

Generates a user-specified number of random bytes.
Inherited from java.security.SecureRandom:
generateSeedgetAlgorithmgetInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetInstanceStronggetParametersgetProvidergetSeednextnextBytesreseedreseedsetSeedsetSeedtoString

Field Detail

databack to summary
pack-priv byte[] data
indexback to summary
pack-priv int index

Constructor Detail

RandomCheckerback to summary
pack-priv RandomChecker()

Method Detail

nextBytesback to summary
public void nextBytes(byte[] bytes)

Overrides java.security.SecureRandom.nextBytes.

Overrides default java.util.random.RandomGenerator.nextBytes.

Doc from java.security.SecureRandom.nextBytes.

Generates a user-specified number of random bytes.

Parameters
bytes:byte[]

the array to be filled in with random bytes.

org.bouncycastle.util.test back to summary

public Class FixedSecureRandom.Source

extends Object
Class Inheritance
Known Direct Subclasses
org.bouncycastle.util.test.FixedSecureRandom.Data, org.bouncycastle.util.test.FixedSecureRandom.BigInteger

Base class for sources of fixed "Randomness"

Field Summary

Modifier and TypeField and Description
pack-priv byte[]

Constructor Summary

AccessConstructor and Description
pack-priv
Source(byte[] data)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
pack-priv byte[] data

Constructor Detail

Sourceback to summary
pack-priv Source(byte[] data)