public final class StrongPasswordEncryptor extends Object implements PasswordEncryptor
Utility class for easily performing high-strength password digesting and checking.
This class internally holds a StandardStringDigester
configured this way:
The required steps to use it are:
encryptPassword(String) or
checkPassword(String, String)
operations.This class is thread-safe
| Constructor and Description |
|---|
StrongPasswordEncryptor()
Creates a new instance of StrongPasswordEncryptor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkPassword(String plainPassword,
String encryptedPassword)
Checks an unencrypted (plain) password against an encrypted one
(a digest) to see if they match.
|
String |
encryptPassword(String password)
Encrypts (digests) a password.
|
public StrongPasswordEncryptor()
public String encryptPassword(String password)
encryptPassword in interface PasswordEncryptorpassword - the password to be encrypted.StandardStringDigester.digest(String)public boolean checkPassword(String plainPassword, String encryptedPassword)
checkPassword in interface PasswordEncryptorplainPassword - the plain password to check.encryptedPassword - the digest against which to check the password.StandardStringDigester.matches(String, String)Copyright © 2018 JBoss by Red Hat. All rights reserved.