Package com.mku.salmon.password
Interface IPbkdfProvider
-
- All Known Implementing Classes:
DefaultPbkdfProvider
public interface IPbkdfProviderProvides key derivation based on text passwords.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPBKDF_SHA256Cipher key for SHA256.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]getKey(java.lang.String password, byte[] salt, int iterations, int outputBytes, PbkdfAlgo pbkdfAlgo)Get a key derived from a text password.static java.lang.StringgetPbkdfAlgoString(PbkdfAlgo pbkdfAlgo)Get the PBKDF cipher algorithm string.
-
-
-
Field Detail
-
PBKDF_SHA256
static final java.lang.String PBKDF_SHA256
Cipher key for SHA256. See javax.crypto.SecretKeyFactory.- See Also:
- Constant Field Values
-
-
Method Detail
-
getPbkdfAlgoString
static java.lang.String getPbkdfAlgoString(PbkdfAlgo pbkdfAlgo)
Get the PBKDF cipher algorithm string.- Parameters:
pbkdfAlgo- The PBKDF algorithm to use- Returns:
- The cipher algorithm string. See javax.crypto.SecretKeyFactory.
-
getKey
byte[] getKey(java.lang.String password, byte[] salt, int iterations, int outputBytes, PbkdfAlgo pbkdfAlgo)Get a key derived from a text password.- Parameters:
password- The text password.salt- The salt needs to be at least 24 bytes.iterations- Iterations to use. Make sure you use a high number according to your hardware specs.outputBytes- The length of the output key.pbkdfAlgo- The PBKDF algorithm to use- Returns:
- The key.
- Throws:
SecurityException- Thrown if there is a security exception
-
-