AES-DUKPT reference

Read the contained information about the use of AES keys with derived unique key per transaction (AES-DUKPT) processing.

Types of keys used in AES-DUKPT processing

In AES-DUKPT processes, three kinds of keys are distinguished:

Base derivation key (BDK)
This key is used in a derivation process to generate initial DUKPT keys using the CSNBUKD verb. A BDK is generated using the verbs CSNBKTB2 and CSNBKGN2. This key must be CCA type AES DKYGENKY key with KUF bits set indicating this key is allowed to be used as BDK.
initial derivation key
This is a unique key loaded into a secure device such as PIN entry device or POS terminal. It is derived from the DUKPT BDK and information in the Derived Data structure. Within X9.24 documentation, this key is sometimes also called initial terminal key or just terminal key. The only CCA verb that can derive an initial derivation key is CSNBUKD. For the purpose of AES-DUKPT, the initial derivation key can only be an AES key, within CCA specifically an AES DKYGENKY key with KUF bits set indicating this key is allowed to be used as BDK.
working key
This is the output key from the AES-DUKPT algorithm and it is used in cryptographic operations to encrypt, decrypt, authenticate or validate the transaction data. A working key is sometimes also called the transaction key. Working keys are derived from the initial derivation key and information in the Derived Data structure. A user can derive working keys using verb CSNBUKD and then use that key for the transaction and use that key as input parameter in other CCA verbs for the given transaction. Working keys are discarded once transaction is completed. A user can also instruct several CCA verbs to derive working keys inline. CCA verbs that support this inline DUKPT key derivations are CSNBPTR2, CSNBPTRE, CSNBPVR, CSNBFPEE, CSNBFPET and CSNBFPED. These verbs support AES-DUKPT derivation methods.

AES-DUKPT derivation data

The following data structure is used to specify input parameters for both initial derivation keys and working keys. The initial terminal DUKPT key or initial key is used together with the transaction counter to derive the transaction key, which is also called the working key. Once the transaction key has been derived, the terminal does not preserve any information that could be used to derive the transaction key after the transaction has been completed.

Table 1 specifies the derivation data. For the most part, initial terminal key value ranges are a subset of the overall value ranges. One exception to that rule is the value for the key usage indicator field, X'8001', which can only be used when deriving an initial terminal key.
Table 1. AES-DUKPT derivation data

AES-DUKPT derivation data.

Offset Length of field (bytes) Field name Description
0 1 Version Version ID of this table structure.

Allowed value: X'01'.

1 1 Key block counter A counter that is incremented for each 16-byte block of keying material generated for a pair of encryption and MAC keys. Starts at 1 for each key being generated.

Allowed values: X'01' – X'02'.

2 2 Key usage indicator Indicates how the key to be derived is to be used. The initial terminal key is always a key derivation key.
Allowed values:
X'0002'
Key Encryption Key.
X'1000'
PIN Encryption.
X'2000'
Message Authentication, generation.
X'2001'
Message Authentication, verification.
X'2002'
Message Authentication, both generation and verification.
X'3000'
Data Encryption, encryption.
X'3001'
Data Encryption, decryption.
X'3002'
Data Encryption, both encryption and decryption.
X'8000'
Key Derivation.
X'8001'
Key Derivation Initial Key. This value cannot be used for working keys. This is the only value that is allowed for an initial terminal key.
Note: X'2000', X'2001', X'3000', and X'3001' do not represent complementary keys. A key derived using X'2000' will not be the same key as is derived for the X'2001' usage value. Instead, the values represent the viewpoint of the terminal operator (for example, whether the terminal will use the key for that purpose).
4 2 Algorithm indicator Indicates the encipherment algorithm that is going to use the derived key.
Allowed values:
X'0000'
2-key TDES.
X'0001'
3-key TDES.
X'0002'
AES 128 bit. This is the value range that is allowed for an initial terminal key.
X'0003'
AES 192 bit. This is the value range that is allowed for an initial terminal key.
X'0004'
AES 256 bit. This is the value range that is allowed for an initial terminal key.
X'0005'
HMAC.
6 2 Length Length, in bits, of the keying material being generated.
Allowed values:
X'0080'
If 128 bits is being generated (AES-128, 2TDES, or 128-bit HMAC key). This is the only value that is allowed for an initial terminal key.
X'00C0'
If 192 bits is being generated (AES-192, 3TDES, or 192-bit HMAC key). This is the only value that is allowed for an initial terminal key.
X'0100'
If 256 bits is being generated (AES-256 or 256-bit HMAC key). This is the only value that is allowed for an initial terminal key.
8 8 Initial key ID The terminal’s initial key ID, the leftmost 64 bits of the key serial number.

Allowed range: X'0000000000000000' to X'FFFFFFFFFFFFFFFF'.

16 4 Transaction counter The 32-bit transaction counter.

Allowed range: X'00000000' to X'FFFFFFFF'.

Supported CCA key types for AES-DUKPT derived working keys

The following table lists the types of CCA keys that can be derived using the AES-DUKPT algorithm:

Table 2. Supported CCA key types for AES-DUKPT derived working keys

Supported CCA key types for AES-DUKPT derived working keys.

Derived working key AES key type 2-Key TDES/3-Key TDES key type
PIN Encryption PINPROT IPINENC/OPINENC
MAC MAC MAC / MACVER
Key encrypting key IMPORTER/EXPORTER IMPORTER/EXPORTER
Key derivation key DKYGENKY KEYGENKY (2-Key TDES only)
Data encryption CIPHER CIPHER/ENCIPHER/DECIPHER
HMAC N/A N/A

AES-DUKPT allowed derived working key sizes

ANSI X9.24 specifies that working keys shall be the same strength or weaker than the key from which they are derived. The following table shows allowed working key sizes per AES Base Derivation Key size:

Table 3. AES-DUKPT allowed derived working key sizes

AES-DUKPT allowed derived working key sizes.

Derived working key AES-128 base derivation key AES-192 base derivation key AES-256 base derivation key
2TDES allowed allowed allowed
3TDES allowed allowed allowed
AES-128 allowed allowed allowed
AES-192 not allowed allowed allowed
AES-256 not allowed not allowed allowed
HMAC-128 allowed allowed allowed
HMAC-192 not allowed allowed allowed
HMAC-256 not allowed not allowed allowed