com.ibm.aglets.security
Class Randoms
java.lang.Object
|
+--com.ibm.aglets.security.Randoms
- public class Randoms
- extends java.lang.Object
The Randoms class is a set of secure random number generators.
- Version:
- 1.00 $Date: 2001/07/28 06:33:13 $
- Author:
- ONO Kouichi
Method Summary |
static byte[] |
getPseudoSeed(int length)
Returns the given number of pseudo seed bytes, computed with
Calendar's milliseconds value. |
static void |
getRandom(int length,
byte[] seq)
Generates a random number for given length by
the secure random number generator. |
static java.security.SecureRandom |
getRandomGenerator(int length)
Gets a secure random number generator for given length with seed. |
static java.security.SecureRandom |
getRandomGenerator(int length,
boolean useSecureRandomSeed)
Gets a secure random number generator for given length with seed. |
static boolean |
getUseSecureRandomSeed()
Returns the use of secure/unsecure random seed. |
static void |
setUseSecureRandomSeed(boolean useSecureRandomSeed)
Sets the use of secure/unsecure random seed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Randoms
public Randoms()
getPseudoSeed
public static byte[] getPseudoSeed(int length)
- Returns the given number of pseudo seed bytes, computed with
Calendar's milliseconds value.
- Returns:
- the given number of pseudo seed bytes
getRandom
public static void getRandom(int length,
byte[] seq)
- Generates a random number for given length by
the secure random number generator.
- Parameters:
length
- length of byte sequence to be generatedseq
- a byte sequence to which random number is copied
getRandomGenerator
public static java.security.SecureRandom getRandomGenerator(int length)
- Gets a secure random number generator for given length with seed.
If the secure random number generator is not stored in the hash table,
creates it and stores it into the table.
- Parameters:
length
- length of byte sequence to be generated- Returns:
- secure random number generator for given length
getRandomGenerator
public static java.security.SecureRandom getRandomGenerator(int length,
boolean useSecureRandomSeed)
- Gets a secure random number generator for given length with seed.
If the secure random number generator is not stored in the hash table,
creates it and stores it into the table.
- Parameters:
length
- length of byte sequence to be generateduseSecureRandomSeed
- use a secure random seed if true,
or use an unsecure random seed otherwise.- Returns:
- secure random number generator for given length
getUseSecureRandomSeed
public static boolean getUseSecureRandomSeed()
- Returns the use of secure/unsecure random seed.
- Returns:
- use a secure random seed if true,
or use an unsecure random seed otherwise.
setUseSecureRandomSeed
public static void setUseSecureRandomSeed(boolean useSecureRandomSeed)
- Sets the use of secure/unsecure random seed.
- Parameters:
useSecureRandomSeed
- use a secure random seed if true,
or use an unsecure random seed otherwise.