Package com.microej.crypto.test
Class SecureRandomTest
- java.lang.Object
-
- com.microej.crypto.test.SecureRandomTest
-
public class SecureRandomTest extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description SecureRandomTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgetBytes(java.security.SecureRandom sr, int bytesNumber)voidtest(java.security.SecureRandom sr)voidtestGenerateSeed()Test that generateSeed returns a byte array of the right lengthvoidtestGet256Bytes()Test getting 256 bytesvoidtestGet8192Bytes()Test getting 8192 bytesvoidtestManyGenerations()Test that the PRNG can handle a large number of generations (e.g.voidtestMultipleSecureRandom()Test creating multiple SecureRandomsvoidtestNext()Test that next returns ints with the right number of leading zerosvoidtestNextBytes()Test that nextBytes does not always return zerosvoidtestSecureRandomsWithDifferentSeeds()Test that two SecureRandoms created using the different seeds return different lists of valuesvoidtestSecureRandomsWithDifferentSeeds2()Test that two SecureRandoms created using the different seeds return different lists of valuesvoidtestSeedSupplement()Test that setSeed() "supplements, rather than replaces, the existing seed"voidtestSetSeed()Test setting the seed
-
-
-
Method Detail
-
testGet256Bytes
public void testGet256Bytes() throws java.lang.ExceptionTest getting 256 bytes- Throws:
java.lang.Exception
-
testGet8192Bytes
public void testGet8192Bytes() throws java.lang.ExceptionTest getting 8192 bytes- Throws:
java.lang.Exception
-
testSetSeed
public void testSetSeed() throws java.lang.ExceptionTest setting the seed- Throws:
java.lang.Exception
-
testMultipleSecureRandom
public void testMultipleSecureRandom() throws java.lang.ExceptionTest creating multiple SecureRandoms- Throws:
java.lang.Exception
-
testSecureRandomsWithDifferentSeeds
public void testSecureRandomsWithDifferentSeeds() throws java.lang.ExceptionTest that two SecureRandoms created using the different seeds return different lists of values- Throws:
java.lang.Exception
-
testSecureRandomsWithDifferentSeeds2
public void testSecureRandomsWithDifferentSeeds2() throws java.lang.ExceptionTest that two SecureRandoms created using the different seeds return different lists of values- Throws:
java.lang.Exception
-
testNext
public void testNext() throws java.lang.ExceptionTest that next returns ints with the right number of leading zeros- Throws:
java.lang.Exception
-
testGenerateSeed
public void testGenerateSeed() throws java.lang.ExceptionTest that generateSeed returns a byte array of the right length- Throws:
java.lang.Exception
-
testNextBytes
public void testNextBytes() throws java.lang.ExceptionTest that nextBytes does not always return zeros- Throws:
java.lang.Exception
-
testSeedSupplement
public void testSeedSupplement() throws java.lang.ExceptionTest that setSeed() "supplements, rather than replaces, the existing seed"- Throws:
java.lang.Exception
-
testManyGenerations
public void testManyGenerations() throws java.lang.ExceptionTest that the PRNG can handle a large number of generations (e.g. reseeds automatically)- Throws:
java.lang.Exception
-
test
public void test(java.security.SecureRandom sr) throws java.lang.Exception- Parameters:
sr-- Throws:
java.lang.Exception
-
getBytes
public void getBytes(java.security.SecureRandom sr, int bytesNumber) throws java.lang.Exception- Parameters:
sr-bytesNumber-- Throws:
java.lang.Exception
-
-