public class TOTPGenerator extends AbstractOTPGenerator
| Modifier and Type | Field and Description |
|---|---|
private Spec<org.bouncycastle.crypto.Digest> |
digestSpecification
Digest algorithm specification.
|
private int |
startTime
Reference start time, T0.
|
private int |
timeStep
Time step in seconds, X.
|
| Constructor and Description |
|---|
TOTPGenerator() |
| Modifier and Type | Method and Description |
|---|---|
int |
generate(byte[] key)
Generates the OTP given a per-user key.
|
protected org.bouncycastle.crypto.Digest |
getDigest() |
Spec<org.bouncycastle.crypto.Digest> |
getDigestSpecification() |
int |
getStartTime() |
int |
getTimeStep() |
void |
setDigestSpecification(Spec<org.bouncycastle.crypto.Digest> specification)
Sets the digest algorithm used with the HMAC function.
|
void |
setStartTime(int seconds)
Sets the reference start time, T0.
|
void |
setTimeStep(int seconds)
Sets the time step, X.
|
generateInternal, getNumberOfDigits, setNumberOfDigitsprivate Spec<org.bouncycastle.crypto.Digest> digestSpecification
private int startTime
private int timeStep
public Spec<org.bouncycastle.crypto.Digest> getDigestSpecification()
public void setDigestSpecification(Spec<org.bouncycastle.crypto.Digest> specification)
specification - SHA-1, SHA-256, or SHA-512 digest specification.public int getStartTime()
public void setStartTime(int seconds)
seconds - Start time in seconds.public int getTimeStep()
public void setTimeStep(int seconds)
seconds - Time step in seconds. Default is 30. This value determines the validity window of generated OTP
values.public int generate(byte[] key)
key - Per-user key.protected org.bouncycastle.crypto.Digest getDigest()
getDigest in class AbstractOTPGenerator