Interface OneTimePassword
-
- All Superinterfaces:
Cloneable
,Key
,OneWayPassword
,Password
,Serializable
public interface OneTimePassword extends OneWayPassword
A one-time password, used by the OTP SASL mechanism.- Author:
- Farah Juma
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALGORITHM_OTP_MD5
The algorithm name "otp-md5".static String
ALGORITHM_OTP_SHA_256
The algorithm name "otp-sha256".static String
ALGORITHM_OTP_SHA_384
The algorithm name "otp-sha384".static String
ALGORITHM_OTP_SHA_512
The algorithm name "otp-sha512".static String
ALGORITHM_OTP_SHA1
The algorithm name "otp-sha1".static int
OTP_HASH_SIZE
The constant size of the hash, in bytes.-
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 OneTimePassword
clone()
Creates and returns a copy of thisPassword
.static OneTimePassword
createRaw(String algorithm, byte[] hash, String seed, int sequenceNumber)
Create a raw implementation of this password type.byte[]
getHash()
Get the hash represented by this password.default OneTimePasswordAlgorithmSpec
getParameterSpec()
Get the applicable algorithm parameter specification for this password type.String
getSeed()
Get the seed used to generate the hash.int
getSequenceNumber()
Get the sequence number used to generate the hash.default boolean
impliesParameters(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_OTP_MD5
static final String ALGORITHM_OTP_MD5
The algorithm name "otp-md5".- See Also:
- Constant Field Values
-
ALGORITHM_OTP_SHA1
static final String ALGORITHM_OTP_SHA1
The algorithm name "otp-sha1".- See Also:
- Constant Field Values
-
ALGORITHM_OTP_SHA_256
static final String ALGORITHM_OTP_SHA_256
The algorithm name "otp-sha256".- See Also:
- Constant Field Values
-
ALGORITHM_OTP_SHA_384
static final String ALGORITHM_OTP_SHA_384
The algorithm name "otp-sha384".- See Also:
- Constant Field Values
-
ALGORITHM_OTP_SHA_512
static final String ALGORITHM_OTP_SHA_512
The algorithm name "otp-sha512".- See Also:
- Constant Field Values
-
OTP_HASH_SIZE
static final int OTP_HASH_SIZE
The constant size of the hash, in bytes.- See Also:
- Constant Field Values
-
-
Method Detail
-
getHash
byte[] getHash()
Get the hash represented by this password.- Returns:
- the hash represented by this password
-
getSeed
String getSeed()
Get the seed used to generate the hash.- Returns:
- the seed used to generate the hash
-
getSequenceNumber
int getSequenceNumber()
Get the sequence number used to generate the hash.- Returns:
- the sequence number used to generate the hash
-
getParameterSpec
default OneTimePasswordAlgorithmSpec getParameterSpec()
Description copied from interface:Password
Get the applicable algorithm parameter specification for this password type.- Specified by:
getParameterSpec
in interfacePassword
- Returns:
- the algorithm parameter specification, or
null
if this password type does not support algorithms
-
impliesParameters
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec)
Description copied from interface:Password
Determine if this password is matched by the given parameter specification.- Specified by:
impliesParameters
in interfacePassword
- Parameters:
parameterSpec
- the parameter specification (must not benull
)- Returns:
true
if the password is matched by the parameters,false
otherwise
-
clone
OneTimePassword clone()
Creates and returns a copy of thisPassword
.- Specified by:
clone
in interfaceOneWayPassword
- Specified by:
clone
in interfacePassword
- Returns:
- a copy of this
Password
.
-
createRaw
static OneTimePassword createRaw(String algorithm, byte[] hash, String seed, int sequenceNumber)
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 hashseed
- the seedsequenceNumber
- the sequence number- Returns:
- the raw password implementation
-
-