Expresso 5-6

com.jcorporate.expresso.core.security.strongencryption
Class RandomNumber

java.lang.Object
  extended bycom.jcorporate.expresso.core.security.AbstractRandomNumber
      extended bycom.jcorporate.expresso.core.security.strongencryption.RandomNumber

public final class RandomNumber
extends AbstractRandomNumber

Cryptographically Strong Version of the random number generator. Due to the seeding process, the constructor for this class will take a significant amount of time to initialize.

Author:
Michael Rimov

Constructor Summary
RandomNumber()
          Default Constructor
 
Method Summary
 byte[] getRandomBytes(int numBytes)
          getRandomBytes - Returns a byte array of random bytes.
 void init()
          To save some time, we use the last seed generated from a file instead of loading from scratch
 
Methods inherited from class com.jcorporate.expresso.core.security.AbstractRandomNumber
getCryptoManager, setCryptoManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomNumber

public RandomNumber()
             throws ChainedException
Default Constructor

Throws:
ChainedException - if unable to instantiate the SHA1 Random number generator
Method Detail

init

public void init()
          throws ChainedException
To save some time, we use the last seed generated from a file instead of loading from scratch

Overrides:
init in class AbstractRandomNumber
Throws:
NoSuchAlgorithmException - if we cannot find the SHA1PRNG
ChainedException

getRandomBytes

public byte[] getRandomBytes(int numBytes)
getRandomBytes - Returns a byte array of random bytes. The derived class determines the actual method used for getting the random data.

Specified by:
getRandomBytes in class AbstractRandomNumber
Parameters:
numBytes - The number of bytes to retrieve
Returns:
An array of random bytes

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.