Package org.nuxeo.ecm.directory
Class PasswordHelper
- java.lang.Object
-
- org.nuxeo.ecm.directory.PasswordHelper
-
public class PasswordHelper extends Object
Helper to check passwords and generated hashed salted ones.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]digestWithSalt(String password, byte[] salt, String algorithm)static StringhashPassword(String password, String algorithm)Returns the hashed string for a password according to a given hashing algorithm.static booleanisHashed(String password)Checks if a password is already hashed.static booleanverifyPassword(String password, String hashedPassword)Verify a password against a hashed password.
-
-
-
Field Detail
-
SSHA
public static final String SSHA
- See Also:
- Constant Field Values
-
SMD5
public static final String SMD5
- See Also:
- Constant Field Values
-
-
Method Detail
-
isHashed
public static boolean isHashed(String password)
Checks if a password is already hashed.- Returns:
trueif the password is hashed
-
hashPassword
public static String hashPassword(String password, String algorithm)
Returns the hashed string for a password according to a given hashing algorithm.
-
verifyPassword
public static boolean verifyPassword(String password, String hashedPassword)
Verify a password against a hashed password.If the hashed password is
nullthen the verification always fails.- Parameters:
password- the password to verifyhashedPassword- the hashed password- Returns:
trueif the password matches
-
digestWithSalt
public static byte[] digestWithSalt(String password, byte[] salt, String algorithm)
-
-