Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.84
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.bouncycastle.crypto
Class CryptoServicesRegistrar

    java.lang.Object
      org.bouncycastle.crypto.CryptoServicesRegistrar

public final class CryptoServicesRegistrar
extends java.lang.Object

Basic registrar class for providing defaults for cryptography services in this module.

Nested Class Summary
`static class` | `CryptoServicesRegistrar.Property` Available properties that can be set.

Method Summary
`static void` | `checkConstraints(CryptoServiceProperties cryptoService)` Check a service to make sure it meets the current constraints.
`static java.lang.Object[]` | `clearGlobalProperty(CryptoServicesRegistrar.Property property)` Clear the global value for the passed in property.
`static java.lang.Object[]` | `clearThreadProperty(CryptoServicesRegistrar.Property property)` Clear the thread local value for the passed in property.
`static java.lang.Object` | `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 java.lang.Object[]` | `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 java.lang.Object` | `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 void` | `setGlobalProperty(CryptoServicesRegistrar.Property property, java.lang.Object[] 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 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 void` | `setThreadProperty(CryptoServicesRegistrar.Property property, java.lang.Object[] propertyValue)` Set the value of the the passed in property on the current thread only.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getSecureRandom

    public static java.security.SecureRandom getSecureRandom()

  Return the default source of randomness.

  Returns:
    the default SecureRandom

### getSecureRandom

    public 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.

  Parameters:
    `secureRandom` - the SecureRandom to use if it is not null.
  Returns:
    the SecureRandom parameter if it is not null, or else the default SecureRandom

### setSecureRandom

    public static void setSecureRandom(java.security.SecureRandom secureRandom)

  Set a default secure random to be used where none is otherwise provided.

  Parameters:
    `secureRandom` - the SecureRandom to use as the default.

### setSecureRandomProvider

    public static void setSecureRandomProvider(SecureRandomProvider secureRandomProvider)

  Set a default secure random provider to be used where none is otherwise provided.

  Parameters:
    `secureRandomProvider` - a provider SecureRandom to use when a default SecureRandom is requested.

### getServicesConstraints

    public static CryptoServicesConstraints getServicesConstraints()

  Return the current algorithm/services constraints.

  Returns:
    the algorithm/services constraints.

### checkConstraints

    public static void checkConstraints(CryptoServiceProperties cryptoService)

  Check a service to make sure it meets the current constraints.

  Parameters:
    `cryptoService` - the service to be checked.
  Throws:
    `CryptoServiceConstraintsException` - if the service violates the current constraints.

### setServicesConstraints

    public static void setServicesConstraints(CryptoServicesConstraints constraints)

  Set the current algorithm constraints.

### getProperty

    public static java.lang.Object getProperty(CryptoServicesRegistrar.Property property)

  Return the default value for a particular property if one exists. The look up is done on the thread's local configuration first and then on the global configuration in no local configuration exists.

  Parameters:
    `property` - the property to look up.
  Returns:
    null if the property is not set, the default value otherwise,

### getSizedProperty

    public static java.lang.Object[] getSizedProperty(CryptoServicesRegistrar.Property property)

  Return an array representing the current values for a sized property such as DH_DEFAULT_PARAMS or DSA_DEFAULT_PARAMS.

  Parameters:
    `property` - the name of the property to look up.
  Returns:
    null if the property is not set, an array of the current values otherwise.

### getSizedProperty

    public static java.lang.Object 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.

  Parameters:
    `property` - the name of the property to look up.
    `size` - the size (in bits) of the defining value in the property type.
  Returns:
    the current value for the size, null if there is no value set,

### setThreadProperty

    public static void setThreadProperty(CryptoServicesRegistrar.Property property,
                                         java.lang.Object[] propertyValue)

  Set the value of the the passed in property on the current thread only. More than one value can be passed in for a sized property. If more than one value is provided the first value in the argument list becomes the default value.

  Parameters:
    `property` - the name of the property to set.
    `propertyValue` - the values to assign to the property.

### setGlobalProperty

    public static void setGlobalProperty(CryptoServicesRegistrar.Property property,
                                         java.lang.Object[] propertyValue)

  Set the value of the the passed in property globally in the JVM. More than one value can be passed in for a sized property. If more than one value is provided the first value in the argument list becomes the default value.

  Parameters:
    `property` - the name of the property to set.
    `propertyValue` - the values to assign to the property.

### clearGlobalProperty

    public static java.lang.Object[] clearGlobalProperty(CryptoServicesRegistrar.Property property)

  Clear the global value for the passed in property.

  Parameters:
    `property` - the property to be cleared.
  Returns:
    an array of T if a value was previously set, null otherwise.

### clearThreadProperty

    public static java.lang.Object[] clearThreadProperty(CryptoServicesRegistrar.Property property)

  Clear the thread local value for the passed in property.

  Parameters:
    `property` - the property to be cleared.
  Returns:
    an array of T if a value was previously set, null otherwise.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography Library 1.84
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD