APDU Simulator

Simulate EMV smart card sessions and analyze APDU command/response exchanges. Useful for terminal development, kernel testing, and reverse-engineering card behavior without physical hardware.

Overview

The APDU Simulator emulates a smart card endpoint that responds to ISO 7816-4 APDU commands. It can either drive a connected reader (PC/SC, NFC) using a virtual or real card, or run in pure mock mode for offline development.

💳

Card Session

Open and manage card sessions. Supports EMV contact, contactless, and MIFARE-style cards.

📡

APDU Monitor

Real-time view of every C-APDU and R-APDU pair with annotated CLA / INS / P1 / P2 / Lc / Le and status word.

🌳

TLV Parser

Parse BER-TLV / EMV templates, expand nested tags, and inspect tag definitions and lengths.

📈

Flow Analysis

Visualize transaction flow phases (SELECT, GPO, READ RECORD, GENERATE AC) with timing statistics.

Quick Start

  1. Open the APDU Simulator — From the home screen, choose Simulator → APDU Simulator.
  2. Pick a card type — Select EMV Contact, EMV Contactless, or MIFARE in the Card Session tab.
  3. Choose an interface — Select PC/SC, NFC, or Mock/USB depending on your hardware (or no hardware).
  4. Set the AID — Enter the application identifier (e.g. A0000000031010 for Visa Credit, A0000000041010 for MasterCard).
  5. Start the session — Click Start. The simulator will perform SELECT AID and wait for further commands.
  6. Send commands or watch traffic — Use the APDU Monitor tab to send manual commands, or let the connected terminal drive the flow.
Tip

If you don’t have a physical reader, use the Mock/USB interface to script the entire transaction in the app and replay APDUs.

Supported Card Types

Card TypeProtocolTypical Use
EMV ContactISO 7816 T=0 / T=1Chip-and-PIN credit and debit cards.
EMV ContactlessISO 14443 / EMV CL kernelsTap-to-pay payment cards and mobile wallets.
MIFAREISO 14443 Type ATransit, access control, and loyalty cards.

Card Session Tab

The Card Session tab is the control surface for opening, configuring, and ending a smart card session.

Configuration

  • Card Type — EMV Contact, EMV Contactless, or MIFARE.
  • Interface — PC/SC, NFC, or Mock/USB.
  • AID — Application Identifier to select on session start.
  • ATR — Static or dynamic ATR returned to the reader on power-up.
  • Reader Name — The PC/SC reader to use when multiple are connected.

Session Controls

  • Start — Powers the virtual card and waits for APDUs.
  • Reset — Re-issues an ATR and clears session state.
  • Stop — Closes the session.

Live Statistics

While the session is active, the panel displays:

  • Total APDU exchanges
  • Average processing time per command (ms)
  • Distribution of status words returned
  • Last error / exception

APDU Monitor Tab

The APDU Monitor displays every command exchange as a row showing the request, the response, and timing.

Sending Manual Commands

Use the command builder to construct an APDU:

CLA: 00     INS: A4     P1: 04     P2: 00
Lc:  07     Data: A0 00 00 00 03 10 10
Le:  00

This issues a SELECT AID for Visa Credit. The response is decoded into:

  • SW1 SW2 — Two-byte status word.
  • Response Data — Optional FCI template for SELECT, parsed via the TLV parser.
  • Timing — Processing time in milliseconds.

Error Injection

Force the simulator to return specific error status words to test terminal error handling:

  • 6982 — Security status not satisfied
  • 6985 — Conditions of use not satisfied
  • 6A82 — File not found
  • 6A86 — Incorrect P1 P2
  • 6300 — Authentication failed (with retry counter)

TLV Parser Tab

Parse BER-TLV and EMV-TLV encoded data. Paste any hex blob (FCI template, AFL, response data) and the parser will recursively expand nested tags.

Example

Input:

6F 1A 84 07 A0 00 00 00 03 10 10
A5 0F 50 0A 56 49 53 41 20 43 52 45 44 49 54
9F 38 03 9F 33 02

Output (annotated):

6F (FCI Template) [26 bytes]
└ 84 (DF Name)            A0 00 00 00 03 10 10
└ A5 (FCI Proprietary)
   └ 50 (Application Label)  "VISA CREDIT"
   └ 9F 38 (PDOL)             9F 33 02
Note

The TLV parser uses the EMV Tag Dictionary in the background — tags are annotated with their EMV book reference and template ownership.

Flow Analysis Tab

The Flow Analysis tab groups APDU exchanges into EMV transaction phases for at-a-glance review.

Phases Tracked

  1. Selection — PSE / PPSE selection, AID selection, FCI return.
  2. GPOGET PROCESSING OPTIONS with PDOL data, AIP / AFL response.
  3. Read Records — Each READ RECORD call iterating through the AFL.
  4. Offline Authentication — SDA / DDA / CDA verification calls.
  5. Cardholder VerificationVERIFY commands (online / offline PIN, signature).
  6. TransactionGENERATE AC first generate, optional second generate, AAC / TC / ARQC.
  7. Script Processing — Issuer scripts after online authorization.

Each phase row shows the number of APDUs, the cumulative time, and the resulting status. Click into any phase to drill down to individual APDU exchanges.

Reader Interfaces

InterfaceConnectionNotes
PC/SCUSB chip reader (e.g. ACR38, Identiv SCR3310)Standard contact reader API; works with any PC/SC-compatible reader.
NFCContactless reader (ACR122U, PN532)For ISO 14443 contactless cards and emulated wallets.
Mock / USBNone — pure softwareRun without hardware. Useful for unit-style testing of terminal logic against scripted card responses.

Response Modes

Choose how the simulator answers incoming APDUs:

  • Automatic — Returns canned responses from the active EMV profile (typical for a Visa or MasterCard card).
  • Manual — Pauses on each request and lets you craft the response by hand. Useful for reproducing edge cases.
  • Script-based — Loads a script defining responses for a sequence of APDUs. Replays them in order regardless of input variation.
Heads-up

In Manual mode the connected terminal will time out unless you respond promptly. Increase the terminal timeout if you need extra inspection time.

Common Status Words

SW1 SW2Meaning
9000Success.
61xxResponse available; xx bytes remain. Issue GET RESPONSE.
6CxxWrong Le; correct Le is xx.
6300Authentication failed (PIN verification with no retry counter).
63CxPIN verification failed; x tries remaining.
6700Wrong length.
6982Security status not satisfied.
6985Conditions of use not satisfied.
6A82File or application not found.
6A86Incorrect P1 / P2.
6D00Instruction code not supported.
6E00Class not supported.

Tips & Troubleshooting

  • Reader not detected — Check that the PC/SC service is running and the reader is exclusively held by ISO8583Studio (close other smartcard apps).
  • ATR mismatch — Some terminals validate the ATR against a list. Override the simulator’s ATR to match your expected card profile.
  • Slow contactless — Reduce the response delay in mock mode; contactless kernels often time out at ~500 ms.
  • TLV parse errors — Verify the input is valid hex (no 0x prefix, no commas) and that nested templates are length-correct.