GenerateTOTPPassword Method
Generates a new time-based one-time password.
Syntax
ANSI (Cross Platform) char* GenerateTOTPPassword(int iTimeInterval, const char* lpszHashAlgorithm); Unicode (Windows) LPWSTR GenerateTOTPPassword(INT iTimeInterval, LPCWSTR lpszHashAlgorithm);
- (NSString*)generateTOTPPassword:(int)timeInterval :(NSString*)hashAlgorithm;
#define MID_OTPCLIENT_GENERATETOTPPASSWORD 4 SECUREBLACKBOX_EXTERNAL int SECUREBLACKBOX_CALL SecureBlackbox_OTPClient_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);
Remarks
Call this method to generate a new time-based one-time password (TOTP).
Use TimeInterval to specify the index of the time step for which the password is needed, and HashAlgorithm to instruct class what hash algorithm to use. Supported hash algorithms:
SB_MAC_ALGORITHM_HMAC_SHA1 | SHA1 | |
SB_MAC_ALGORITHM_HMAC_SHA256 | SHA256 | |
SB_MAC_ALGORITHM_HMAC_SHA512 | SHA512 |
Error Handling (C++)
This method returns a String value; after it returns, call the GetLastErrorCode() method to obtain its result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message.