Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class Pbkdf2Sha256PasswordEncoder

  1. Object
  2. Pbkdf2Sha256PasswordEncoder

ImplementsPasswordEncoder

PBKDF2-HMAC-SHA256 through the runtime’s own Crypto.hashPassword and Crypto.verifyPassword: a random salt per password, and the round count written into the result, so a stored value says how it is to be checked.

pbkdf2$210000$<salt>$<hash>

Registered as {pbkdf2-sha256}, the scheme new passwords get. It is not the format of Spring’s Pbkdf2PasswordEncoder; Pbkdf2PasswordEncoder reads that one’s {pbkdf2} hashes.

Constructors

public Pbkdf2Sha256PasswordEncoder()

Methods

public String encode(CharSequence rawPassword)The password as it should be stored: salted and hashed, so encoding one password twice gives two different results.
public boolean matches(CharSequence rawPassword, String encodedPassword)Whether rawPassword is the password encodedPassword was made from.
public boolean upgradeEncoding(String encodedPassword)True when the stored password was made with fewer rounds than passwords get now.

Inherited methods

Constructor details

Pbkdf2Sha256PasswordEncoder

public Pbkdf2Sha256PasswordEncoder()

Method details

encode

public String encode(CharSequence rawPassword)
The password as it should be stored: salted and hashed, so encoding one password twice gives two different results.

matches

public boolean matches(CharSequence rawPassword, String encodedPassword)
Whether rawPassword is the password encodedPassword was made from.

upgradeEncoding

public boolean upgradeEncoding(String encodedPassword)
True when the stored password was made with fewer rounds than passwords get now.