| RSA BSAFE CRYPTO-J |
Cryptographic Components for Java |
| JSAFE Javadoc | JCE Javadoc | Search |
For more information about pseudorandom number generation, refer to the Crypto-J Developer's Guide.
JSAFE_SecureRandom extends the java.security.SecureRandom class so that it can be used to replace the Sun JavaSoft classes. All Crypto-J classes that use this class actually request a java.security.SecureRandom Java class, so that you can use the standard Java classes instead of java.security.SecureRandom.
See Overview of Crypto-J for background and reference material on using and understanding Crypto-J.
Copyright © RSA Security Inc., 1997-2005. All rights reserved.
Public Methods | |
| String JSAFE_SecureRandom:: | getDevice () |
| Returns the name of the device of record. More... | |
| String [] JSAFE_SecureRandom:: | getDeviceList () |
Returns a String array that describes all the devices used to execute the transformation. More... | |
| int [] JSAFE_SecureRandom:: | getAlgorithmParameters () |
Returns a new int array containing the algorithm's parameters. More... | |
| abstract String JSAFE_SecureRandom:: | getAlgorithm () |
| Returns the standard algorithm name. More... | |
| abstract void JSAFE_SecureRandom:: | seed (byte[] seedBytes) |
| Seeds the pseudorandom number generator. More... | |
| void JSAFE_SecureRandom:: | extraSeed (byte[] extraSeedBytes) throws JSAFE_InputException |
| Generates seed bytes and uses them to seed an object. More... | |
| abstract void JSAFE_SecureRandom:: | autoseed () |
| This method generates seed bytes and uses them to seed an object. More... | |
| void JSAFE_SecureRandom:: | setSeed (long seedLong) |
Seeds the pseudorandom number generator with the seedLong (8-byte integer) value. More... | |
| void JSAFE_SecureRandom:: | setSeed (byte[] seedBytes) |
| Seeds the pseudorandom number generator. More... | |
| void JSAFE_SecureRandom:: | nextBytes (byte[] bytes) |
| Fills the input buffer with pseudorandom bytes. More... | |
| short JSAFE_SecureRandom:: | nextShort () |
Generates a pseudorandom short (2-byte integer) value. More... | |
| int JSAFE_SecureRandom:: | nextInt () |
Generates a pseudorandom int (4-byte integer) value. More... | |
| long JSAFE_SecureRandom:: | nextLong () |
Generates a pseudorandom long (8-byte integer) value. More... | |
| double JSAFE_SecureRandom:: | nextDouble () |
Generates a pseudorandom double (8-byte floating-point number) value. More... | |
| float JSAFE_SecureRandom:: | nextFloat () |
Generates a pseudorandom float (4-byte floating-point number) value. More... | |
| byte [] JSAFE_SecureRandom:: | generateRandomBytes (int numberOfBytes) |
Generates pseudorandom bytes, returning them in a new byte array of length numberOfBytes. More... | |
| abstract void JSAFE_SecureRandom:: | generateRandomBytes (byte[] randomOutput, int offset, int numberOfBytes) |
| Generates pseudorandom bytes, placing them into the given buffer. More... | |
| Object JSAFE_SecureRandom:: | clone () throws CloneNotSupportedException |
| Overrides the default clone to produce a deep clone. More... | |
| void JSAFE_SecureRandom:: | clearSensitiveData () |
| This method clears sensitive data from an object. More... | |
Static Public Methods | |
| SecureRandom JSAFE_SecureRandom:: | getInstance (String transformation, String device) throws NoSuchAlgorithmException |
Builds an object that performs the transformation on the given device. More... | |
|
|
This method generates seed bytes and uses them to seed an object. The technique used is based on the autoseeding from This method may take four or five seconds.
Note: JavaSoft provides the following cautionary statement regarding their
autoseeding algorithm: We attempt to provide sufficient seed bytes to
completely randomize the internal state of the generator (20 bytes). Note,
however, that our seed generation algorithm has not been thoroughly studied
or widely deployed. It relies on counting the number of times that the calling
thread can yield while waiting for another thread to sleep for a specified
interval.
|
|
|
This method clears sensitive data from an object. Although the finalizer clears the data, there is no guarantee the garbage collector will quickly call the finalizer. Allows a user to clear data as soon as possible. After calling |
|
|
Overrides the default clone to produce a deep clone. Overrides clone in class
|
|
|
Generates seed bytes and uses them to seed an object. Provides "extra" seed bytes for PRNGs that use two kinds of seed, such as an X9.31 random seed.
To generate a random seed that complies with the X9.31 specification, there must be two independent streams of seeding. A standard seed is supplied by calling
The size, in bytes, of the
|
|
||||||||||||||||
|
Generates pseudorandom bytes, placing them into the given buffer. This method generates This method is used as the basis of all random entities returned by this class (except seed bytes).
|
|
|
Generates pseudorandom bytes, returning them in a new
|
|
|
Returns the standard algorithm name.
|
|
|
Returns a new
|
|
|
Returns the name of the device of record. Possible device values are:
|
|
|
Returns a
|
|
||||||||||||
|
Builds an object that performs the Note: Due to a change inThe value of transformation must be one of the following:
Note: "FIPS186Random" is a general purpose FIPS 140-2 compliant pseudo random number
generator based on the on the FIPS 186 standard.
Note: Using "X931Random" will produce pseudo-random results in compliance with
the X9.31 standard. If a hardware random number generator is not available,
this software pseudo-random number generator is required to generate
strong RSA key pairs. This pseudo-random number generator also requires a
minimum number of seed bytes per stream.
The value of digest when used with "HWRandom" must be one of the following:
Note: The digest value is for whitening the hardware results. To produce
unwhitened bytes, use "NoDigest". Whitening the output of a random number
generator means applying a post-processing algorithm to reduce patterns in
the hardware bits and make them less predictable. The advantage of
performing whitening in software as well as hardware is that an attacker
must modify the hardware and the software to make the HRNG leak secret
information. If you plan to use the random numbers directly, you should use
"MD2", "MD5", or "SHA1" as the "HWRandom" digest value to apply additional
whitening. If you are seeding a pseudo-random number generator,
you can use "NoDigest" for optimal performance.
The device value is as follows: choice1[/choice2[...[/choicen]]] where the choices for device value are as follows:
Crypto-J tries to instantiate a class using the first choice; if it cannot, it tries the other choices.
Note: Do not attempt to use hardware versions of Crypto-J classes unless you are
very familiar with the hardware. See the "Random Number Generation" section
of the Crypto-J Developer's Guide, which describes hardware usage,
its benefits, and its problems, as well as the Intel Security Hardware User’s
Guide.
Note: In JDK 1.1, Examples
The first example demonstrates how to build a pseudo-random object in software:
The second example demonstrates how to build a random object using the HWRandom algorithm. This object can later be used to seed a Crypto-J pseudo-random number generator (PRNG). To get a JSAFE_SecureRandom object, you should cast the result with JSAFE_SecureRandom.
If the Intel hardware is not available, Crypto-J throws a NoSuchAlgorithmException. If the Intel hardware is available, Crypto-J creates an instance of JSAFE_SecureRandom that can perform Intel random number generation. If something goes wrong after this instance has been created, Crypto-J throws an IntelException. See the Intel Security Hardware User’s Guide for further information.
|
|
|
Fills the input buffer with pseudorandom bytes.
|
|
|
Generates a pseudorandom
|
|
|
Generates a pseudorandom
|
|
|
Generates a pseudorandom
|
|
|
Generates a pseudorandom
|
|
|
Generates a pseudorandom
|
|
|
Seeds the pseudorandom number generator. This method uses the entire input buffer, and seeds an object. It uses all the bytes of the
|
|
|
Seeds the pseudorandom number generator. This method uses the entire input buffer.
|
|
|
Seeds the pseudorandom number generator with the
Reseeds this random object, using the eight bytes contained in the
|