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 |
PACKET_CIPHER_ENABLE_PROP |
Modifier and Type | Method and Description |
---|---|
static void |
checkConstraints(CryptoServiceProperties cryptoService)
Check a service to make sure it meets the current constraints.
|
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 EntropySourceProvider |
getDefaultEntropySourceProvider()
Return the default entropy source for this JVM.
|
static java.lang.String |
getInfo() |
static NativeServices |
getNativeServices() |
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 |
getSecureRandom(java.security.SecureRandom secureRandom)
Return either the passed-in SecureRandom, or if it is null, then the default source of randomness.
|
static CryptoServicesConstraints |
getServicesConstraints()
Return the current algorithm/services constraints.
|
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 |
hasEnabledService(java.lang.String feature) |
static boolean |
isNativeEnabled() |
static boolean |
isPacketCipherEnabled() |
static <T> void |
setGlobalProperty(CryptoServicesRegistrar.Property property,
T... propertyValue)
Set the value of the the passed in property globally in the JVM.
|
static void |
setNativeEnabled(boolean enabled) |
static void |
setPacketCipherEnabled(boolean enabled) |
static void |
setSecureRandom(java.security.SecureRandom secureRandom)
Set a default secure random to be used where none is otherwise provided.
|
static void |
setSecureRandomProvider(SecureRandomProvider secureRandomProvider)
Set a default secure random provider to be used where none is otherwise provided.
|
static void |
setServicesConstraints(CryptoServicesConstraints constraints)
Set the current algorithm constraints.
|
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 PACKET_CIPHER_ENABLE_PROP
public static java.lang.String getInfo()
public static boolean isNativeEnabled()
public static void setNativeEnabled(boolean enabled)
public static NativeServices getNativeServices()
public static void setPacketCipherEnabled(boolean enabled)
public static boolean isPacketCipherEnabled()
public static boolean hasEnabledService(java.lang.String feature)
public static java.security.SecureRandom getSecureRandom()
public static java.security.SecureRandom getSecureRandom(java.security.SecureRandom secureRandom)
secureRandom
- the SecureRandom to use if it is not null.public static void setSecureRandom(java.security.SecureRandom secureRandom)
secureRandom
- the SecureRandom to use as the default.public static void setSecureRandomProvider(SecureRandomProvider secureRandomProvider)
secureRandomProvider
- a provider SecureRandom to use when a default SecureRandom is requested.public static EntropySourceProvider getDefaultEntropySourceProvider()
public static CryptoServicesConstraints getServicesConstraints()
public static void checkConstraints(CryptoServiceProperties cryptoService)
cryptoService
- the service to be checked.CryptoServiceConstraintsException
- if the service violates the current constraints.public static void setServicesConstraints(CryptoServicesConstraints constraints)
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.