Package org.cryptacular.generator
Class AbstractOTPGenerator
java.lang.Object
org.cryptacular.generator.AbstractOTPGenerator
- Direct Known Subclasses:
HOTPGenerator,TOTPGenerator
- Author:
- Middleware Services
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intgenerateInternal(byte[] key, long count) Internal OTP generation method.protected abstract org.bouncycastle.crypto.DigestintvoidsetNumberOfDigits(int digits) Sets the numbers in the generated OTP.
-
Constructor Details
-
AbstractOTPGenerator
public AbstractOTPGenerator()
-
-
Method Details
-
getNumberOfDigits
public int getNumberOfDigits()- Returns:
- Number of digits in generated OTP.
-
setNumberOfDigits
public void setNumberOfDigits(int digits) Sets the numbers in the generated OTP.- Parameters:
digits- Number of digits in generated OTP. MUST be in the range 6 - 9. Default is 6.
-
generateInternal
protected int generateInternal(byte[] key, long count) Internal OTP generation method.- Parameters:
key- Per-user key.count- Counter moving factor.- Returns:
- Integer OTP.
-
getDigest
protected abstract org.bouncycastle.crypto.Digest getDigest()- Returns:
- Digest algorithm used for HMAC operation.
-