--- title: "AAL2MXGenerateChallenge" slug: "a3s-cppprg-aal2mxgeneratechallenge-4-0" updated: 2026-11-11T09:57:24Z published: 2026-11-11T09:57:24Z canonical: "docs.onespan.com/a3s-cppprg-aal2mxgeneratechallenge-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. # AAL2MXGenerateChallenge ## Function prototype ```cpp aat_int32 AAL2MXGenerateChallenge (                                    TDigipassBlob*     MXCardBlob,                                    TKernelParms*      CallParms,                                    aat_int32          MXCardSequenceNumber,                                    aat_int32          NumberRows,                                    aat_int32          NumberColumns,                                    aat_int32          SecurityLevel,                                    aat_ascii*         Challenge); ``` ## Description This function is used to generate a challenge for a matrix card. A challenge consists in the concatenation of matrix card cell row ID and column ID: - One digit for the row ID: from 1 to 9 - One digit for the column ID: from A to Z This function randomly chooses a row index between 0 and NumberRows-1, and a column ID between 0 and NumberColumns-1. Then, the indexes are concatenated with the result of a two-digit index couple (row digit, column digit). The security level determines the number of couples in the challenge. ## Parameters | Type | Name | Use | Description | | --- | --- | --- | --- | | TDigipassBlob * | MXCardBLOB | I/O | Matrix Card 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_int32 | MXCard Sequence Number | I | Sequence number of the matrix card on up to 4 digits (from 1 to 9999). | | aat_int32 | NumberRows | I | Number of rows on the matrix card (1 to 9). | | aat_int32 | NumberColumns | I | Number of columns on the matrix card (1 to 26). | | aat_int32 | SecurityLevel | I | Number of concatenated couples in the output challenge (1 to 8). | | aat_ascii * | Challenges List | O | Concatenation of (column ID, row ID) couples. The allocated buffer must have a length of ((SecurityLevel *2) +1) (recommended buffer size is 17 bytes). | ## Return codes | Code | Meaning | Code | Meaning | | --- | --- | --- | --- | | 0 | Success | 562 | Invalid row number | | 132 | Unsupported token type | 563 | Invalid column number | | 510 | Invalid Digipass data pointer | 564 | Invalid security level | | 560 | Null output buffer | 1000 | Function does not support EMV-CAP | | 561 | Invalid matrix card sequence number | -1501 | Memory allocation failed |