DUKPT calculator (TDES and AES)
TDES and AES DUKPT: IPEK, transaction and working keys from a BDK and KSN.
- Runs in your browser
- No sign-up
Input
TDES DUKPT keys for counter 1.
Result
- Key set ID (BDK ID)
- FFFF987654
- Device ID (19 bits)
- 19087
- Transaction counter
- 000001 (1)
- Initial KSN (counter cleared)
- FFFF9876543210E00000
Bits set: 0x1 (1 of at most 10)
| Key | Value | KCV |
|---|---|---|
| BDK | — | 08D7B4 |
| Initial key (IPEK) | 6AC292FAA1315B4D858AB3A3D7D5933A | AF8C07 |
| Transaction key | 042666B49184CFA368DE9628D0397BC9 | 646E6C |
| PIN encryption key | 042666B49184CF5C68DE9628D0397B36 | A10107 |
| MAC key, request | 042666B4918430A368DE9628D03984C9 | 91A1BB |
| MAC key, response | 042666B46E84CFA368DE96282F397BC9 | 7F62E4 |
| Data key variant, request | 042666B4917BCFA368DE9628D0C67BC9 | 51F171 |
| Data key variant, response | 0426664B9184CFA368DE96D7D0397BC9 | 016928 |
| Data encryption key, request | 448D3F076D8304036A55A3D7E0055A78 | 156B9F |
| Data encryption key, response | AD7BFC8B06AD3A08A560B4105CF8D9E5 | F5CBDE |
Steps
KCVs: TDES, by encrypting 8 zero bytes.
Test keys only: a BDK is the master key of a whole terminal estate and never belongs in a web page.
Injecting DUKPT keys into a terminal estate? IDNTEQ can plan the key hierarchy. Card-program implementation in Brazil
About this tool
Runs in your browser. This page loads no analytics or third-party scripts and does not send what you type.
Enter a test BDK and a KSN. The tool splits the KSN, lists the counter bits it walks through, and gives the initial key and the keys of the transaction with their KCVs.
TDES DUKPT (X9.24-1)
The KSN is 10 bytes: by common convention a 5-byte key set ID, a 19-bit device ID and a 21-bit transaction counter. The IPEK comes from the BDK and the KSN with the counter cleared. For each counter bit that is set, highest first, the key goes through the non-reversible key generation process. The transaction key is XORed with a fixed variant for PIN, MAC and data; the data keys are then encrypted with themselves. Devices skip counters with more than 10 bits set.
AES DUKPT (X9.24-3)
The KSN is 12 bytes: the initial key ID (4-byte BDK ID and 4-byte derivation ID) and a 32-bit counter. Each key is the AES encryption of a derivation data block that names the key usage, the key type and the counter. Working keys can be AES-128, 192 or 256, never longer than the BDK, or double or triple-length TDES.
Worked example
X9.24-1:2009 A.4: BDK 0123456789ABCDEFFEDCBA9876543210 and KSN FFFF9876543210E00000 give the IPEK 6AC292FAA1315B4D858AB3A3D7D5933A. At KSN FFFF9876543210E00001 the transaction key is 042666B49184CFA368DE9628D0397BC9, and its PIN key encrypts the PIN block 041274EDCBA9876F to 1B9C1845EB993A7A.
Spec references
- ANSI X9.24-1:2009 Annex A (TDES DUKPT)
- ANSI X9.24-3:2017 and its test vector supplement (AES DUKPT)
- ANSI X9.24-1:2017 Annex A (AES key check values)
Verified against
- Specifications
- ANSI X9.24-1:2009 Annex A (TDES DUKPT and its variants)
- ANSI X9.24-3:2017 §6 (AES DUKPT derivation data, key types, usages)
- Published examples in the tests
- X9.24-1:2009 A.4: IPEK, transaction keys of counters 1–21 and the rollover sequence, PIN blocks, request and response MACs, encrypted requests (openemv/dukpt tests)
- X9.24-3:2017 supplement, AES-128 BDK: initial key, derivation, PIN, MAC and data keys, PIN blocks (openemv/dukpt tests)
- X9.24-3:2017 supplement, AES-256 BDK: AES-128 and AES-256 PIN, MAC and data keys (openemv/dukpt tests)
- Other checks in the tests
- TDES and AES derivations against independent constructions on OpenSSL: random BDKs and KSNs, every working key type and usage
- The counter bit walk, the 10 and 16-bit limits, wrong BDK or KSN lengths
- Inputs
- TDES: 16-byte BDK and 10-byte KSN. AES: 16, 24 or 32-byte BDK and 12-byte KSN, and the working key type.
- Not covered
- No published value was found for the TDES response data key, TDES-type working keys of AES DUKPT, an AES-192 BDK, or the KEK, MAC verification and both-ways usages: these are checked against the independent construction only. HMAC working keys and device-side registers are not shown.
- Last reviewed