public class TotpUtil extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
generate(String secretBase32)
根据密钥生成动态口令
|
static String |
generateTOTP(String key,
String time,
String returnDigits)
This method generates a TOTP value for the given
set of parameters.
|
static String |
generateTOTP(String key,
String time,
String returnDigits,
String crypto)
This method generates a TOTP value for the given
set of parameters.
|
static String |
generateTOTP256(String key,
String time,
String returnDigits)
This method generates a TOTP value for the given
set of parameters.
|
static String |
generateTOTP512(String key,
String time,
String returnDigits)
This method generates a TOTP value for the given
set of parameters.
|
static String |
generateTotpString(String accoName,
String domain,
String secretBase32)
生成totp协议字符串
|
static String |
getRandomSecretBase32(int length)
生成base32编码的随机密钥
|
static boolean |
verify(String secretBase32,
String code)
验证动态口令是否正确
|
public static String generateTOTP(String key, String time, String returnDigits)
key: - the shared secret, HEX encodedtime: - a value that reflects a timereturnDigits: - number of digits to returnpublic static String generateTOTP256(String key, String time, String returnDigits)
key: - the shared secret, HEX encodedtime: - a value that reflects a timereturnDigits: - number of digits to returnpublic static String generateTOTP512(String key, String time, String returnDigits)
key: - the shared secret, HEX encodedtime: - a value that reflects a timereturnDigits: - number of digits to returnpublic static String generateTOTP(String key, String time, String returnDigits, String crypto)
key: - the shared secret, HEX encodedtime: - a value that reflects a timereturnDigits: - number of digits to returncrypto: - the crypto function to usepublic static boolean verify(String secretBase32, String code)
secretBase32 - 密钥code - 待验证的动态口令public static String generateTotpString(String accoName, String domain, String secretBase32)
accoName - domain - secretBase32 - public static String generate(String secretBase32)
secretBase32 - base32编码格式的密钥public static String getRandomSecretBase32(int length)
length - Copyright © 2016–2019. All rights reserved.