Package org.yamcs.security
Class PBKDF2PasswordHasher
java.lang.Object
org.yamcs.security.PBKDF2PasswordHasher
- All Implemented Interfaces:
PasswordHasher
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateHash
(char[] password) Returns a salted PBKDF2 hash of the password.boolean
validatePassword
(char[] password, String correctHash) Validates a password using a hash.
-
Field Details
-
log
-
PBKDF2_ALGORITHM
- See Also:
-
SALT_BYTE_SIZE
public static final int SALT_BYTE_SIZE- See Also:
-
HASH_BYTE_SIZE
public static final int HASH_BYTE_SIZE- See Also:
-
PBKDF2_ITERATIONS
public static final int PBKDF2_ITERATIONS- See Also:
-
ITERATION_INDEX
public static final int ITERATION_INDEX- See Also:
-
SALT_INDEX
public static final int SALT_INDEX- See Also:
-
PBKDF2_INDEX
public static final int PBKDF2_INDEX- See Also:
-
-
Constructor Details
-
PBKDF2PasswordHasher
public PBKDF2PasswordHasher()
-
-
Method Details
-
createHash
Returns a salted PBKDF2 hash of the password.- Specified by:
createHash
in interfacePasswordHasher
- Parameters:
password
- the password to hash- Returns:
- a salted PBKDF2 hash of the password
-
validatePassword
Validates a password using a hash.- Specified by:
validatePassword
in interfacePasswordHasher
- Parameters:
password
- the password to checkcorrectHash
- the hash of the valid password- Returns:
- true if the password is correct, false if not
-