Class SecureRandomTest


  • public class SecureRandomTest
    extends java.lang.Object
    • Constructor Detail

      • SecureRandomTest

        public SecureRandomTest()
    • Method Detail

      • testGet256Bytes

        public void testGet256Bytes()
                             throws java.lang.Exception
        Test getting 256 bytes
        Throws:
        java.lang.Exception
      • testGet8192Bytes

        public void testGet8192Bytes()
                              throws java.lang.Exception
        Test getting 8192 bytes
        Throws:
        java.lang.Exception
      • testSetSeed

        public void testSetSeed()
                         throws java.lang.Exception
        Test setting the seed
        Throws:
        java.lang.Exception
      • testMultipleSecureRandom

        public void testMultipleSecureRandom()
                                      throws java.lang.Exception
        Test creating multiple SecureRandoms
        Throws:
        java.lang.Exception
      • testSecureRandomsWithDifferentSeeds

        public void testSecureRandomsWithDifferentSeeds()
                                                 throws java.lang.Exception
        Test that two SecureRandoms created using the different seeds return different lists of values
        Throws:
        java.lang.Exception
      • testSecureRandomsWithDifferentSeeds2

        public void testSecureRandomsWithDifferentSeeds2()
                                                  throws java.lang.Exception
        Test that two SecureRandoms created using the different seeds return different lists of values
        Throws:
        java.lang.Exception
      • testNext

        public void testNext()
                      throws java.lang.Exception
        Test that next returns ints with the right number of leading zeros
        Throws:
        java.lang.Exception
      • testGenerateSeed

        public void testGenerateSeed()
                              throws java.lang.Exception
        Test that generateSeed returns a byte array of the right length
        Throws:
        java.lang.Exception
      • testNextBytes

        public void testNextBytes()
                           throws java.lang.Exception
        Test that nextBytes does not always return zeros
        Throws:
        java.lang.Exception
      • testSeedSupplement

        public void testSeedSupplement()
                                throws java.lang.Exception
        Test that setSeed() "supplements, rather than replaces, the existing seed"
        Throws:
        java.lang.Exception
      • testManyGenerations

        public void testManyGenerations()
                                 throws java.lang.Exception
        Test 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