public final class HotpGeneratorContext extends OtpGeneratorContext
Constructor and Description |
---|
HotpGeneratorContext(java.lang.String secret,
int counter)
Returns a new HotpGeneratorContext object with the values secret and counter.
|
HotpGeneratorContext(java.lang.String secret,
int digits,
HmacAlgorithm algorithm,
int counter)
Returns a new HotpGeneratorContext object with the values secret, digits, algorithm
and counter.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
create()
Returns an one-time password
|
public HotpGeneratorContext(java.lang.String secret, int digits, HmacAlgorithm algorithm, int counter)
secret
- the static symmetric key, null throws IllegalArgumentExceptiondigits
- the required length of the one-time password,
other values than 6 and 8 throw IllegalArgumentExceptionalgorithm
- the algorithm that has to be used HmacAlgorithm
counter
- the initial counter for the calculation, has to be ≥ 0java.lang.IllegalArgumentException
- if any of the arguments is null or out of boundariespublic HotpGeneratorContext(java.lang.String secret, int counter)
The default value is used for the length of the one-time password (6) and
the algorithm (HmacAlgorithm.SHA1
).
secret
- the static symmetric key, null throws IllegalArgumentExceptioncounter
- the initial counter for the calculation, has to be ≥ 0java.lang.IllegalArgumentException
- if any of the arguments is null or out of boundaries