|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.crypto.passwd.internal.AbstractKeyDerivationFunction
public abstract class AbstractKeyDerivationFunction
The abstract key derivation function. Provides guess/trial based determination of the correct number of iterations for a given processor time requirement.
| Constructor Summary | |
|---|---|
AbstractKeyDerivationFunction()
|
|
| Method Summary | |
|---|---|
protected int |
getDefaultDerivedKeyLength()
|
protected int |
getDefaultMillisecondsOfProcessorTime()
|
void |
init()
Initialize with default values. |
abstract void |
init(byte[] salt,
int iterationCount,
int derivedKeyLength)
Initialize the function manually. |
void |
init(int millisecondsOfProcessorTimeToSpend,
int derivedKeyLength)
Initialize this function with the desired key length and processor cost. |
void |
init(java.util.Properties parameters)
Initialize this function with the desired key length and processor cost as a Properties
The properties which will be looked for are millisecondsOfProcessorTimeToSpend and derivedKeyLength. |
byte[] |
serialize()
Store this function as a byte array so another function of the same class can be initialized with the same array and will then produce the same key for the given password. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.xwiki.crypto.passwd.KeyDerivationFunction |
|---|
deriveKey |
| Constructor Detail |
|---|
public AbstractKeyDerivationFunction()
| Method Detail |
|---|
public byte[] serialize()
throws java.io.IOException
serialize in interface KeyDerivationFunctionjava.io.IOException - if something fails within the serialization framework.public void init()
init in interface KeyDerivationFunctionKeyDerivationFunction.init()public void init(java.util.Properties parameters)
Properties
The properties which will be looked for are millisecondsOfProcessorTimeToSpend and derivedKeyLength.
Both will be parsed as Integers. If either or both are missing then default values will be used.
If values are not integers or are invalid, an IllegalArgumentException will throw.
init in interface KeyDerivationFunctionparameters - A properties expected to contain millisecondsOfProcessorTimeToSpend and
derivedKeyLength which are both expected to parse as integers.KeyDerivationFunction.init(Properties)
public void init(int millisecondsOfProcessorTimeToSpend,
int derivedKeyLength)
init in interface KeyDerivationFunctionmillisecondsOfProcessorTimeToSpend - number of milliseconds to spend hashing the password.
Based on this number and the power of the processor this is running on
a number of iterations will be derived. This number will dictate how
difficult hashing will be and also how difficult it will be to guess
the password using cracking technology.derivedKeyLength - the desired length of the hash output.KeyDerivationFunction.init(int, int)
public abstract void init(byte[] salt,
int iterationCount,
int derivedKeyLength)
salt - the random salt to add to the password before hashing.iterationCount - the number of iterations which the internal function should run.derivedKeyLength - the number of bytes of length the derived key should be (dkLen)protected int getDefaultMillisecondsOfProcessorTime()
protected int getDefaultDerivedKeyLength()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||