Amadis
Replay Mode for Frameworks 3.4, 3.5 and 3.6
1. Replay Mode
To enable the Replay Mode is activated in FMK 3.5, from the menu ‘TMS’->’Administrative…’ in ACE-Client, ensure the ‘Replay (Yes/No)’ Option is Enabled
NOTE: This feature needs to be enabled through the Compilation Options _CAD_INTERFACE_SUPPORT_ and _REPLAY_MODE_SUPPORT_
1.1. Location of Card.txt
The Replay Mode requires the file ‘Card.txt’ to be present in the execution folder.
1.1.1. Windows Command Line
Put the Card.txt file in the same folder than the executable, as for example:
/OpenKizis/WIN32_Debug_Static/Card.txt
1.1.2. Eclipse Debug Session
When starting a debug session from Eclipse then Card.txt must be located under OpenKizis folder as for example:
/OpenKizis/Card.txt
NOTE: It is possible to change the ‘Working Directory’ from the ‘Arguments’ Tab in the Debug Configuration Dialog
1.2. Format
The format of Card.txt is (see replay.7z for sample Card.txt files):
Line 1: Number of Card Detection (i.e. Reset)
Line 2: Simulated Technology Detected (04: Contactless, 40: Contact) [' ' and a 4 byte Unpredictable Number]
Line 3: APDU 1 Command (not used, displayed as expected APDU Command in Console Logs)
Line 4: APDU 1 Response
Line 5: APDU 2 Command
Line 6: APDU 2 Response
…
IMPORTANT: Card.txt shall always end with an empty line
1.2.1. Card Mute Simulation
Leaving a Blank Line for an APDU Response simulates a Card Mute
1.2.2. setting the Unpredictable Number ‘9F37’
Line 2 now offers an Optional Feature where it is possible to force the Unpredictable Number (tag ‘9F37’) for each Card Detection
The can be achieved by adding a space character ' ' after the Card Technology Code followed by the value of the Unpredictable Number (4 bytes)
For Example:
Line 2 containing ‘04 12345678’ means: ‘04’ = Contactless Card - ‘12345678’ = Value of Unpredictable Number ‘9F37’
The Section https://teamamadis.atlassian.net/wiki/spaces/AGF/pages/1178304556/Replay+Mode+in+FWK+3+5#1.3.3.-Two-Presentments-Scenario-(See-Phone-or-Double-Tap) shows how to set the Unpredictable Numbers ‘9F37’ for multiple Card Detections
1.3. Replay Scenarios
the Replay Mode allows to reproduce different scenarios such as Torn Transaction, Two Presentments,… by specifying the Number of Card Detection (first line)
The Technology must be specified after each Card Detection, the same Card.txt can simulate detection of multiple technologies in the same Script
1.3.1. Normal Replay Scenario
Most scenarios involve a single Card Detection
For example the following APDU Exchanges:
[CONTACLESS CARD DETECTED]
CMD: 00A404000E325041592E5359532E444446303100
RSP: 6F3D840E325041592E5359532E4444463031A52BBF0C28610C4F07A0000000041010870101610C4F07A0000000043060870103610A4F05B012345678870109
SW1/SW2: 9000
CMD: 00A4040007A000000004101000
RSP: 6F358407A0000000041010A52A870101500A4D6173746572436172645F2D06656E646566729F1101019F380B9F02069F33039C019F0306
SW1/SW2: 9000
CMD: 80A800001283100000000017500000080000000000025000
RSP: 770A82020080940410010100
SW1/SW2: 9000
CMD: 00B2011400
RSP: 70485F24034912315A0854133390000015138C0E95059F02069F34039F33039F37048E0A000000000000000000009F0D0500000000009F0E0500000000009F0F0500000000009F4A0182
SW1/SW2: 9000
CMD: 80AE40001580000000010000000017503F0000006000E1F29BE500
RSP: 77299F2701809F360200029F2608AC123456789ABCDE9F10120110000000020000DAC00000000000000000
SW1/SW2: 9000
Will require the following Card.txt:
1
04
00A404000E325041592E5359532E444446303100
6F3D840E325041592E5359532E4444463031A52BBF0C28610C4F07A0000000041010870101610C4F07A0000000043060870103610A4F05B0123456788701099000
00A4040007A000000004101000
6F358407A0000000041010A52A870101500A4D6173746572436172645F2D06656E646566729F1101019F380B9F02069F33039C019F03069000
80A800001283100000000017500000080000000000025000
770A820200809404100101009000
00B2011400
70485F24034912315A0854133390000015138C0E95059F02069F34039F33039F37048E0A000000000000000000009F0D0500000000009F0E0500000000009F0F0500000000009F4A01829000
80AE40001580000000010000000017503F0000006000E1F29BE500
77299F2701809F360200029F2608AC123456789ABCDE9F10120110000000020000DAC000000000000000009000
1.3.2. Card Mute Replay Scenario (Torn Transaction)
Some scenario imply a Card is Mute, i.e. Card not sending back a Response (RSP, SW1/SW2), this situation occurs during Torn Transactions Testing
NOTE: The [Card Mute] is simulated with an <Empty Line>
For example, the following APDU Exchanges (with a CMD without RSP and/or SW1/SW2):
[CONTACLESS CARD DETECTED]
CMD: 00A404000E325041592E5359532E444446303100
RSP: 6F3D840E325041592E5359532E4444463031A52BBF0C28610C4F07A0000000041010870101610C4F07A0000000043060870103610A4F05B012345678870109
SW1/SW2: 9000
CMD: 00A4040007A000000004101000
RSP: 6F328407A0000000041010A527870101500A4D6173746572436172645F2D06656E646566729F1101019F38089F02069F33039C01
SW1/SW2: 9000
CMD: 80A800000C830A0000000015000000080000
RSP: 771682020180941008010100100101011801010020010200
SW1/SW2: 9000
CMD: 00B2011400
RSP: 70525F24034912315A0854133390000015135F3401018C0E95059F02069F34039F33039F37048E0A000000000000000000009F0D0500000000009F0E0500000000009F0F0500000000009F51039F37049F4A0182
SW1/SW2: 9000
CMD: 00B2011C00
RSP: 7081AE9F320103922249656AE43F494BFA143C075B1E08B7C349F2B590324D03088E4537C6D0D9A6108BF790818004A25FC9C69B0FC069A776CE3F268FC5BB41E59E41923ED3EDAE18D23D587C0D217DDDB15117A2582A321AAEA46C8BA94D6580E6BB544891A59EA2E40FF5A627760B7F2D28DFFC0E6828DE41701408FAE021A5C9F9C7C0DAC145D0A440EFA66DDFDA4E38D01FE812294EF2BE4E0573797CAF483A85111A37EA782FBAAF3CCC0D8F01F8
SW1/SW2: 9000
CMD: 00B2012400
RSP: 702F9F4701039F4828744084A499FAF96FEFC6CC54F8CFAF51D432F1D2273C9B50D1B0D8F91EA17F1B373FFDC0E1E9F82F
SW1/SW2: 9000
CMD: 00B2022400
RSP: 7081819F467E22FF1697414836ED4E791D4A8DDA86DEA1FDABD559A69704183D7B2038BC639024CB6E5FAAF93841C6B9012454B7A958C5745E9EC82A4D753FD1A89881D016C89EA10EF1407997429EB82203BB35D11E059694794F516A9D60A8B696B64038EDB9484CEA70E7CB964FCCC89225E49202D117A54661EAEAAF515356694DBA
SW1/SW2: 9000
CMD: 80AE50001500000000010000000015003F0000006008D964C37500
RSP:
SW1/SW2:
[CONTACLESS CARD DETECTED]
CMD: 00A404000E325041592E5359532E444446303100
RSP: 6F3D840E325041592E5359532E4444463031A52BBF0C28610C4F07A0000000041010870101610C4F07A0000000043060870103610A4F05B012345678870109
SW1/SW2: 9000
CMD: 00A4040007A000000004101000
RSP: 6F328407A0000000041010A527870101500A4D6173746572436172645F2D06656E646566729F1101019F38089F02069F33039C01
SW1/SW2: 9000
CMD: 80A800000C830A0000000015000000080000
RSP: 771682020180941008010100100101011801010020010200
SW1/SW2: 9000
CMD: 00B2011400
RSP: 70525F24034912315A0854133390000015135F3401018C0E95059F02069F34039F33039F37048E0A000000000000000000009F0D0500000000009F0E0500000000009F0F0500000000009F51039F37049F4A0182
SW1/SW2: 9000
CMD: 00B2011C00
RSP: 7081AE9F320103922249656AE43F494BFA143C075B1E08B7C349F2B590324D03088E4537C6D0D9A6108BF790818004A25FC9C69B0FC069A776CE3F268FC5BB41E59E41923ED3EDAE18D23D587C0D217DDDB15117A2582A321AAEA46C8BA94D6580E6BB544891A59EA2E40FF5A627760B7F2D28DFFC0E6828DE41701408FAE021A5C9F9C7C0DAC145D0A440EFA66DDFDA4E38D01FE812294EF2BE4E0573797CAF483A85111A37EA782FBAAF3CCC0D8F01F8
SW1/SW2: 9000
CMD: 00B2012400
RSP: 702F9F4701039F4828744084A499FAF96FEFC6CC54F8CFAF51D432F1D2273C9B50D1B0D8F91EA17F1B373FFDC0E1E9F82F
SW1/SW2: 9000
CMD: 00B2022400
RSP: 7081819F467E22FF1697414836ED4E791D4A8DDA86DEA1FDABD559A69704183D7B2038BC639024CB6E5FAAF93841C6B9012454B7A958C5745E9EC82A4D753FD1A89881D016C89EA10EF1407997429EB82203BB35D11E059694794F516A9D60A8B696B64038EDB9484CEA70E7CB964FCCC89225E49202D117A54661EAEAAF515356694DBA
SW1/SW2: 9000
CMD: 80D0000004D964C37500
RSP: 7781889F2701409F360200029F4B7C7BD418C2E4B6B75AEE244CAC5C0D56D357B80AFDAD12053DFCB69615ADD2714E01E0F291F8AEC6993EFC6F4C1D85A3755675960A0F3A97448693F4D111352CF6058878729CF1B9DAAAF1A3FEB704300686BD2994E0E6AB35F87B532D18BF079A465A09942B8E7366F3977E75D89C7D46EB792DCCAF8394FCC06875C9
SW1/SW2: 9000
Will require the following Card.txt:
NOTE: Absence of APDU Response in the first GenAC Command is simulating a ‘Card Mute’ situation
1.3.3. Two Presentments Scenario (See Phone or Double Tap)
Some scenarios require a Double Tap (TRY AGAIN Outcome with Start-B), this occurs when a SEE PHONE is requested or execution of Issuer Scripts following an ONLINE REQUEST Outcome
For example, the following APDU Exchanges (PURE with 2nd Tap after 1st GenAC):
Will require the following Card.txt:
NOTE: in this example, the Unpredictable Number used in the Generate AC of the 1st Transaction (Line 15) is ‘9F37’ = ‘A69314EC’ therefore the first Card Detection in Line 2 specifies the Contactless Card Technology ‘04’ followed by the value of the Unpredictable Number: 04-A69314EC
The Unpredictable Number used in the Generate AC of the 2nd Transaction (Line 26) is ‘9F37’ = ‘CD12AA59’ therefore the second Card Detection in Line 17 specifies the Contactless Card Technology ‘04’ followed by the new value of Unpredictable Number: ‘04 CD12AA59’
2. Python Scripts
Some Python Scripts were made for generating Card.txt from Log Files
The Python Scripts may require some modifications due to inconsistencies with Log Files generated from different Kernels and different Tool Versions
For exemple, PayPass Logs generated by EVAL are slightly different from ExpressPay Logs
Also new Versions of EVAL may generate slightly different Logs from older Versions even for the same Kernel
IMPORTANT: Some Card.txt still requires manual modifications after their generation for Card Mute and Double Tap Scenarios (see Card Mute Replay Scenario and Two Presentments Scenario )
2.1. Sample EVAL Log Python Scripts
Sample Python Script for generating Card.txt file from EVAL Logs
Example for PURE:
2.2. Sample ICC Solution Log Python Scripts
Exemple for Interac: