GenerateOTP
GenerateOTP(userPIN, cardString, additionalParams) generates OTP for the credential provided by application using user PIN. It accepts user pin, card string and returns the OTP value generated. Optionally provide server UTC time or additional parameters. Application can pass additional parameters in key-value pairs in map object which may include keys such as "counter", "time" and "challenge". Application should store updated card string in persistent storage.
aa821test
Description
GenerateOTP(userPIN, cardString, additionalParams) generates OTP for the credential provided by application using user PIN. It accepts user pin, card string and returns the OTP value generated. Optionally provide server UTC time or additional parameters. Application can pass additional parameters in key-value pairs in map object which may include keys such as "counter", "time" and "challenge". Application should store updated card string in persistent storage.
API Signature
CAMOBILEOTPCRYPTOSDK_API SDK_STATUS GenerateOTP(std::string& userPIN,std::string& cardString,std::string& otpValue,const map_list& addtionalParam = map_list())throw()
Parameters
userPIN [in]
User PIN provided by application. Crypto SDK does not perform any validation for pin value. Pin value gets replaced by 'x' character after its usage.
cardString [in/out]
Card string fetched from the persistent storage. Application needs to store back updated card string.
otpValue [out]
Returns the OTP value generated for given cardstring and can get activation code as a user input.
additionalParam [in]
Map object containing key-value pairs.
"mode" : There are 4 different modes (Default mode:"identify") supported by the following two account types:
- HOTP & TOTP Account
- Identify
- Sign
- EMV Account
- Identify
- Sign
- TransSign (mentioned as tds)
- Respond
Each mode will have its own way to generate OTP as follows:
- Identify– this is simple mode, no additional inputs are required and OTP generation takes place by using only user PIN.
- Sign– if sign mode chosen, user has to enter challenge to sign and by using PIN & Challenge OTP is generated.
- Respond– this mode populates Amount and Challenge and Currency input to generate OTP along with user PIN.
- TransSign– this mode populates 10 data text fields and OTP is generated based on 10 Additional Inputs + user PIN.
In case of HOTP/TOTP, it may contain following key-value pairs.
- "counter" : counter value for which OTP needs to be generated, only in case of HOTP card
- "time" : the time-stamp at which OTP value needs to be generated, only in case of HOTP card
- "challenge" : the challenge value which needs to be used during OTP generation. In case of EMV card string, it may contains following key-value pairs for different modes ("sign", "identify", "respond" and "tds").
- "amount" : the amount for transaction
- "currency" : currency value provided in card string
- "challenge" : the challenge value which needs to be used during OTP generation
For "tds" mode 4, any data can be passed as key value pairs of data0 to data9.
For more details on additional parameter, please refer EMVspec.
Return Values
Return Value | Inference |
SDKSTATUS_BADPARAM | CardString is empty |
SDKSTATUS_ERROR_INVALID_CARDSTRING | CardString is corrupt or invalid |
SDKSTATUS_ERROR_INVALID_ADDITIONAL_PARAM | AdditionalParam map object contains invalid values |
SDKSTATUS_ERROR_INVALID_CARDTYPE | If card type is not one of HOTP/TOTP/EMV |
SDKSTATUS_ERROR_OTP_GENERATION | Error occurs while generating OTP value |
SDKSTATUS_ERROR_CHALLENGE_VALUE_NOT_SET | "Challenge" value is not set for EMV mode |
SDKSTATUS_ERROR_INVALID_EMV_MODE OTP | Generation mode for EMV is not valid |
SDKSTATUS_INTERNAL_ERROR | Unknown error occurs |
Remarks
Any special case for APIs input parameter or return values or special.