Package org.bouncycastle.jcajce.spec
Class PBKDF2KeySpec
java.lang.Object
javax.crypto.spec.PBEKeySpec
org.bouncycastle.jcajce.spec.PBKDF2KeySpec
- All Implemented Interfaces:
KeySpec
PBEKeySpec allowing for the use of alternate PRFs with PBKDF2.
-
Constructor Summary
ConstructorsConstructorDescriptionPBKDF2KeySpec
(char[] password, byte[] salt, int iterationCount, int keySize) Base constructor with the default PRF.PBKDF2KeySpec
(char[] password, byte[] salt, int iterationCount, int keySize, AlgorithmIdentifier prf) Constructor that allows specifying a PRF.PBKDF2KeySpec
(char[] password, byte[] salt, int iterationCount, int keySize, DigestAlgorithm prfAlgorithm) Constructor that allows specifying a PRF using an Algorithm. -
Method Summary
Modifier and TypeMethodDescriptiongetPrf()
Return an AlgorithmIdentifier representing the PRF.boolean
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
-
Constructor Details
-
PBKDF2KeySpec
public PBKDF2KeySpec(char[] password, byte[] salt, int iterationCount, int keySize) Base constructor with the default PRF.- Parameters:
password
- password.salt
- salt to use.iterationCount
- iteration count for PBE algorithm.keySize
- keySize in bits.
-
PBKDF2KeySpec
public PBKDF2KeySpec(char[] password, byte[] salt, int iterationCount, int keySize, DigestAlgorithm prfAlgorithm) Constructor that allows specifying a PRF using an Algorithm.- Parameters:
password
- password.salt
- salt to use.iterationCount
- iteration count for PBE algorithm.keySize
- keySize in bits.prfAlgorithm
- Algorithm identifying the PRF to use.
-
PBKDF2KeySpec
public PBKDF2KeySpec(char[] password, byte[] salt, int iterationCount, int keySize, AlgorithmIdentifier prf) Constructor that allows specifying a PRF.- Parameters:
password
- password.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.
-
getPrf
Return an AlgorithmIdentifier representing the PRF.- Returns:
- the PRF's AlgorithmIdentifier.
-