|
For the latest news and information visit The GNU Crypto project | |
| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectgnu.crypto.prng.BasePRNGgnu.crypto.prng.CSPRNGpublic class CSPRNGextends BasePRNGField Summary | |
static String |
|
static String |
|
static String |
|
static String |
|
static String |
|
Fields inherited from class gnu.crypto.prng.BasePRNG | |
buffer, initialised, name, ndx | |
Constructor Summary | |
| |
Method Summary | |
(package private) void |
|
void |
|
void |
|
Object |
|
void | |
protected void |
|
(package private) double | |
static IRandom |
|
void |
|
Methods inherited from class gnu.crypto.prng.BasePRNG | |
addRandomByte, addRandomBytes, addRandomBytes, clone, fillBlock, init, isInitialised, name, nextByte, nextBytes, nextBytes, setup | |
public static final String BLOCKING
Property name for whether or not to wait for the slow poll to complete, passed as aBoolean. The default value is true.
public static final String FILE_SOURCES
Property name for the list of files to read for random values. The mapped value is a list with the following values:
- A
Double, indicating the suggested quality of this source. This value must be between 0 and 100.- An
Integer, indicating the number of bytes to skip in the file before reading bytes. This can be any nonnegative value.- An
Integer, indicating the number of bytes to read.- A
String, indicating the path to the file.
- See Also:
SimpleList
public static final String OTHER_SOURCES
Property name for a list of other sources of entropy. The mapped value must be a list ofEntropySourceobjects.
public static final String PROGRAM_SOURCES
Property name for the list of programs to execute, and use the output as new random bytes. The mapped property is formatted similarly an inFILE_SOURCESandURL_SOURCES, except the fourth member is aStringof the program to execute.
public static final String URL_SOURCES
Property name for the list of URLs to poll for random values. The mapped value is a list formatted similarly as inFILE_SOURCES, but the fourth member is aURL.
(package private) void addQuality(double quality)
public void addRandomByte(byte b)
Add a single random byte to the randomness pool. Note that this method will not increment the pool's quality counter (this can only be done via a source provided to the setup method).
- Specified by:
- addRandomByte in interface IRandom
- Overrides:
- addRandomByte in interface BasePRNG
- Parameters:
b- The byte to add.
public void addRandomBytes(byte[] buf,
int off,
int len)Add an array of bytes into the randomness pool. Note that this method will not increment the pool's quality counter (this can only be done via a source provided to the setup method).
- Specified by:
- addRandomBytes in interface IRandom
- Overrides:
- addRandomBytes in interface BasePRNG
- Parameters:
buf- The byte array.off- The offset from whence to start reading bytes.len- The number of bytes to add.
public Object clone()
protected void finalize()
throws Throwable(package private) double getQuality()
public static IRandom getSystemInstance() throws ClassNotFoundException, MalformedURLException, NumberFormatException
Create and initialize a CSPRNG instance with the "system" parameters; the files, URLs, programs, andEntropySourcesources used by the instance are derived from properties set in the systemProperties. All properties are of the from name.N, where name is the name of the source, and N is an integer (staring at 1) that indicates the preference number for that source. The following vales for name are used here:Finally, a boolean property "gnu.crypto.csprng.blocking" can be set to the desired value of
FILE_SOURCESquality ; offset ; count ; pathFILE_SOURCESURL_SOURCESpathPROGRAM_SOURCESOTHER_SOURCESEntropySourceBLOCKING. An example of valid properties would be:gnu.crypto.csprng.blocking=true gnu.crypto.csprng.file.1=75.0;0;256;/dev/random gnu.crypto.csprng.file.2=10.0;0;100;/home/user/file gnu.crypto.csprng.url.1=5.0;0;256;http://www.random.org/cgi-bin/randbyte?nbytes=256 gnu.crypto.csprng.url.2=0;256;256;http://slashdot.org/ gnu.crypto.csprng.program.1=0.5;0;10;last -n 50 gnu.crypto.csprng.program.2=0.5;0;10;tcpdump -c 5 gnu.crypto.csprng.other.1=foo.bar.MyEntropySource gnu.crypto.csprng.other.2=com.company.OtherEntropySource