public class PasswordUtil extends Object
Constructor and Description |
---|
PasswordUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
encryptPassword(String password,
String salt)
Encrypts the given password using SHA1 using the given salt.
|
static boolean |
verifyPassword(String password,
String passwordHash,
String passwordSalt)
Verifies if given password is correct and returns
true if the
password is correct, otherwise returns false . |
public static boolean verifyPassword(String password, String passwordHash, String passwordSalt)
true
if the
password is correct, otherwise returns false
.password
- The password to verify in its plain form. Cannot be null
.passwordHash
- The password to verify against in its hashed (and salted)
form. Cannot be null
.passwordSalt
- The password salt. Cannot be null
.true
if the password is correct, otherwise it returns
false
.NullPointerException
- if any of the arguments is nullpublic static String encryptPassword(String password, String salt)
password
- the password to encryptsalt
- the salt to be usedNullPointerException
- if any of the arguments is nullCopyright © 2007-2018 Whitestein Technologies. All Rights Reserved.