Class PBKDF2ParameterSpec

java.lang.Object
javax.crypto.spec.PBEParameterSpec
org.bouncycastle.jcajce.spec.PBKDF2ParameterSpec
All Implemented Interfaces:
AlgorithmParameterSpec

public class PBKDF2ParameterSpec extends PBEParameterSpec
PBEParameterSpec allowing for the use of alternate PRFs with PBKDF2.
  • Constructor Details

    • PBKDF2ParameterSpec

      public PBKDF2ParameterSpec(byte[] salt, int iterationCount, int keySize)
      Base constructor with the default PRF.
      Parameters:
      salt - salt to use.
      iterationCount - iteration count for PBE algorithm.
      keySize - keySize in bits.
    • PBKDF2ParameterSpec

      public PBKDF2ParameterSpec(byte[] salt, int iterationCount, int keySize, DigestAlgorithm prfAlgorithm)
      Constructor that allows specifying a PRF using an Algorithm.
      Parameters:
      salt - salt to use.
      iterationCount - iteration count for PBE algorithm.
      keySize - keySize in bits.
      prfAlgorithm - Algorithm identifying the PRF to use.
    • PBKDF2ParameterSpec

      public PBKDF2ParameterSpec(byte[] salt, int iterationCount, int keySize, AlgorithmIdentifier prf)
      Constructor that allows specifying a PRF.
      Parameters:
      salt - salt to use.
      iterationCount - iteration count for PBE algorithm.
      keySize - keySize in bits.
      prf - AlgorithmIdentifier for the PRF to use.
  • Method Details

    • isDefaultPrf

      public boolean isDefaultPrf()
      Return true if this spec is for the default PRF (HmacSHA1), false otherwise.
      Returns:
      true if this spec uses the default PRF, false otherwise.
    • getKeySize

      public int getKeySize()
      Return the key size (in bits) for the key to be derived.
      Returns:
      the size of the generated key required.
    • getPrf

      public AlgorithmIdentifier getPrf()
      Return an AlgorithmIdentifier representing the PRF.
      Returns:
      the PRF's AlgorithmIdentifier.