Interface BCryptPassword
-
- All Superinterfaces:
Cloneable,Key,OneWayPassword,Password,Serializable
public interface BCryptPassword extends OneWayPassword
A password using the "bcrypt" Blowfish-based one-way password encryption algorithm.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description static StringALGORITHM_BCRYPTThe algorithm name.static intBCRYPT_HASH_SIZEA constant representing the bcrypt hash size, in bytes.static intBCRYPT_SALT_SIZEA constant representing the bcrypt salt size, in bytes.static intDEFAULT_ITERATION_COUNTA constant representing the default iteration count for bcrypt passwords.-
Fields inherited from interface java.security.Key
serialVersionUID
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description BCryptPasswordclone()Creates and returns a copy of thisPassword.static BCryptPasswordcreateRaw(String algorithm, byte[] hash, byte[] salt, int iterationCount)Create a raw implementation of this password type.byte[]getHash()Get the hash segment of this password.intgetIterationCount()Get the iteration count of this password.default IteratedSaltedPasswordAlgorithmSpecgetParameterSpec()Get the applicable algorithm parameter specification for this password type.byte[]getSalt()Get the salt segment of this password.default booleanimpliesParameters(AlgorithmParameterSpec parameterSpec)Determine if this password is matched by the given parameter specification.-
Methods inherited from interface java.security.Key
getAlgorithm, getEncoded, getFormat
-
Methods inherited from interface org.wildfly.security.password.Password
castAndApply, castAndApply, castAs, castAs
-
-
-
-
Field Detail
-
ALGORITHM_BCRYPT
static final String ALGORITHM_BCRYPT
The algorithm name.- See Also:
- Constant Field Values
-
BCRYPT_SALT_SIZE
static final int BCRYPT_SALT_SIZE
A constant representing the bcrypt salt size, in bytes.- See Also:
- Constant Field Values
-
BCRYPT_HASH_SIZE
static final int BCRYPT_HASH_SIZE
A constant representing the bcrypt hash size, in bytes.- See Also:
- Constant Field Values
-
DEFAULT_ITERATION_COUNT
static final int DEFAULT_ITERATION_COUNT
A constant representing the default iteration count for bcrypt passwords.- See Also:
- Constant Field Values
-
-
Method Detail
-
getHash
byte[] getHash()
Get the hash segment of this password.- Returns:
- the hash segment
-
getSalt
byte[] getSalt()
Get the salt segment of this password.- Returns:
- the salt segment
-
getIterationCount
int getIterationCount()
Get the iteration count of this password.- Returns:
- the iteration count
-
clone
BCryptPassword clone()
Creates and returns a copy of thisPassword.- Specified by:
clonein interfaceOneWayPassword- Specified by:
clonein interfacePassword- Returns:
- a copy of this
Password.
-
getParameterSpec
default IteratedSaltedPasswordAlgorithmSpec getParameterSpec()
Description copied from interface:PasswordGet the applicable algorithm parameter specification for this password type.- Specified by:
getParameterSpecin interfacePassword- Returns:
- the algorithm parameter specification, or
nullif this password type does not support algorithms
-
impliesParameters
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec)
Description copied from interface:PasswordDetermine if this password is matched by the given parameter specification.- Specified by:
impliesParametersin interfacePassword- Parameters:
parameterSpec- the parameter specification (must not benull)- Returns:
trueif the password is matched by the parameters,falseotherwise
-
createRaw
static BCryptPassword createRaw(String algorithm, byte[] hash, byte[] salt, int iterationCount)
Create a raw implementation of this password type. No validation of the content is performed, and the password must be "adopted" in to aPasswordFactory(via thePasswordFactory.translate(Password)method) before it can be validated and used to verify guesses.- Parameters:
algorithm- the algorithm namehash- the hashsalt- the saltiterationCount- the iteration count- Returns:
- the raw password implementation
-
-