← Payment Reference GuidesKey Management Standards

TR-31 & TR-34

The two foundational ANSI X9 standards for secure cryptographic key exchange between Hardware Security Modules. TR-31 defines the key block format that binds usage attributes to the key value. TR-34 defines the RSA-based protocol for distributing those key blocks from a Key Distribution Host to receiving devices without human key ceremonies.

ANSI X9.143PCI HSMHSM Key ExchangeRSA-OAEPCMS / ASN.1

TR-31 Field Reference

Complete lookup tables for all TR-31 header field codes. Every field in the 16-character header is defined by these values.

Key Usage Codes

CodeKey TypeTypical HSM Command
B0Base Derivation Key (BDK) — DUKPTGenerateBDK, InjectIPEK
B1Initial Derivation Key (IPEK)DeriveIPEK
B3DUKPT Initial KeyLoadIPEK
C0Card Verification Key (CVK / CVK-A, CVK-B)GenerateCVV, VerifyCVV
C1Card Verification Key for CVC3 (contactless)GenerateCVC3
D0Data Encryption Key (symmetric)Encrypt, Decrypt data blocks
E0EMV Issuer Master Key — Application Cryptogram (ARQC/AC)GenerateARQC, VerifyARQC
E1EMV Issuer MK — Secure Messaging ConfidentialitySM Encrypt
E2EMV Issuer MK — Secure Messaging IntegritySM MAC
E4EMV Issuer MK — Dynamic NumbersGenerateDynNum
K0Key Encryption / Wrapping Key (KEK / ZMK)EncryptKey, ExportKey
K1TR-31 Key Block Protection Key (KBPK)ImportKeyBlock, ExportKeyBlock
K2TR-34 Asymmetric Key (for transport)TR34ImportKey
M0ISO 16609 MAC Key (3DES)GenerateMAC, VerifyMAC
M6CMAC Key (AES, ISO 9797-1 Alg 5)GenerateCMAC
M7HMAC KeyGenerateHMAC
P0PIN Encryption Key (PEK / ZPK)EncryptPIN, TranslatePIN
S0Asymmetric Signing Key-PairSign, Verify
V0PIN Verification Key (PVK)VerifyPIN (IBM 3624)
V1PVV Key (Visa PIN Verification Value)GeneratePVV, VerifyPVV

Algorithm Codes

CodeAlgorithm
AAES — 128, 192, or 256-bit
DDEA — Single DES (56-bit, legacy)
EElliptic Curve (EC)
HHMAC (key material)
RRSA
TTriple DEA — 2TDEA or 3TDEA (3DES)

Mode of Use Codes

CodeAllowed Operations
BBoth — Encrypt and Decrypt
CMAC Calculate only
DDecrypt only
EEncrypt only
GMAC Generate only
NNo special restriction
SSignature only
TBoth — Sign and Decrypt
VVerify only
XKey Derivation only
YCreate Key Variants only

Exportability Codes

CodeMeaning
EExportable. May be wrapped under another KEK and exported. Typically used for KEKs and ZMKs that need to travel between entities.
NNon-exportable. Must never leave the HSM boundary, even wrapped. Enforced by the HSM firmware. Typical for PIN keys, CVKs, and IMKs.
SSensitive. May only be exported under a specifically authorised trusted key. Intermediate between E and N.

Version / Binding Methods

VersionBindingKey Size
ADES, variant binding56-bit DEA (deprecated)
B2TDEA, variant binding112-bit 2TDEA
C3TDEA, variant binding168-bit 3TDEA (deprecated)
DAES, CMAC binding128/192/256-bit AES

TR-34 Cryptographic Requirements

ComponentAlgorithmNotes
Asymmetric key sizeRSA-2048 minimumRSA-3072 or RSA-4096 recommended for new deployments. EC not defined in TR-34.
Asymmetric encryptionRSA-OAEP with SHA-256Encrypts the Content Encryption Key (CEK) for the KRD.
Symmetric encryption (CMS)AES-128-CBC or AES-256-CBCThe CEK encrypts the key payload inside the EnvelopedData.
Signature algorithmRSA with SHA-256 (PKCS#1 v1.5 or RSA-PSS)Signs the entire EnvelopedData structure.
Certificate formatX.509v3Must include KeyUsage and ExtendedKeyUsage extensions appropriate for key transport.
Message formatCMS (RFC 5652 / ANS X9.73)DER-encoded ASN.1 binary, typically Base64 for transport.
Replay protection (2-pass)8-byte random nonce (RKRD)Generated by KRD; included in encrypted payload.
Replay protection (1-pass)UTC timestamp + sequence numberReplay window ±5 minutes; sequence must be monotonically increasing.