Package com.io7m.idstore.model
Interface IdPasswordAlgorithmType
- All Known Implementing Classes:
IdPasswordAlgorithmPBKDF2HmacSHA256
,IdPasswordAlgorithmRedacted
public sealed interface IdPasswordAlgorithmType
permits IdPasswordAlgorithmPBKDF2HmacSHA256, IdPasswordAlgorithmRedacted
The type of password hashing algorithms.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if the given plain text password matches the expected hash.default IdPassword
createHashed
(String passwordText) Create a hashed password with a random salt.createHashed
(String passwordText, byte[] salt) Create a hashed password.
-
Method Details
-
check
Check if the given plain text password matches the expected hash.- Parameters:
expectedHash
- The expected hexadecimal uppercase hashreceivedPassword
- The received plain text passwordsalt
- The salt value- Returns:
true
if the password matches- Throws:
IdPasswordException
- On internal errors such as missing algorithm support
-
createHashed
Create a hashed password.- Parameters:
passwordText
- The plain text passwordsalt
- A random salt value- Returns:
- A hashed password
- Throws:
IdPasswordException
- On internal errors such as missing algorithm support
-
createHashed
Create a hashed password with a random salt.- Parameters:
passwordText
- The plain text password- Returns:
- A hashed password
- Throws:
IdPasswordException
- On internal errors such as missing algorithm support
-
identifier
String identifier()- Returns:
- The password algorithm identifier
-