Class SecureRandomBuilder

java.lang.Object
com.netflix.spinnaker.kork.crypto.SecureRandomBuilder

public class SecureRandomBuilder extends Object
Builder class for creating a SecureRandom instance using a deterministic random bit generator (DRBG).
See Also:
  • Constructor Details

    • SecureRandomBuilder

      public SecureRandomBuilder()
  • Method Details

    • withAlgorithm

      public SecureRandomBuilder withAlgorithm(String algorithm)
      Overrides the algorithm name to use. By default, this is DRBG.
    • withProvider

      public SecureRandomBuilder withProvider(String provider)
      Specifies a particular security provider name to use.
    • withProvider

      public SecureRandomBuilder withProvider(Provider provider)
      Specifies a particular security provider to use.
    • withStrength

      public SecureRandomBuilder withStrength(int bitStrength)
      Specifies the required security strength in bits for the built random generator. If set to -1 or otherwise left unspecified, then the default strength will be used depending on the system configuration. The default Sun provider uses a strength of 128.
      See Also:
    • withReseedSupport

      public SecureRandomBuilder withReseedSupport()
      Enables support for SecureRandom.reseed() and SecureRandom.reseed(SecureRandomParameters). Long-running use of a random generator may periodically desire reseeding from an underlying entropy source. The default Sun provider supports reseeding.
      See Also:
    • withPredictionResistance

      public SecureRandomBuilder withPredictionResistance()
      Enables support for prediction resistance (and by extension, reseeding). The default Sun provider supports prediction resistance.
      See Also:
    • withPersonalizationString

      public SecureRandomBuilder withPersonalizationString(byte[] personalizationString)
      Specifies a personalization string to use during instantiation of the random generator. A personalization string is useful for separating different uses of random generators.
      See Also:
    • withPersonalizationString

      public SecureRandomBuilder withPersonalizationString(String personalizationString)
      Specifies a personalization string which is converted to UTF-8.
      See Also:
    • build

      public SecureRandom build()
      Creates a random generator using the settings from this builder.
    • create

      public static SecureRandomBuilder create()
      Creates a new builder for SecureRandom instances.