Class LLPasswordAlgorithmPBKDF2HmacSHA256
java.lang.Object
com.io7m.looseleaf.security.LLPasswordAlgorithmPBKDF2HmacSHA256
- All Implemented Interfaces:
LLPasswordAlgorithmType
public final class LLPasswordAlgorithmPBKDF2HmacSHA256
extends Object
implements LLPasswordAlgorithmType
The PBKDF2 hashing algorithm using a SHA-256 HMAC.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if the given plain text password matches the expected hash.static LLPasswordAlgorithmTypecreate()Create an algorithm with a strong iteration count and key length.static LLPasswordAlgorithmTypecreate(int iterationCount, int keyLength) Create an algorithm with the given iteration count and key length.createHashed(String passwordText, byte[] salt) Create a hashed password.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface LLPasswordAlgorithmType
createHashed
-
Method Details
-
create
Create an algorithm with the given iteration count and key length.- Parameters:
iterationCount- The iteration countkeyLength- The key length- Returns:
- An algorithm
-
create
Create an algorithm with a strong iteration count and key length.- Returns:
- An algorithm
-
check
public boolean check(String expectedHash, String receivedPassword, byte[] salt) throws LLPasswordException Description copied from interface:LLPasswordAlgorithmTypeCheck if the given plain text password matches the expected hash.- Specified by:
checkin interfaceLLPasswordAlgorithmType- Parameters:
expectedHash- The expected hexadecimal uppercase hashreceivedPassword- The received plain text passwordsalt- The salt value- Returns:
trueif the password matches- Throws:
LLPasswordException- On com.io7m.looseleaf.cmdline.internal errors such as missing algorithm support
-
createHashed
Description copied from interface:LLPasswordAlgorithmTypeCreate a hashed password.- Specified by:
createHashedin interfaceLLPasswordAlgorithmType- Parameters:
passwordText- The plain text passwordsalt- A random salt value- Returns:
- A hashed password
- Throws:
LLPasswordException- On com.io7m.looseleaf.cmdline.internal errors such as missing algorithm support
-
identifier
- Specified by:
identifierin interfaceLLPasswordAlgorithmType- Returns:
- The password algorithm identifier
-