Package org.bouncycastle.jcajce.spec
Class PBKDF2KeySpec
- java.lang.Object
-
- javax.crypto.spec.PBEKeySpec
-
- org.bouncycastle.jcajce.spec.PBKDF2KeySpec
-
- All Implemented Interfaces:
java.security.spec.KeySpec
public class PBKDF2KeySpec extends javax.crypto.spec.PBEKeySpec
PBEKeySpec allowing for the use of alternate PRFs with PBKDF2.
-
-
Constructor Summary
Constructors Constructor Description PBKDF2KeySpec(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
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.
-
-
-
Constructor Detail
-
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 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.
-
-