K6 DUKPT (TDES)

Needs: Supporter

A unique key per transaction: BDK, IPEK, KSN, the counter and the PIN, MAC and data variants.

This is a supporter feature. Create a free account, then try every supporter feature free for 7 days.

Sign in Create a free account See plans

What this module covers

Track K · Key management

You will be able to

  • Parse a KSN
  • Derive the IPEK from a BDK
  • Derive the transaction key for a counter
  • Pick the PIN, MAC or data variant
  • Explain the counter limit and why the terminal never holds the BDK

The lesson

  1. Why it matters
  2. The concept
  3. Step by step: the host's view
  4. In the real world
  5. Common mistakes
  6. What to test

In the module

  • The lesson, with diagrams, common mistakes and what to test
  • A worked example you can change: From the BDK to an encrypted PIN block
  • Practice: 6 kinds of generated exercise, each with a step-by-step solution
  • A quiz of 9 questions

Key terms

Base derivation key (BDK)
The secret key, held only in host HSMs, from which every device's initial key and every transaction key is derived.
DUKPT (Derived unique key per transaction)
A key scheme in which each transaction uses a different key, derived from a base derivation key and the device's KSN, so a stolen key exposes only one transaction.
Future keys
The keys a DUKPT device keeps ready for coming transactions. Each used key is erased.
Initial key (IPEK, IK)
The key loaded into a device, derived from the BDK and the device's KSN with the counter set to zero. The BDK never leaves the host.
Key set identifier (KSI)
The left part of the KSN, which tells the host which BDK to use.
KSN (Key serial number)
The value sent with each DUKPT transaction: the key set ID, the device ID and the transaction counter. The host uses it to derive the same key.
Non-reversible key generation
The TDES DUKPT step that derives each new key from the previous one, so a device key cannot be used to go back to earlier keys.
PIN variant
The DUKPT working key for PIN encryption: the transaction key XORed with the PIN mask. MAC and data keys use other masks.
Transaction counter
The right 21 bits of a TDES DUKPT KSN (32 bits in AES DUKPT), increased for every transaction. Values with too many one bits are skipped.

Tools for this module: DUKPT

Read the opening of the lesson →

The lesson, worked example, practice and quiz open with a supporter pass, which you can try free for 7 days.
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.