Class PBKDF2ParameterSpec

  • All Implemented Interfaces:
    java.security.spec.AlgorithmParameterSpec

    public class PBKDF2ParameterSpec
    extends javax.crypto.spec.PBEParameterSpec
    PBEParameterSpec allowing for the use of alternate PRFs with PBKDF2.
    • Constructor Summary

      Constructors 
      Constructor Description
      PBKDF2ParameterSpec​(byte[] salt, int iterationCount, int keySize)
      Base constructor with the default PRF.
      PBKDF2ParameterSpec​(byte[] salt, int iterationCount, int keySize, AlgorithmIdentifier prf)
      Constructor that allows specifying a PRF.
      PBKDF2ParameterSpec​(byte[] salt, int iterationCount, int keySize, DigestAlgorithm prfAlgorithm)
      Constructor that allows specifying a PRF using an Algorithm.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getKeySize()
      Return the key size (in bits) for the key to be derived.
      AlgorithmIdentifier getPrf()
      Return an AlgorithmIdentifier representing the PRF.
      boolean isDefaultPrf()
      Return true if this spec is for the default PRF (HmacSHA1), false otherwise.
      • Methods inherited from class javax.crypto.spec.PBEParameterSpec

        getIterationCount, getParameterSpec, getSalt
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

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