DevLearn
Back to Payments & Banking
payments

HSM & Cryptography

Hardware Security Modules for PIN, keys, and EMV cryptograms

HSM & Cryptography — Overview

Hardware Security Modules for PIN, keys, and EMV cryptograms

HSMs (Thales, Utimaco) generate and store keys in tamper-proof hardware. Used for PIN translation, EMV ARQC/ARPC verification, key exchange (TR-31), and TLS key protection. Keys never leave HSM in plaintext.

// HSM operations (PKCS#11 / vendor API)
// PIN block translation
hsm.translatePin(
  encryptedPinBlock,  // From ATM/POS
  sourceKeyId,        // Zone PIN Key
  destinationKeyId    // Issuer PIN Key
);

// EMV ARQC verification
VerifyResult result = hsm.verifyArqc(
  masterKeyId,
  pan, atc, unpredictableNumber,
  arqc, amount, currencyCode
);

// Key ceremony — dual control
// 1. Generate key in HSM
// 2. Split into components (2-of-3)
// 3. Load to production HSM under ceremony
// 4. Never export plaintext key
Tip: FIPS 140-2 Level 3 HSM required for PIN processing — software-only key storage fails PCI PIN requirements.