public class CryptoRandomFactory extends Object
CryptoRandom
instancesModifier and Type | Class and Description |
---|---|
static class |
CryptoRandomFactory.RandomProvider
Defines the internal CryptoRandom implementations.
|
Modifier and Type | Field and Description |
---|---|
static String |
CLASSES_KEY
The configuration key of the CryptoRandom implementation class.
|
static String |
DEVICE_FILE_PATH_DEFAULT
The default value ("/dev/urandom") of the file path for secure random device.
|
static String |
DEVICE_FILE_PATH_KEY
The configuration key of the file path for secure random device.
|
static String |
JAVA_ALGORITHM_DEFAULT
The default value ("SHA1PRNG") of the algorithm of secure random.
|
static String |
JAVA_ALGORITHM_KEY
The configuration key of the algorithm of secure random.
|
Modifier and Type | Method and Description |
---|---|
static CryptoRandom |
getCryptoRandom()
Gets a CryptoRandom instance using the default implementation
as defined by
CLASSES_DEFAULT |
static CryptoRandom |
getCryptoRandom(Properties props)
Gets a CryptoRandom instance for specified props.
|
public static final String DEVICE_FILE_PATH_KEY
public static final String DEVICE_FILE_PATH_DEFAULT
public static final String JAVA_ALGORITHM_KEY
public static final String JAVA_ALGORITHM_DEFAULT
public static final String CLASSES_KEY
The value of the CLASSES_KEY needs to be the full name of a
class that implements the
CryptoRandom
interface
The internal classes are listed in the enum
RandomProvider
which can be used to obtain the full class name.
The value can also be a comma-separated list of class names in order of descending priority.
public static CryptoRandom getCryptoRandom() throws GeneralSecurityException
CLASSES_DEFAULT
GeneralSecurityException
- if cannot create the CryptoRandom
classpublic static CryptoRandom getCryptoRandom(Properties props) throws GeneralSecurityException
props
- the configuration properties.GeneralSecurityException
- if cannot create the CryptoRandom
classIllegalArgumentException
- if no classname(s) are providedCopyright © 2016–2022 The Apache Software Foundation. All rights reserved.