|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavacard.security.RandomData
@TransactionType(value=SUPPORTS) public abstract class RandomData
The RandomData
abstract class is the base class for random
number generation. Implementations of RandomData
algorithms
must extend this class and implement all the abstract methods.
Field Summary | |
---|---|
static byte |
ALG_PSEUDO_RANDOM
Utility pseudo-random number generation algorithms. |
static byte |
ALG_SECURE_RANDOM
Cryptographically secure random number generation algorithms. |
static String |
SERVICE_NAME
This cryptographic service name, as used to lookup implemented algorithms. |
Constructor Summary | |
---|---|
protected |
RandomData()
Protected constructor for subclassing. |
Method Summary | |
---|---|
abstract void |
generateData(byte[] buffer,
short offset,
short length)
Generates random data. |
static RandomData |
getInstance(byte algorithm)
Creates a RandomData instance of the selected algorithm. |
static RandomData |
getInstance(String algorithm)
Creates a RandomData instance of the selected algorithm. |
static RandomData |
getInstance(String algorithm,
String provider)
Creates a RandomData instance of the selected algorithm. |
abstract void |
setSeed(byte[] buffer,
short offset,
short length)
Seeds the random data generator. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SERVICE_NAME
public static final byte ALG_PSEUDO_RANDOM
Even if a transaction is in progress, the update of the internal state shall not participate in the transaction.
The String
name equivalent to this algorithm type to use
as parameter to the getInstance(String algorithm, ...)
method is "PSEUDO_RANDOM"
public static final byte ALG_SECURE_RANDOM
The String
name equivalent to this algorithm type to use
as parameter to the getInstance(String algorithm, ...)
method is "SECURE_RANDOM"
Constructor Detail |
---|
protected RandomData()
Method Detail |
---|
public static final RandomData getInstance(byte algorithm) throws CryptoException
RandomData
instance of the selected algorithm.
The pseudo random RandomData
instance's seed is
initialized to a internal default value.
This method returns an instance of the specified algorithm
supported by the most preferred provider of this cryptographic service.
Note that the list of installed providers may be retrieved via
the CryptoServices.getProviders()
method.
A call to this method is equivalent to a call to getInstance(java.lang.String)
with the algorithm
parameter set to the equivalent String
algorithm name - as listed in the ALG_*
constants above.
algorithm
- the desired random number algorithm. Valid codes listed in
ALG_*
constants above. See
ALG_PSEUDO_RANDOM
.
RandomData
object instance of the requested
algorithm
CryptoException
- with the following reason codes:
CryptoException.NO_SUCH_ALGORITHM
if
the requested algorithm is not supported.
SecurityException
- if creating an instance of this cryptographic service is
not granted.public static final RandomData getInstance(String algorithm) throws CryptoException
RandomData
instance of the selected algorithm.
The pseudo random RandomData
instance's seed is
initialized to a internal default value.
This method returns an instance of the specified algorithm
supported by the most preferred provider of this cryptographic service.
Note that the list of installed providers may be retrieved via
the CryptoServices.getProviders()
method.
algorithm
- the desired random number algorithm name. Valid names listed
in ALG_*
constants above. See
ALG_PSEUDO_RANDOM
.
RandomData
object instance of the requested
algorithm
CryptoException
- with the following reason codes:
CryptoException.NO_SUCH_ALGORITHM
if
the requested algorithm is not supported.
NullPointerException
- if algorithm
is null.
SecurityException
- if creating an instance of this cryptographic service is
not granted.public static final RandomData getInstance(String algorithm, String provider) throws CryptoException
RandomData
instance of the selected algorithm.
The pseudo random RandomData
instance's seed is
initialized to a internal default value.
algorithm
- the desired random number algorithm name. Valid names listed
in ALG_*
constants above. See
ALG_PSEUDO_RANDOM
.provider
- the desired key agreement algorithm provider.
RandomData
object instance of the requested
algorithm
CryptoException
- with the following reason codes:
CryptoException.NO_SUCH_ALGORITHM
if
the requested algorithm is not supported.
NullPointerException
- if algorithm
or provider
is
null.
SecurityException
- if creating an instance of this cryptographic service is
not granted.public abstract void generateData(byte[] buffer, short offset, short length) throws CryptoException
buffer
- the output bufferoffset
- the offset into the output bufferlength
- the length of random data to generate
CryptoException
- with the following reason codes:
CryptoException.ILLEGAL_VALUE
if the
length
parameter is zero.
public abstract void setSeed(byte[] buffer, short offset, short length)
buffer
- the input bufferoffset
- the offset into the input bufferlength
- the length of the seed data
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |