Package org.bouncycastle.jcajce.spec
Class PBKDF2ParameterSpec
java.lang.Object
javax.crypto.spec.PBEParameterSpec
org.bouncycastle.jcajce.spec.PBKDF2ParameterSpec
- All Implemented Interfaces:
AlgorithmParameterSpec
PBEParameterSpec allowing for the use of alternate PRFs with PBKDF2.
-
Constructor Summary
ConstructorsConstructorDescriptionPBKDF2ParameterSpec
(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
Modifier and TypeMethodDescriptionint
Return the key size (in bits) for the key to be derived.getPrf()
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.PBEParameterSpec
getIterationCount, getParameterSpec, getSalt
-
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
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
Return an AlgorithmIdentifier representing the PRF.- Returns:
- the PRF's AlgorithmIdentifier.
-