public class TimeBasedOTP extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HMAC_SHA1 |
static String |
HMAC_SHA256 |
static String |
HMAC_SHA512 |
Constructor and Description |
---|
TimeBasedOTP() |
Modifier and Type | Method and Description |
---|---|
static String |
generateTOTP(String key,
int returnDigits)
Generate a TOTP value using HMAC_SHA1
|
static String |
generateTOTP(String key,
String time,
int returnDigits)
This method generates an TOTP value for the given
set of parameters.
|
static String |
generateTOTP(String key,
String time,
int returnDigits,
String crypto)
This method generates an TOTP value for the given
set of parameters.
|
static String |
generateTOTP256(String key,
int returnDigits)
Generate a TOTP value using HMAC_SHA256
|
static String |
generateTOTP256(String key,
String time,
int returnDigits)
This method generates an TOTP value for the given
set of parameters.
|
static String |
generateTOTP512(String key,
int returnDigits)
Generate a TOTP value using HMAC_SHA512
|
static String |
generateTOTP512(String key,
String time,
int returnDigits)
This method generates an TOTP value for the given
set of parameters.
|
public static final String HMAC_SHA1
public static final String HMAC_SHA256
public static final String HMAC_SHA512
public static String generateTOTP(String key, int returnDigits) throws GeneralSecurityException
key
- returnDigits
- GeneralSecurityException
public static String generateTOTP256(String key, int returnDigits) throws GeneralSecurityException
key
- returnDigits
- GeneralSecurityException
public static String generateTOTP512(String key, int returnDigits) throws GeneralSecurityException
key
- returnDigits
- GeneralSecurityException
public static String generateTOTP(String key, String time, int returnDigits) throws GeneralSecurityException
key
- the shared secret, HEX encodedtime
- a value that reflects a timereturnDigits
- number of digits to returntruncationDigits
digitsGeneralSecurityException
public static String generateTOTP256(String key, String time, int returnDigits) throws GeneralSecurityException
key
- the shared secret, HEX encodedtime
- a value that reflects a timereturnDigits
- number of digits to returntruncationDigits
digitsGeneralSecurityException
public static String generateTOTP512(String key, String time, int returnDigits) throws GeneralSecurityException
key
- the shared secret, HEX encodedtime
- a value that reflects a timereturnDigits
- number of digits to returntruncationDigits
digitsGeneralSecurityException
public static String generateTOTP(String key, String time, int returnDigits, String crypto) throws GeneralSecurityException
key
- the shared secret, HEX encodedtime
- a value that reflects a timereturnDigits
- number of digits to returncrypto
- the crypto function to usetruncationDigits
digitsGeneralSecurityException
Copyright © 2018 JBoss by Red Hat. All rights reserved.