|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.crypto.passwd.internal.AbstractMemoryHardKeyDerivationFunction
public abstract class AbstractMemoryHardKeyDerivationFunction
Abstract memory hard key derivation function. to subclass this, simply implement init(int, int, int) from MemoryHardKeyDerivationFunction and isInitialized() and deriveKey(byte[]) from KeyDerivationFunction. Be careful, this class is serializable, serialization and deserialization should yield a function which provides the same password to key mapping, and make sure fields unnecessary to this are declared transient.
| Constructor Summary | |
|---|---|
AbstractMemoryHardKeyDerivationFunction()
|
|
| Method Summary | |
|---|---|
protected int |
getDefaultDerivedKeyLength()
|
protected int |
getDefaultMillisecondsOfProcessorTime()
|
int |
getDefaultNumberOfKilobytesOfMemoryToUse()
|
void |
init()
Initialize with default values. |
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.MemoryHardKeyDerivationFunction |
|---|
init |
| Methods inherited from interface org.xwiki.crypto.passwd.KeyDerivationFunction |
|---|
deriveKey |
| Constructor Detail |
|---|
public AbstractMemoryHardKeyDerivationFunction()
| 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 KeyDerivationFunctionpublic 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.
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.public int getDefaultNumberOfKilobytesOfMemoryToUse()
protected int getDefaultMillisecondsOfProcessorTime()
protected int getDefaultDerivedKeyLength()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||