Open Source Payment HSM Simulators

.NET

ThalesSim – a simulator for legacy Racal & Thales-compatible HSMs for the .NET platform. The code is mostly written in Visual Basic, with some C# for good measure. Unlike most of these simulators, the ThalesSim includes a GUI mode option, in order to monitor simulated HSM operations, as well as being able to run as a service.

ThalesSim was originally hosted on CodePlex, but this is being shut down in July 2021. The github link above is a forked copy of the original source.

The set of commands supported is quite extensive, and includes both host and console commands.

A0 Generate key
A2 Generate and print a component
A4 Form key from encrypted components
A6 Import key
A8 Export key
AE Translate a TMK, TPK or PVK from LMK to TMK, TPK or PVK encryption
AG Translate a TAK from LMK to TMK encryption
AS Generate a VISA CVK pair
AU Translate a CVK pair from ZMK to LMK encryption
AW Translate a CVK pair from LMK to ZMK encryption
B0 Translate key scheme
B2 Echo test
BA Encrypts a clear PIN text
BC Verify a terminal PIN using the comparison method
BE Verify an interchange PIN using the comparison method
BI Generate a BDK
BQ Translate a PIN from VISA to Racal encryption
BU Generate check value
BY Translate a ZMK from ZMK to LMK encryption
BW Translate keys from old LMK to new LMK
CA Translate a PIN block from TPK to ZPK encryption
CC Translate a PIN block from one ZPK to another
CI Translate PIN from DUKPT to ZPK
CK Verify a DUKPT PIN using the IBM method
CM Verify a DUKPT PIN using the VISA method
CU Verify and generate a VISA PVV
CW Generate a VISA CVV
CY Verify a VISA CVV
DA Verify a terminal PIN using the IBM method
DE Generate an IBM offset
DC Verify a terminal PIN using the VISA algorithm
DG Generate a VISA PVV
DW Translate a BDK from ZPK to LMK encryption
DY Translate a BDK from LMK to ZPK encryption
EA Verify an interchange PIN using the IBM method
EE Derive a PIN using the IBM method
EC Verify an interchange PIN using the VISA algorithm
FA Translate a ZPK from ZMK to LMK encryption
FC Translate a TMK, TPK or PVK from ZMK to LMK encryption
FE Translate a TMK, TPK or PVK from LMK to ZMK encryption
FG Generate a pair of random PVKs
FI Generate a ZEK or ZAK
FK Translate a ZEK or ZAK from ZMK to LMK encryption
FM Translate a ZEK or ZAK from LMK to ZMK encryption
G0 Translate PIN from DUKPT to ZMK (3DES)
GC Translate a ZPK from LMK to ZMK encryption
GG Form ZMK from three components
GM Hash a block of data
GY Form ZMK from two to nine components
HA Generate a TAK
HC Generate a TMK, TPK or PVK
IA Generate a ZPK
JA Generate a random PIN
JC Translate a PIN from TPK to LMK encryption
JE Translate a PIN from ZPK to LMK encryption
JG Translate a PIN from LMK to ZPK encryption
K2 Verify Truncated Application Cryptogram (alpha)
KA Generate check value
KQ ARQC verification and ARPC generation
LG Set HSM delay
LI Load PIN text string
M6 Generate a MAC
M8 Verify a MAC
MA Generate a MAC
MC Verify a MAC
ME Verify and translate a MAC
MG Translate a TAK from LMK to ZMK encryption
MI Translate a TAK from ZMK to LMK encryption
MQ Generate MAC/MAB for large message
MS Generate MAC/MAB using ANSI X9.19
NC Perform HSM diagnostics
NE Generate and print split components
NG Decrypt an encrypted PIN
NK Command chaining
NO HSM status
OA Print solicitation mailer
OC Generate and print ZMK component
OE Generate and print a random TMK, TPK or PVK
PA Load formatting data
PC Load additional formatting data
PE Verify PIN solicitation data
PG Verify PIN solicitation mailer cryptography
PM Verify a dynamic CVV
RA Cancel the authorization state
RC Verify solicitation mailer cryptography

Supported ThalesSim commands from github