Package org.jasypt.util.password
Class StrongPasswordEncryptor
- Object
-
- org.jasypt.util.password.StrongPasswordEncryptor
-
- All Implemented Interfaces:
PasswordEncryptor
public final class StrongPasswordEncryptor extends Object implements PasswordEncryptor
Utility class for easily performing high-strength password digesting and checking.
This class internally holds a
StandardStringDigesterconfigured this way:- Algorithm: SHA-256.
- Salt size: 16 bytes.
- Iterations: 100000.
The required steps to use it are:
- Create an instance (using new).
- Perform the desired
encryptPassword(String)orcheckPassword(String, String)operations.
This class is thread-safe
- Since:
- 1.2 (class existed in org.jasypt.util package since 1.1)
- Author:
- Daniel Fernández
-
-
Constructor Summary
Constructors Constructor Description StrongPasswordEncryptor()Creates a new instance of StrongPasswordEncryptor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckPassword(String plainPassword, String encryptedPassword)Checks an unencrypted (plain) password against an encrypted one (a digest) to see if they match.StringencryptPassword(String password)Encrypts (digests) a password.
-
-
-
Method Detail
-
encryptPassword
public String encryptPassword(String password)
Encrypts (digests) a password.- Specified by:
encryptPasswordin interfacePasswordEncryptor- Parameters:
password- the password to be encrypted.- Returns:
- the resulting digest.
- See Also:
StandardStringDigester.digest(String)
-
checkPassword
public boolean checkPassword(String plainPassword, String encryptedPassword)Checks an unencrypted (plain) password against an encrypted one (a digest) to see if they match.- Specified by:
checkPasswordin interfacePasswordEncryptor- Parameters:
plainPassword- the plain password to check.encryptedPassword- the digest against which to check the password.- Returns:
- true if passwords match, false if not.
- See Also:
StandardStringDigester.matches(String, String)
-
-