public class SimplePBKDF2 extends PBKDF2Engine
| Modifier and Type | Field and Description |
|---|---|
protected PBKDF2Formatter |
formatter |
protected int |
saltSize |
protected java.security.SecureRandom |
sr |
parameters, prf| Modifier | Constructor and Description |
|---|---|
|
SimplePBKDF2()
Constructor for PBKDF2 implementation object that uses defaults.
|
|
SimplePBKDF2(int saltSize,
int iterationCount)
Constructor for PBKDF2 implementation object.
|
protected |
SimplePBKDF2(int saltSize,
PBKDF2Parameters parameters)
Extension point.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
deriveKeyFormatted(java.lang.String inputPassword)
Derive key from password, then format.
|
protected byte[] |
generateSalt()
Generate Salt.
|
PBKDF2Formatter |
getFormatter() |
int |
getSaltSize() |
void |
setFormatter(PBKDF2Formatter formatter) |
void |
setSaltSize(int saltSize)
Set the desired salt size.
|
boolean |
verifyKeyFormatted(java.lang.String formatted,
java.lang.String candidatePassword)
Verification function.
|
_F, assertPRF, ceil, deriveKey, deriveKey, getParameters, getPseudoRandomFunction, INT, main, PBKDF2, setParameters, setPseudoRandomFunction, verifyKey, xorprotected int saltSize
protected java.security.SecureRandom sr
protected PBKDF2Formatter formatter
public SimplePBKDF2()
protected SimplePBKDF2(int saltSize,
PBKDF2Parameters parameters)
saltSize - Salt size.parameters - Parameters object.public SimplePBKDF2(int saltSize,
int iterationCount)
saltSize - Salt size.iterationCount - Iteration count.public PBKDF2Formatter getFormatter()
public void setFormatter(PBKDF2Formatter formatter)
public int getSaltSize()
public void setSaltSize(int saltSize)
saltSize - Must be positive. Zero or less are rejected.public java.lang.String deriveKeyFormatted(java.lang.String inputPassword)
inputPassword - The password to derive key from.protected byte[] generateSalt()
public boolean verifyKeyFormatted(java.lang.String formatted,
java.lang.String candidatePassword)
formatted - "salt:iteration-count:derived-key" (depends on
effective formatter). This value should come from server-side
storage.candidatePassword - The password that is checked against the formatted reference
data. This value will usually be supplied by the
"user" or "client".true verification OK. false
verification failed or formatter unable to decode input value as
PBKDF2 parameters.