public final class CryptoServicesRegistrar
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CryptoServicesRegistrar.Property
Available properties that can be set.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MODULE_HMAC_KEY |
Modifier and Type | Method and Description |
---|---|
static <T> T[] |
clearGlobalProperty(CryptoServicesRegistrar.Property property)
Clear the global value for the passed in property.
|
static <T> T[] |
clearThreadProperty(CryptoServicesRegistrar.Property property)
Clear the thread local value for the passed in property.
|
static <T> T |
getProperty(CryptoServicesRegistrar.Property property)
Return the default value for a particular property if one exists.
|
static java.security.SecureRandom |
getSecureRandom()
Return the default source of randomness.
|
static java.security.SecureRandom |
getSecureRandomIfSet(SecureRandomProvider secureRandomProvider)
If the default source of randomness is not set, return a SecureRandom generated from the
passed in SecureRandomProvider.
|
static <T> T[] |
getSizedProperty(CryptoServicesRegistrar.Property property)
Return an array representing the current values for a sized property such as DH_DEFAULT_PARAMS or
DSA_DEFAULT_PARAMS.
|
static <T> T |
getSizedProperty(CryptoServicesRegistrar.Property property,
int size)
Return the value for a specific size for a sized property such as DH_DEFAULT_PARAMS or
DSA_DEFAULT_PARAMS.
|
static boolean |
isInApprovedOnlyMode()
Return true or false depending on whether the current thread is in approved mode.
|
static boolean |
setApprovedOnlyMode(boolean isApprovedOnly)
Set the calling thread's approved mode status.
|
static <T> void |
setGlobalProperty(CryptoServicesRegistrar.Property property,
T... propertyValue)
Set the value of the the passed in property globally in the JVM.
|
static void |
setSecureRandom(java.security.SecureRandom secureRandom)
Set a default secure random to be used where none is otherwise provided.
|
static <T> void |
setThreadProperty(CryptoServicesRegistrar.Property property,
T... propertyValue)
Set the value of the the passed in property on the current thread only.
|
public static final java.lang.String MODULE_HMAC_KEY
public static boolean setApprovedOnlyMode(boolean isApprovedOnly)
Note: a thread cannot move to unapproved mode once it has moved into approved mode.
isApprovedOnly
- true if should be approved mode, false otherwise.public static boolean isInApprovedOnlyMode()
public static java.security.SecureRandom getSecureRandom()
java.lang.IllegalStateException
- if no source of randomness has been provided.public static java.security.SecureRandom getSecureRandomIfSet(SecureRandomProvider secureRandomProvider)
secureRandomProvider
- the provider of SecureRandom to use if no default is provided.public static void setSecureRandom(java.security.SecureRandom secureRandom)
secureRandom
- the SecureRandom to use as the default.public static <T> T getProperty(CryptoServicesRegistrar.Property property)
T
- the type to be returnedproperty
- the property to look up.public static <T> T[] getSizedProperty(CryptoServicesRegistrar.Property property)
T
- the base type of the array to be returned.property
- the name of the property to look up.public static <T> T getSizedProperty(CryptoServicesRegistrar.Property property, int size)
T
- the type of the value to be returned.property
- the name of the property to look up.size
- the size (in bits) of the defining value in the property type.public static <T> void setThreadProperty(CryptoServicesRegistrar.Property property, T... propertyValue)
T
- the base type of the property value.property
- the name of the property to set.propertyValue
- the values to assign to the property.public static <T> void setGlobalProperty(CryptoServicesRegistrar.Property property, T... propertyValue)
T
- the base type of the property value.property
- the name of the property to set.propertyValue
- the values to assign to the property.public static <T> T[] clearGlobalProperty(CryptoServicesRegistrar.Property property)
T
- the base type of the property valueproperty
- the property to be cleared.public static <T> T[] clearThreadProperty(CryptoServicesRegistrar.Property property)
T
- the base type of the property valueproperty
- the property to be cleared.