Class SecureRandomFactoryBean

java.lang.Object
ch.qos.logback.core.net.ssl.SecureRandomFactoryBean

public class SecureRandomFactoryBean extends Object
A factory bean for a JCA SecureRandom generator.

This object holds the configurable properties of a secure random generator and uses them to create and load a SecureRandom instance.

Author:
Carl Harris
  • Constructor Details

    • SecureRandomFactoryBean

      public SecureRandomFactoryBean()
  • Method Details

    • createSecureRandom

      public SecureRandom createSecureRandom() throws NoSuchProviderException, NoSuchAlgorithmException
      Creates a new SecureRandom generator using the receiver's configuration.
      Returns:
      secure random generator instance
      Throws:
      NoSuchProviderException - if the provider name specified by setProvider(String) is not known to the platform
      NoSuchAlgorithmException - if the algorithm name specified by setAlgorithm(String) is not recognized by the specified provider (or the platform's default provider if the provider isn't specified)
    • getAlgorithm

      public String getAlgorithm()
      Gets the secure random generator algorithm name.
      Returns:
      an algorithm name (e.g. SHA1PRNG); the SSL.DEFAULT_SECURE_RANDOM_ALGORITHM is returned if no algorithm has been specified
    • setAlgorithm

      public void setAlgorithm(String algorithm)
      Sets the secure random generator algorithm name.
      Parameters:
      algorithm - an algorithm name, which must be recognized by the provider specified via setProvider(String) or by the platform's default provider if no provider is specified.
    • getProvider

      public String getProvider()
      Gets the JCA provider name for the secure random generator.
      Returns:
      provider name
    • setProvider

      public void setProvider(String provider)
      Sets the JCA provider name for the secure random generator.
      Parameters:
      provider - name of the JCA provider to utilize in creating the secure random generator