Reference🔐 Security & dataAdvanced⏱ 15 min read

🔐 Payment cryptography

HSMs, key hierarchies, DUKPT and P2PE, EMV cryptograms (ARQC), TLS encryption in transit, and the post-quantum threat: the machinery that makes card data useless to thieves

What cryptography actually protects

In a payment chain, cryptography serves three separate goals, and none of them guarantees the other two. Confidentiality makes data unreadable to anyone who intercepts it; integrity makes any tampering with a message detectable; authentication proves where a message came from and that the card is genuine. A single mechanism often does all three at once.

🔒
Symmetric
A single shared key (AES, or 3DES, now being retired). Fast and well suited to encrypting large volumes, provided the key is distributed securely. The core of the card world (PINs, cryptograms).
🔑
Asymmetric
A public/private key pair (RSA, elliptic curves). Solves key distribution and enables digital signatures. The basis of TLS, certificates, and chip authentication.
🧮
Hashes and MACs
Hash functions (SHA-256) and message authentication codes (MACs). They do not encrypt anything, but they guarantee the integrity of a message or a password.
🔑
The real problem is the key
A public, battle-tested algorithm such as AES or RSA is never the weak link. Key management covers how keys are generated, distributed, stored, rotated, and destroyed, and each of those steps is a chance for a leak. Key management is what makes or breaks security. The mechanisms specific to payments, such as HSMs, DUKPT, and key ceremonies, all address this one problem.

HSMs and the key hierarchy

An HSM (Hardware Security Module) is a tamper-resistant hardware vault in which keys are generated and used without ever leaving it in the clear. Banks, acquirers, and certificate authorities all use them, and they are also available in the cloud (CloudHSM). Models used in payments are certified to FIPS 140-2 / 140-3 Level 3 and PCI HSM / PCI PIN.

The keys in a payment system are organized in a tiered hierarchy. A local master key (LMK) protects every other key stored outside the HSM. Below it sit zone exchange keys, PIN keys, card verification keys, and so on. No key ever travels in the clear: each one is sent encrypted under the key one tier above it.

EMV chipMDK (card master key)POS terminal / SREDIPEK + counter (DUKPT)Acquirer / PSP HSMLMK · BDK · ZPK · ZAKIssuer HSMLMK · MDK · PVK · CVKSession key1 per transaction, from the ATCKey per transactionthe BDK is never in the terminalZone translationPIN block re-encrypted under ZPKChecksARQC, PIN (PVV), CVV/CVCARQC (tag 9F26)PIN encrypted with DUKPTISO 8583 fields 52 / 55ARPC + response codeARQC + transaction dataPIN block translated under the ZPKonline authorizationARPC: the card authenticates the issuer's responseNo key travels in the clear: it stays encrypted under the key one level up,and moves between zones through translation inside an HSM, never by being decrypted in memory.Compromising one transaction compromises no other: that is the whole point of DUKPT.Key in the chip (MDK)Derived per transactionKey under the LMK, in an HSMIssuer verification
Simplified key hierarchy of a payment HSM
LMK  (Local Master Key)  -- never leaves the HSM, protects everything else
 |
 +-- ZMK (Zone Master Key)     -- key shared with a partner bank
 |     |
 |     +-- ZPK (Zone PIN Key)  -- encrypts PIN blocks exchanged within the zone
 |     +-- ZAK (Zone Auth Key) -- authenticates messages (MAC)
 |
 +-- TMK (Terminal Master Key) -- protects keys downloaded to a terminal
 |
 +-- PVK (PIN Verification Key) -- verifies the PIN (IBM 3624 / VISA PVV method)
 +-- CVK (Card Verification Key) -- calculates and verifies the CVV / CVC
ℹ️
Key ceremonies: split knowledge and dual control
A master key is generated through a formal procedure, carried out in front of several key custodians who each hold one component of the key (split knowledge). No sensitive operation runs unless two people are present (dual control). No one ever knows the full key, a core principle that PCI PIN requires.

DUKPT and P2PE: one key per transaction

DUKPT (Derived Unique Key Per Transaction) is a key derivation scheme in which every transaction from a terminal is encrypted under a unique derived key that is erased after use. A POS terminal must not reuse the same key to encrypt the PIN and card data, because if that key leaked, every past transaction could be decrypted. With DUKPT, compromising one encrypted transaction exposes neither the ones before it nor the ones after.

How DUKPT works
Manufacturer / key injection facility
Derives an initial key (IPEK) from the BDK
The base derivation key (BDK) stays in the HSM, never in the terminal
Terminal
Stores the IPEK and a transaction counter
The BDK is never present on the device
Terminal
Derives a unique key for each transaction
The key depends on the counter, is used once, then erased
Server / HSM
Recomputes the same key to decrypt
Using the BDK plus the serial number and counter it receives

