public class Pbkdf2PasswordEncoder extends Object
Encoder that uses PBKDF2 function to cryptographically derive passwords.
Passwords are returned with a Base64 encoding.
Modifier and Type | Field and Description |
---|---|
static String |
PBKDF2_ALGORITHM |
static String |
RNG_ALGORITHM |
Constructor and Description |
---|
Pbkdf2PasswordEncoder(byte[] salt) |
Pbkdf2PasswordEncoder(byte[] salt,
int iterations) |
Modifier and Type | Method and Description |
---|---|
String |
encode(String rawPassword)
Encode the raw password provided
|
static byte[] |
getSalt()
Generate a salt for each password
|
boolean |
verify(String rawPassword,
String encodedPassword)
Encode the password provided and compare with the hash stored into the database
|
public static final String PBKDF2_ALGORITHM
public static final String RNG_ALGORITHM
public Pbkdf2PasswordEncoder(byte[] salt, int iterations)
public Pbkdf2PasswordEncoder(byte[] salt)
public String encode(String rawPassword)
rawPassword
- The password used as a master key to derive into a session keypublic boolean verify(String rawPassword, String encodedPassword)
rawPassword
- The password providedencodedPassword
- Encoded hash stored into the databasepublic static byte[] getSalt()
Copyright © 2014. All Rights Reserved.