--- title: "AAL2GenerateChallenge" slug: "a3s-cppprg-aal2generatechallenge-4-0" updated: 2026-11-11T10:00:40Z published: 2026-11-11T10:00:40Z canonical: "docs.onespan.com/a3s-cppprg-aal2generatechallenge-4-0" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.onespan.com/llms.txt > Use this file to discover all available pages before exploring further. # AAL2GenerateChallenge ## Function prototype ```cpp aat_int32 AAL2GenerateChallenge (                                  TDigipassBlob*   DPData,                                  TKernelParms*    CallParms,                                  aat_ascii*       Challenge,                                  aat_int32*       ChallengeLength); ``` ## Description If a user's Digipass has been programmed to operate in Challenge/Response authentication mode, the authentication application must generate a random challenge suitable for the user's Digipass, and then prompt the user to enter the proposed challenge into the Digipass authenticator to generate a dynamic password. This function obtains the challenge characteristics information of the user's authenticator application from the authenticator application BLOB and generates the appropriate challenge. The user enters the challenge into the Digipass authenticator to generate a dynamic password that will be validated through the AAL2VerifyPassword API call. ChallengeLength is automatically calculated and is returned to the application. ## Parameters | Type | Name | Use | Description | | --- | --- | --- | --- | | TDigipassBlob * | DPData | I/O | authenticator application BLOB. Upon return from the function call, this BLOB must be rewritten to the application database to reflect changes. | | TKernelParms * | CallParms | I | Structure of runtime parameters to use during this function call. | | aat_ascii * | Challenge | O | String of up to 17 numeric characters, which the user needs to enter into the Digipass authenticator to produce a dynamic password (recommended buffer size is 18 bytes). | | aat_int32 * | ChallengeLength | O | Pointer to a long integer that contains the length of the generated challenge. | ## Return codes | Code | Meaning | Code | Meaning | | --- | --- | --- | --- | | 0 | Success | 1000 | Function does not support EMV-CAP | | 132 | Unsupported token type | 1103 | Unlock Version 2 not supported | | 135 | Invalid challenge pointer | 1116 | Response check digit not allowed | | 136 | Invalid ChallengeLength pointer | 1117 | Challenge check digit not allowed | | 137 | Challenge not supported | 1118 | Unsupported BLOB | | 412 | Invalid checksum | -105 | Challenge minimum length not allowed | | 413 | Invalid Base64 format | -106 | Challenge maximum length not allowed | | 510 | Invalid Digipass data pointer | -1501 | Memory allocation failed |