org.owasp.esapi.interfaces
Interface IRandomizer

All Known Implementing Classes:
Randomizer

public interface IRandomizer

The IRandomizer interface defines a set of methods for creating cryptographically random numbers and strings. Implementers should be sure to use a strong cryptographic implementation, such as the JCE or BouncyCastle. Weak sources of randomness can undermine a wide variety of security mechanisms.

Since:
June 1, 2007
Author:
Jeff Williams (jeff.williams .at. aspectsecurity.com) Aspect Security

Method Summary
 boolean getRandomBoolean()
          Returns a random boolean.
 java.lang.String getRandomFilename(java.lang.String extension)
          Returns an unguessable random filename with the specified extension.
 java.lang.String getRandomGUID()
          Generates a random GUID.
 int getRandomInteger(int min, int max)
          Gets the random integer.
 float getRandomReal(float min, float max)
          Gets the random real.
 java.lang.String getRandomString(int length, char[] characterSet)
          Gets the random string.
 

Method Detail

getRandomString

public java.lang.String getRandomString(int length,
                                        char[] characterSet)
Gets the random string.

Parameters:
length - the length
characterSet - the character set
Returns:
the random string

getRandomBoolean

public boolean getRandomBoolean()
Returns a random boolean.

Returns:

getRandomInteger

public int getRandomInteger(int min,
                            int max)
Gets the random integer.

Parameters:
min - the min
max - the max
Returns:
the random integer

getRandomFilename

public java.lang.String getRandomFilename(java.lang.String extension)
Returns an unguessable random filename with the specified extension.


getRandomReal

public float getRandomReal(float min,
                           float max)
Gets the random real.

Parameters:
min - the min
max - the max
Returns:
the random real

getRandomGUID

public java.lang.String getRandomGUID()
                               throws EncryptionException
Generates a random GUID.

Returns:
the GUID
Throws:
EncryptionException