Package org.xwiki.crypto.password.params
Class PBKDF2Parameters
- java.lang.Object
-
- org.xwiki.crypto.password.params.KeyDerivationFunctionParameters
-
- org.xwiki.crypto.password.params.PBKDF2Parameters
-
public class PBKDF2Parameters extends KeyDerivationFunctionParameters
Key derivation function parameters for PBKDF2 functions that use an iteration count and a salt.- Since:
- 5.4M1
- Version:
- $Id: 56683fa07ee9bad6281fa9c91fca9e3d045a8503 $
-
-
Constructor Summary
Constructors Constructor Description PBKDF2Parameters()
Initialise parameters with default values.PBKDF2Parameters(int keySize)
Initialise parameters with a key length and default randomized values.PBKDF2Parameters(int keySize, byte[] salt)
Initialise parameters with a key length, a salt and a randomized iteration count.PBKDF2Parameters(int keySize, byte[] salt, String prf)
Initialise parameters with a key length, a salt, a pseudo random function and a randomized iteration count.PBKDF2Parameters(int keySize, byte[] salt, String prf, SecureRandom random)
Initialise parameters with a key length, a salt, a pseudo random function and a randomized iteration count.PBKDF2Parameters(int keySize, byte[] salt, SecureRandom random)
Initialise parameters with a key length, a salt and a randomized iteration count.PBKDF2Parameters(int keySize, int iterationCount)
Initialise parameters with a key length, fixed iteration count and a randomized salt.PBKDF2Parameters(int keySize, int iterationCount, byte[] salt)
Initialise parameters with a key length, an iteration count and a salt.PBKDF2Parameters(int keySize, int iterationCount, byte[] salt, String prf)
Initialise parameters with a key length, an iteration count and a salt.PBKDF2Parameters(int keySize, int iterationCount, String prf)
Initialise parameters with a key length, fixed iteration count, a pseudo random function and a randomized salt.PBKDF2Parameters(int keySize, int iterationCount, String prf, SecureRandom random)
Initialise parameters with a key length, fixed iteration count, a pseudo random function and a randomized salt.PBKDF2Parameters(int keySize, int iterationCount, SecureRandom random)
Initialise parameters with a key length, fixed iteration count and a randomized salt.PBKDF2Parameters(int keySize, String prf)
Initialise parameters with a key length, a pseudo random function and default randomized values.PBKDF2Parameters(int keySize, String prf, SecureRandom random)
Initialise parameters with a key length, a pseudo random function and default randomized values.PBKDF2Parameters(int keySize, SecureRandom random)
Initialise parameters with a key length and default randomized values.PBKDF2Parameters(String prf)
Initialise parameters with default or random values and the given pseudo random function.PBKDF2Parameters(String prf, SecureRandom random)
Initialise parameters with default or random values and the given pseudo random function.PBKDF2Parameters(SecureRandom random)
Initialise parameters with default values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAlgorithmName()
int
getIterationCount()
String
getPseudoRandomFuntionHint()
byte[]
getSalt()
-
Methods inherited from class org.xwiki.crypto.password.params.KeyDerivationFunctionParameters
getKeySize
-
-
-
-
Constructor Detail
-
PBKDF2Parameters
public PBKDF2Parameters()
-
PBKDF2Parameters
public PBKDF2Parameters(SecureRandom random)
Initialise parameters with default values. Salt of 16 bytes is randomized and iteration count is randomized (between 1000 and (1000 + 2000)). SHA-1 algorithm is used for the key derivation pseudo random function.- Parameters:
random
- a random source to get randomized values.
-
PBKDF2Parameters
public PBKDF2Parameters(String prf)
Initialise parameters with default or random values and the given pseudo random function. Salt of 16 bytes is randomized and iteration count is randomized (between 1000 and (1000 + 2000)).- Parameters:
prf
- a pseudo random function hint.
-
PBKDF2Parameters
public PBKDF2Parameters(String prf, SecureRandom random)
Initialise parameters with default or random values and the given pseudo random function.- Parameters:
prf
- a pseudo random function hint.random
- a random source to get randomized values.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize)
Initialise parameters with a key length and default randomized values. Salt of 16 bytes is randomized and iteration count is randomized (between 1000 and (1000 + 2000)). SHA-1 algorithm is used for the key derivation pseudo random function.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, SecureRandom random)
Initialise parameters with a key length and default randomized values. Salt of 16 bytes is randomized and iteration count is randomized (between 1000 and (1000 + 2000)). SHA-1 algorithm is used for the key derivation pseudo random function.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.random
- a random source to get randomized values.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, String prf)
Initialise parameters with a key length, a pseudo random function and default randomized values. Salt of 16 bytes is randomized and iteration count is randomized (between 1000 and (1000 + 2000)).- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.prf
- a pseudo random function hint.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, String prf, SecureRandom random)
Initialise parameters with a key length, a pseudo random function and default randomized values. Salt of 16 bytes is randomized and iteration count is randomized (between 1000 and (1000 + 2000)).- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.prf
- a pseudo random function hint.random
- a random source to get randomized values.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, int iterationCount)
Initialise parameters with a key length, fixed iteration count and a randomized salt. Salt of 16 bytes is randomized. SHA-1 algorithm is used for the key derivation pseudo random function.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.iterationCount
- the number of iterations the "mixing" function is to be applied for.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, int iterationCount, SecureRandom random)
Initialise parameters with a key length, fixed iteration count and a randomized salt. Salt of 16 bytes is randomized. SHA-1 algorithm is used for the key derivation pseudo random function.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.iterationCount
- the number of iterations the "mixing" function is to be applied for.random
- a random source to get randomized values.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, int iterationCount, String prf)
Initialise parameters with a key length, fixed iteration count, a pseudo random function and a randomized salt. Salt of 16 bytes is randomized.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.iterationCount
- the number of iterations the "mixing" function is to be applied for.prf
- a pseudo random function hint.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, int iterationCount, String prf, SecureRandom random)
Initialise parameters with a key length, fixed iteration count, a pseudo random function and a randomized salt. Salt of 16 bytes is randomized.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.iterationCount
- the number of iterations the "mixing" function is to be applied for.prf
- a pseudo random function hint.random
- a random source to get randomized values.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, byte[] salt)
Initialise parameters with a key length, a salt and a randomized iteration count. Iteration count is randomized (between 1000 and (1000 + 2000)). SHA-1 algorithm is used for the key derivation pseudo random function.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.salt
- the salt to be mixed with the password.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, byte[] salt, SecureRandom random)
Initialise parameters with a key length, a salt and a randomized iteration count. Iteration count is randomized (between 1000 and (1000 + 2000)). SHA-1 algorithm is used for the key derivation pseudo random function.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.salt
- the salt to be mixed with the password.random
- a random source to get randomized values.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, byte[] salt, String prf)
Initialise parameters with a key length, a salt, a pseudo random function and a randomized iteration count. Iteration count is randomized (between 1000 and (1000 + 2000)).- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.salt
- the salt to be mixed with the password.prf
- a pseudo random function hint.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, byte[] salt, String prf, SecureRandom random)
Initialise parameters with a key length, a salt, a pseudo random function and a randomized iteration count. Iteration count is randomized (between 1000 and (1000 + 2000)).- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.salt
- the salt to be mixed with the password.prf
- a pseudo random function hint.random
- a random source to get randomized values.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, int iterationCount, byte[] salt)
Initialise parameters with a key length, an iteration count and a salt.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.iterationCount
- the number of iterations the "mixing" function is to be applied for.salt
- the salt to be mixed with the password.
-
PBKDF2Parameters
public PBKDF2Parameters(int keySize, int iterationCount, byte[] salt, String prf)
Initialise parameters with a key length, an iteration count and a salt.- Parameters:
keySize
- Size of key to be generated in bytes. A negative value means that the key length should be smartly deducted from the context of use.iterationCount
- the number of iterations the "mixing" function is to be applied for.salt
- the salt to be mixed with the password.prf
- the pseudo random function hint to be used to retrieve the pseudo random function.
-
-
Method Detail
-
getAlgorithmName
public String getAlgorithmName()
- Overrides:
getAlgorithmName
in classKeyDerivationFunctionParameters
- Returns:
- the algorithm name (hint) of the Key Derivation Function that use these parameters.
-
getIterationCount
public int getIterationCount()
- Returns:
- the number of iterations the "mixing" function is to be applied for.
-
getSalt
public byte[] getSalt()
- Returns:
- the salt to be mixed with the password.
-
getPseudoRandomFuntionHint
public String getPseudoRandomFuntionHint()
- Returns:
- the pseudo random function hint, or null for default.
-
-