Interface UnixSHACryptPassword
- All Superinterfaces:
Cloneable,Key,OneWayPassword,Password,Serializable
The UNIX modular-crypt SHA crypt algorithm.
- Author:
- David M. Lloyd
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe algorithm name "crypt-sha-256".static final StringThe algorithm name "crypt-sha-512".static final intThe default iteration count of this algorithm.static final intThe maximum salt size of this algorithm.Fields inherited from interface java.security.Key
serialVersionUID -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates and returns a copy of thisPassword.static UnixSHACryptPasswordCreate a raw implementation of this password type.byte[]getHash()The final hash, based on the password, salt and iteration countintThe number of iterations to perform when hashing the password.Get the applicable algorithm parameter specification for this password type.byte[]getSalt()The salt used during the hashing 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, getFormatMethods inherited from interface org.wildfly.security.password.Password
castAndApply, castAndApply, castAs, castAs
-
Field Details
-
ALGORITHM_CRYPT_SHA_256
The algorithm name "crypt-sha-256".- See Also:
-
ALGORITHM_CRYPT_SHA_512
The algorithm name "crypt-sha-512".- See Also:
-
SALT_SIZE
static final int SALT_SIZEThe maximum salt size of this algorithm.- See Also:
-
DEFAULT_ITERATION_COUNT
static final int DEFAULT_ITERATION_COUNTThe default iteration count of this algorithm.- See Also:
-
-
Method Details
-
getSalt
byte[] getSalt()The salt used during the hashing of this password. Should have at most 16 bytes.- Returns:
- the salt
-
getHash
byte[] getHash()The final hash, based on the password, salt and iteration count- Returns:
- the hash
-
getIterationCount
int getIterationCount()The number of iterations to perform when hashing the password. Should be bigger than 1,000 and lower than 999,999,999. The default value is 5,000- Returns:
- the number of iterations to perform
-
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
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
-
clone
UnixSHACryptPassword clone()Creates and returns a copy of thisPassword.- Specified by:
clonein interfaceOneWayPassword- Specified by:
clonein interfacePassword- Returns:
- a copy of this
Password.
-
createRaw
static UnixSHACryptPassword createRaw(String algorithm, byte[] salt, byte[] hash, 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 namesalt- the salthash- the hashiterationCount- the iteration count- Returns:
- the raw password implementation
-