Class PBKDF2KeySpec

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

    public class PBKDF2KeySpec
    extends javax.crypto.spec.PBEKeySpec
    Extension of PBEKeySpec which takes into account the PRF algorithm setting available in PKCS#5 PBKDF2.
    • Constructor Summary

      Constructors 
      Constructor Description
      PBKDF2KeySpec​(char[] password, byte[] salt, int iterationCount, int keySize, AlgorithmIdentifier prf)
      Base constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.PBEKeySpec

        clearPassword, getIterationCount, getKeyLength, getPassword, getSalt
      • Methods inherited from class java.lang.Object

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

      • PBKDF2KeySpec

        public PBKDF2KeySpec​(char[] password,
                             byte[] salt,
                             int iterationCount,
                             int keySize,
                             AlgorithmIdentifier prf)
        Base constructor.
        Parameters:
        password - password to use as the seed of the PBE key generator.
        salt - salt to use in the generator,
        iterationCount - iteration count to use in the generator.
        keySize - size of the key to be generated (in bits).
        prf - identifier and parameters for the PRF algorithm 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.
      • getPrf

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