
Eight bytes that prove your card was there
Every tap ends with an eight-byte cryptogram that only your card and your bank can make. How the keys behind it are built, how the bank checks it, and what breaks it, with working Python and C#.
Topic
C# implementations alongside the explanations: EMV certificate chains, card checks and contactless transaction logic.
5 stories

Every tap ends with an eight-byte cryptogram that only your card and your bank can make. How the keys behind it are built, how the bank checks it, and what breaks it, with working Python and C#.

One card can have several tokens alive at once, each with its own rules. Who is allowed to ask for one, how it's issued, what's checked on every payment, and what happens when your phone goes missing.

When you pay with Apple Pay or Google Pay, the terminal thinks it's talking to a card. What's really different is the number it gets, who checks it's you, and where the keys live.

The beep on a contactless tap comes before the bank has said anything. A card gets 500 ms with the reader, and the bank answers after the card has gone. Here's what happens in that half second.

With no network, a card terminal still has to decide whether a chip is genuine. This post builds the EMV certificate chain in Python and C#, checks it the way a terminal does, then breaks it five ways.