Tools

EMV Level 2 Bench

Connect an EMV Level 2 stack, push its configuration and CA keys, tap a test card or a card probe on its reader, and read the outcome, decoded. Works with any stack that speaks the bench protocol, through a small relay on your machine.

Test cards and test keys only. The page talks to your stack through a relay on your own machine; nothing about your transactions is sent to emvstack.dev.

1. Connection

Not connected

The browser cannot open a TCP connection, so a relay on your machine forwards bytes between this page and the stack. Download the relay (Python), then run pip install websockets and python l2bench_relay.py. It only accepts this website, and connects to the IP address and ports you enter here. The log port is optional: see Stack log.

2. Configuration and keys

For each item, use a file the stack already has (send its name) or send the content from here. The content is sent as text, exactly as you paste or load it.

3. Transaction

Any other data the stack expects, sent as is. Tags that are not standard are passed through untouched.

In Transaction Related Data, 9F02 corresponds to a purchase amount, not the Amount, Authorized as per the EMVCo definition. The bench behaves as a POS client not pertaining to the payment (EMV) domain.

4. Outcome

Start a transaction to see the outcome. Standard EMV tags are decoded; other tags are shown as they are, marked not standard.

Open in TLV Parser

5. Stack log

What the stack writes on its log port, live. A stack can expose its standard output on a port without any code change, for example stdbuf -oL ./stack | nc -lk 5001, then enter that port in Stack log port before connecting.

No log port

Show only

6. Session log

Every frame sent (>>) and received (<<), in hex: length, then type and payload.

How the bench works

Any Level 2 stack

The bench is not tied to one kernel. Any EMV Level 2 stack that listens on a TCP port and speaks the bench protocol can be driven from this page: run a transaction with your own test cards or card probes, and compare the outcome with your own implementation.

Frame format

A request is a 4-byte length (big-endian), a 1-byte command type and a text payload; the length counts the type byte and the payload, so 00000005 01 50494E47 carries 5 bytes. A reply is a 4-byte length followed by its payload, with no type byte. The page sends one command at a time and waits for its reply.

Commands

01 CA keys, 02 revocation list, 04 configuration and 0E issuer response send file content; 0A, 0B, 03 and 0D name a file the stack already has, and 08 sets the folder it reads them from. 05 starts a contactless transaction with the transaction data as hex TLV text between square brackets, for example [9F0206000000000010…]. 06 cleans the stored files, 07 returns stacked signals, 09 shows the options and 0C resets them. Store commands reply 0000 when there is no error; 05 and 07 reply with binary TLV. The full reference is in the EMV Level 2 Bench protocol.

Reading the outcome

The reply to a transaction usually carries the Outcome Parameter Set (DF8129), the Data Record (FF8105), the Discretionary Data (FF8106) with the Error Indication (DF8115), and the User Interface Request Data (DF8116). They are decoded with the same engine as the TLV Parser. Proprietary tags are listed but never interpreted.

Stack log

If the stack writes its log on a dedicated TCP port, enter that port in Stack log port: the relay opens a second connection to it and the page shows the text live, separate from the protocol replies. Open last transaction in moka Log Extract passes the lines written from the start of the last transaction to half a second after its outcome. The stack needs no code change: stdbuf -oL ./stack | nc -lk 5001 exposes its standard output on port 5001. Connect the bench before running transactions: until someone reads the port, the stack stops writing once the pipe is full.

Timings over PC/SC

A desktop PC/SC reader adds latency that a terminal does not have, so relay resistance timings measured through it are not representative. See the Kernel 2 relay resistance guide before drawing conclusions from them.

Privacy

The page connects only to the relay on your machine, and the relay only accepts this website. Configuration, keys and card data go from your browser to your stack and back; none of it reaches emvstack.dev.