java.lang.Object
org.yamcs.security.PBKDF2PasswordHasher
- All Implemented Interfaces:
PasswordHasher
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final Stringstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateHash(char[] password) Returns a salted PBKDF2 hash of the password.booleanvalidatePassword(char[] password, String correctHash) Validates a password using a hash.
-
Field Details
-
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:
createHashin interfacePasswordHasher- Parameters:
password- the password to hash- Returns:
- a salted PBKDF2 hash of the password
-
validatePassword
Validates a password using a hash.- Specified by:
validatePasswordin interfacePasswordHasher- Parameters:
password- the password to checkcorrectHash- the hash of the valid password- Returns:
- true if the password is correct, false if not
-