|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10668-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.security.crypto.fips.RNGTest
public final class RNGTest
Random number generator continuous self-test class that monitors all RNGs for failure to a constant value, as required by the FIPS 140-2 specification.
If this test fails for any RNG, the crypto module is placed in the ModuleState.ERROR_TEST_RNG_CONTINUOUS
error state, and a SelfTestException
is thrown. Until this state is cleared (see FIPS_140_2.clearModuleState()
), if any attempt to perform a cryptographic operation, including input or output, a ModuleStateException
is thrown.
FIPS_140_2
, RandomBitsSource.getRNGTest()
Constructor Summary | |
---|---|
RNGTest(RandomBitsSource rng) Creates a new RNGTest instance. |
Method Summary | |
---|---|
void |
initialize() Resets the test and generates and discards an initial random value from the RNG. |
void |
testRandomByte(byte random) Runs the continuous Random Number Generator test for the given random bytes. |
void |
testRandomBytes(byte[] random, int offset, int length) Runs the continuous Random Number Generator test for the given random bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RNGTest(RandomBitsSource rng)
RNGTest
instance.
The RNGTest
should be instantiated in the RandomBitsSource
's constructor:
// Instance variable of the MyRandom class.
private RNGTest rngTest;
// MyRandom constructor.
public MyRandom (boolean seed)
{
//
// Set up MyRandom object...
//
rngTest = new RNGTest(this);
}
The initialize()
method must be called before the testRandomBytes
of testRandomByte
methods can be used.
rng
- The RandomBitsSource
that this instance of RNGTest
will be testing.Method Detail |
---|
public void initialize()
Sub-classes of RandomBitsSource
must invoke this method in their seed()
methods.
public void testRandomBytes(byte[] random, int offset, int length)
Sub-classes of RandomBitsSource
must invoke this test in their randomBytes
methods before returning any generated random value.
random
- The new random value to be compared with the previous value.offset
- The starting index in random
from which the bytes to be tested will be taken.length
- The number of bytes from random
, starting with offset
, that will be tested.SelfTestException
- If the test fails or if this RNGTest
has not been initialized.initialize()
, testRandomByte(byte)
public void testRandomByte(byte random)
Sub-classes of RandomBitsSource
should use this test in their randomByte
methods before returning any generated random value.
random
- The new random value to be compared with the previous value.SelfTestException
- If the test fails or if this RNGTest
has not been initialized.initialize()
, testRandomBytes(byte[], int, int)
|
Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10668-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |