public class TOTPGenerator extends AbstractOTPGenerator
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, setNumberOfDigits
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
Copyright © 2016 JBoss by Red Hat. All rights reserved.