Package org.yamcs.security
Class PBKDF2PasswordHasher
- java.lang.Object
-
- org.yamcs.security.PBKDF2PasswordHasher
-
- All Implemented Interfaces:
PasswordHasher
public class PBKDF2PasswordHasher extends Object implements PasswordHasher
-
-
Field Summary
Fields Modifier and Type Field Description static intHASH_BYTE_SIZEstatic intITERATION_INDEXstatic StringPBKDF2_ALGORITHMstatic intPBKDF2_INDEXstatic intPBKDF2_ITERATIONSstatic intSALT_BYTE_SIZEstatic intSALT_INDEX
-
Constructor Summary
Constructors Constructor Description PBKDF2PasswordHasher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateHash(char[] password)Returns a salted PBKDF2 hash of the password.booleanvalidatePassword(char[] password, String correctHash)Validates a password using a hash.
-
-
-
Field Detail
-
PBKDF2_ALGORITHM
public static final String PBKDF2_ALGORITHM
- See Also:
- Constant Field Values
-
SALT_BYTE_SIZE
public static final int SALT_BYTE_SIZE
- See Also:
- Constant Field Values
-
HASH_BYTE_SIZE
public static final int HASH_BYTE_SIZE
- See Also:
- Constant Field Values
-
PBKDF2_ITERATIONS
public static final int PBKDF2_ITERATIONS
- See Also:
- Constant Field Values
-
ITERATION_INDEX
public static final int ITERATION_INDEX
- See Also:
- Constant Field Values
-
SALT_INDEX
public static final int SALT_INDEX
- See Also:
- Constant Field Values
-
PBKDF2_INDEX
public static final int PBKDF2_INDEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
createHash
public String createHash(char[] password)
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
public boolean validatePassword(char[] password, String correctHash)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
-
-