TOTP: Time-based One-time Password Algorithm Based on http://tools.ietf.org/html/draft-mraihi-totp-timebased-06
- 著者
- anil saldhana
- から
- Sep 20, 2010
◆ TimeBasedOTP() [1/2]
org.keycloak.models.utils.TimeBasedOTP.TimeBasedOTP |
( |
| ) |
|
|
inline |
static final int DEFAULT_DELAY_WINDOW
Definition: TimeBasedOTP.java:33
static final int DEFAULT_INTERVAL_SECONDS
Definition: TimeBasedOTP.java:32
◆ TimeBasedOTP() [2/2]
org.keycloak.models.utils.TimeBasedOTP.TimeBasedOTP |
( |
String |
algorithm, |
|
|
int |
numberDigits, |
|
|
int |
timeIntervalInSeconds, |
|
|
int |
lookAheadWindow |
|
) |
| |
|
inline |
- 引数
-
algorithm | the encryption algorithm |
numberDigits | the number of digits for tokens |
timeIntervalInSeconds | the number of seconds a token is valid |
lookAheadWindow | the number of previous intervals that should be used to validate tokens. |
48 super(numberDigits, algorithm, lookAheadWindow);
49 this.
clock =
new Clock(timeIntervalInSeconds);
Clock clock
Definition: TimeBasedOTP.java:35
◆ generateTOTP()
String org.keycloak.models.utils.TimeBasedOTP.generateTOTP |
( |
String |
secretKey | ) |
|
|
inline |
Generates a token.
- 引数
-
secretKey | the secret key to derive the token from. |
60 String steps = Long.toHexString(T).toUpperCase();
63 while (steps.length() < 16)
66 return generateOTP(secretKey, steps, this.numberDigits, this.algorithm);
Clock clock
Definition: TimeBasedOTP.java:35
long getCurrentInterval()
Definition: TimeBasedOTP.java:109
◆ setCalendar()
void org.keycloak.models.utils.TimeBasedOTP.setCalendar |
( |
Calendar |
calendar | ) |
|
|
inline |
void setCalendar(Calendar calendar)
Definition: TimeBasedOTP.java:119
Clock clock
Definition: TimeBasedOTP.java:35
◆ validateTOTP()
boolean org.keycloak.models.utils.TimeBasedOTP.validateTOTP |
( |
String |
token, |
|
|
byte [] |
secret |
|
) |
| |
|
inline |
Validates a token using a secret key.
- 引数
-
token | OTP string to validate |
secret | Shared secret |
- 戻り値
79 for (
int i = this.lookAheadWindow; i >= 0; --i) {
80 String steps = Long.toHexString(currentInterval - i).toUpperCase();
83 while (steps.length() < 16)
86 String candidate = generateOTP(
new String(secret), steps, this.numberDigits, this.algorithm);
88 if (candidate.equals(token)) {
Clock clock
Definition: TimeBasedOTP.java:35
long getCurrentInterval()
Definition: TimeBasedOTP.java:109
◆ clock
Clock org.keycloak.models.utils.TimeBasedOTP.clock |
|
private |
◆ DEFAULT_DELAY_WINDOW
final int org.keycloak.models.utils.TimeBasedOTP.DEFAULT_DELAY_WINDOW = 1 |
|
static |
◆ DEFAULT_INTERVAL_SECONDS
final int org.keycloak.models.utils.TimeBasedOTP.DEFAULT_INTERVAL_SECONDS = 30 |
|
static |
このクラス詳解は次のファイルから抽出されました:
- D:/AppData/doxygen/keycloak/spi-private/src/server-spi-private/src/main/java/org/keycloak/models/utils/TimeBasedOTP.java