Class PasswordFactorySpiImpl
- java.lang.Object
-
- org.wildfly.security.password.PasswordFactorySpi
-
- org.wildfly.security.password.impl.PasswordFactorySpiImpl
-
public final class PasswordFactorySpiImpl extends PasswordFactorySpi
The Elytron-provided password factory SPI implementation, which supports all the provided password types.
-
-
Constructor Summary
Constructors Constructor Description PasswordFactorySpiImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <S extends KeySpec>
booleanengineConvertibleToKeySpec(String algorithm, Password password, Class<S> keySpecType)
Determine whether the given password object is convertible to the given key specification type.protected Password
engineGeneratePassword(String algorithm, KeySpec keySpec)
Generate a password from the given key specification.protected <S extends KeySpec>
SengineGetKeySpec(String algorithm, Password password, Class<S> keySpecType)
Get a key specification for the given password object.protected boolean
engineIsTranslatablePassword(String algorithm, Password password)
Determine whether the given password can be translated into one which is consumable by this factory.protected Password
engineTransform(String algorithm, Password password, AlgorithmParameterSpec parameterSpec)
Transform a password with new parameters.protected Password
engineTranslatePassword(String algorithm, Password password)
Translate a password object into one which is supported by this engine.protected boolean
engineVerify(String algorithm, Password password, char[] guess)
Perform password verification.protected boolean
engineVerify(String algorithm, Password password, char[] guess, Charset hashCharset)
Perform password verification.
-
-
-
Method Detail
-
engineGeneratePassword
protected Password engineGeneratePassword(String algorithm, KeySpec keySpec) throws InvalidKeySpecException
Description copied from class:PasswordFactorySpi
Generate a password from the given key specification.- Specified by:
engineGeneratePassword
in classPasswordFactorySpi
- Parameters:
algorithm
- the password algorithmkeySpec
- the key specification- Returns:
- the password
- Throws:
InvalidKeySpecException
- if the key specification is not supported
-
engineGetKeySpec
protected <S extends KeySpec> S engineGetKeySpec(String algorithm, Password password, Class<S> keySpecType) throws InvalidKeySpecException
Description copied from class:PasswordFactorySpi
Get a key specification for the given password object.- Specified by:
engineGetKeySpec
in classPasswordFactorySpi
- Type Parameters:
S
- the key specification type- Parameters:
algorithm
- the password algorithmpassword
- the password objectkeySpecType
- the key specification class- Returns:
- the key specification
- Throws:
InvalidKeySpecException
- if the key specification type is not supported
-
engineIsTranslatablePassword
protected boolean engineIsTranslatablePassword(String algorithm, Password password)
Description copied from class:PasswordFactorySpi
Determine whether the given password can be translated into one which is consumable by this factory. If this method returnstrue
, thenPasswordFactorySpi.engineTranslatePassword(String, Password)
must succeed.- Specified by:
engineIsTranslatablePassword
in classPasswordFactorySpi
password
- the password object- Returns:
true
if the given password is supported by this algorithm,false
otherwise
-
engineTranslatePassword
protected Password engineTranslatePassword(String algorithm, Password password) throws InvalidKeyException
Description copied from class:PasswordFactorySpi
Translate a password object into one which is supported by this engine.- Specified by:
engineTranslatePassword
in classPasswordFactorySpi
- Parameters:
algorithm
- the password algorithmpassword
- the password object- Returns:
- the translated password
- Throws:
InvalidKeyException
- if the given password type is not supported
-
engineVerify
protected boolean engineVerify(String algorithm, Password password, char[] guess) throws InvalidKeyException
Description copied from class:PasswordFactorySpi
Perform password verification.- Specified by:
engineVerify
in classPasswordFactorySpi
- Parameters:
algorithm
- the password algorithmpassword
- the password objectguess
- the guessed password- Returns:
true
if the password matches,false
otherwise- Throws:
InvalidKeyException
- if the given password type is not supported
-
engineVerify
protected boolean engineVerify(String algorithm, Password password, char[] guess, Charset hashCharset) throws InvalidKeyException
Description copied from class:PasswordFactorySpi
Perform password verification.- Overrides:
engineVerify
in classPasswordFactorySpi
- Parameters:
algorithm
- the password algorithmpassword
- the password objectguess
- the guessed passwordhashCharset
- the character set used in the password object representation (must not benull
)- Returns:
true
if the password matches,false
otherwise- Throws:
InvalidKeyException
- if the given password type is not supported
-
engineConvertibleToKeySpec
protected <S extends KeySpec> boolean engineConvertibleToKeySpec(String algorithm, Password password, Class<S> keySpecType)
Description copied from class:PasswordFactorySpi
Determine whether the given password object is convertible to the given key specification type.- Specified by:
engineConvertibleToKeySpec
in classPasswordFactorySpi
- Type Parameters:
S
- the key specification type- Parameters:
algorithm
- the password algorithmpassword
- the password objectkeySpecType
- the key specification class- Returns:
true
if the password is convertible,false
otherwise
-
engineTransform
protected Password engineTransform(String algorithm, Password password, AlgorithmParameterSpec parameterSpec) throws InvalidKeyException, InvalidAlgorithmParameterException
Description copied from class:PasswordFactorySpi
Transform a password with new parameters. Not every transformation is allowed, but iterative password types generally should allow increasing the number of iterations.- Specified by:
engineTransform
in classPasswordFactorySpi
- Parameters:
algorithm
- the password algorithmpassword
- the passwordparameterSpec
- the new parameters- Returns:
- the transformed password
- Throws:
InvalidKeyException
- if the given password is invalidInvalidAlgorithmParameterException
- if the transformation cannot be applied to the given parameters
-
-