IsTOTPPasswordValid Method
Validates a time-based one-time password.
Syntax
ANSI (Cross Platform) int IsTOTPPasswordValid(const char* lpKeySecret, int lenKeySecret, int iPasswordLength, int iTimeInterval, const char* lpszHashAlgorithm, const char* lpszPassword); Unicode (Windows) INT IsTOTPPasswordValid(LPCSTR lpKeySecret, INT lenKeySecret, INT iPasswordLength, INT iTimeInterval, LPCWSTR lpszHashAlgorithm, LPCWSTR lpszPassword);
- (BOOL)isTOTPPasswordValid:(NSData*)keySecret :(int)passwordLength :(int)timeInterval :(NSString*)hashAlgorithm :(NSString*)password;
#define MID_OTPSERVER_ISTOTPPASSWORDVALID 5 SECUREBLACKBOX_EXTERNAL int SECUREBLACKBOX_CALL SecureBlackbox_OTPServer_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);
Remarks
Use this method to validate a time-based one-time password (TOTP) by using explicit TOTP parameters. For this method to work, no user details need to be provided in Users collection.
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 Boolean 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.