Class FipsDRBG.Builder

java.lang.Object
org.bouncycastle.crypto.fips.FipsDRBG.Builder
Enclosing class:
FipsDRBG

public static class FipsDRBG.Builder extends Object
Builder for SecureRandom objects based on the FIPS DRBGs.
  • Method Details

    • setPersonalizationString

      public FipsDRBG.Builder setPersonalizationString(byte[] personalizationString)
      Set the personalization string for DRBG SecureRandoms created by this builder
      Parameters:
      personalizationString - the personalisation string for the underlying DRBG.
      Returns:
      the current Builder instance.
    • setSecurityStrength

      public FipsDRBG.Builder setSecurityStrength(int securityStrength)
      Set the security strength required for DRBGs used in building SecureRandom objects.
      Parameters:
      securityStrength - the security strength (in bits)
      Returns:
      the current Builder instance.
    • setEntropyBitsRequired

      public FipsDRBG.Builder setEntropyBitsRequired(int entropyBitsRequired)
      Set the amount of entropy bits required for seeding and reseeding DRBGs used in building SecureRandom objects.
      Parameters:
      entropyBitsRequired - the number of bits of entropy to be requested from the entropy source on each seed/reseed.
      Returns:
      the current Builder instance.
    • build

      public FipsSecureRandom build(byte[] nonce, boolean predictionResistant)
      Build a SecureRandom based on a SP 800-90A DRBG.
      Parameters:
      nonce - nonce value to use in DRBG construction.
      predictionResistant - specify whether the underlying DRBG in the resulting SecureRandom should reseed on each request for bytes.
      Returns:
      a SecureRandom supported by a DRBG.
    • build

      public FipsSecureRandom build(byte[] nonce, boolean predictionResistant, byte[] additionalInput)
      Build a SecureRandom based on a SP 800-90A DRBG.
      Parameters:
      nonce - nonce value to use in DRBG construction.
      predictionResistant - specify whether the underlying DRBG in the resulting SecureRandom should reseed on each request for bytes.
      additionalInput - initial additional input to be used for generating the initial continuous health check block by the DRBG.
      Returns:
      a SecureRandom supported by a DRBG.