P2PE (Point-to-Point Encryption) encrypts card data the moment it is read, inside a hardened terminal with SRED (Secure Reading and Exchange of Data). The data only becomes readable again in the provider’s decryption environment, outside the merchant’s systems. The merchant therefore never handles any cleartext data, which sharply reduces its PCI scope (SAQ P2PE).

✅
DUKPT keeps keys secret over time, while P2PE takes the merchant out of the path of cleartext data. Combined in a validated PCI P2PE solution, the two mechanisms reduce the requirements for in-store acceptance to those of the SAQ P2PE.

EMV cryptograms: the ARQC as proof of authenticity

Application cryptograms are values the EMV chip calculates for every payment, using a session key derived from its master key (MDK) and the transaction data. The cryptogram proves to the issuer that the card is genuine and that the data has not been altered. This mechanism has made card counterfeiting nearly impossible, because copying the visible data does not reproduce the key locked inside the chip.

AcronymNameRole
ARQCAuthorization Request CryptogramGenerated by the card and sent to the issuer to request online authorization
ARPCAuthorization Response CryptogramThe issuer’s cryptographic response, verified by the card
TCTransaction CertificateFinal approval cryptogram (transaction approved and completed)
AACApplication Authentication CryptogramDecline cryptogram (transaction declined)
EMV application cryptograms

The same principle underpins the printed CVV / CVC and the dynamic CVV used in tokenization. In both cases, a verification code is calculated cryptographically from the PAN, the expiration date, and a secret key (CVK). Without that key, a fraudster cannot generate a valid code for a given card number. The static code therefore still has value, despite its weakness in e-commerce, where it is sent with every payment.

MDK · the issuer's master keyit never leaves the HSM and never goes into a cardpersonalizationit stays hereInside the chipInside the issuer's HSMUDK · the card's own keydiversified with the PAN and the PSNSession keyderived from the UDK and the ATCARQCMAC over the transaction dataThe card verifies the ARPCit authenticates the response it receivesUDK re-derivedMDK + PAN + PSN from the messageSession keysame derivation, same ATCARQC recomputedit must match the one receivedARPCsigns the response code for the cardTransaction dataamount, currency, country, dateATC · the chip's transaction counterthe terminal's unpredictable numberARQC · tag 9F26, field 55ARPC · the issuer’s cryptographic responsethe MDK never leaves the HSMonly a result travels, never a secretmatch ⇒ genuine cardThe chip and the HSM each run the same computation independently: only the result crosses the network.A master key, a card key, a session key: each level exists only to derive the next.
ℹ️
Authenticating the card ≠ authenticating the cardholder
The ARQC proves to the issuer that the card is genuine, but it says nothing about who the cardholder is. PIN verification, online or offline, and SCA through 3-D Secure are what authenticate the person. Payment security depends on stacking these layers: a genuine card and an authenticated cardholder.

Encryption in transit and the post-quantum threat

On open networks, PCI DSS Requirement 4 mandates strong encryption in transit, which in practice means TLS 1.2 or 1.3 with robust cipher suites and forward secrecy. SSL and early TLS have been banned since June 30, 2018. A server that still accepts these protocols is out of compliance and exposes its sessions to the known decryption attacks against those versions.

A sufficiently powerful quantum computer running Shor’s algorithm would break today’s asymmetric cryptography (RSA, elliptic curves), which protects TLS and certificates. No machine that powerful exists yet. The risk is already real, though, in the form of “harvest now, decrypt later”: an attacker captures encrypted traffic today and decrypts it once the capability arrives.

June 30, 2018
deadline for retiring SSL and early versions of TLS
PCI SSC
FIPS 203/204/205
first post-quantum cryptography standards, published August 13, 2024
NIST
Shor
quantum algorithm that threatens RSA and elliptic curves

NIST finalized its first post-quantum standards on August 13, 2024: FIPS 203 (ML-KEM) for key exchange, and FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA) for signatures. EMVCo and the PCI SSC are tracking the issue. Crypto-agility means designing systems so that a cryptographic algorithm can be swapped out without rebuilding the whole chain. The payments industry’s migration to these standards will stretch across the 2030s.

⚠️
Don’t wait for Q-Day
Long-lived data (credentials, secrets) captured today will still be usable once decryption becomes possible. That is why the inventory of cryptographic uses and the choice of agile solutions belong in 2026, not 2032, without waiting for a machine that can break RSA. A system built without that agility would need a complete overhaul when the switch comes.