How to use the simulator

Jan 20, 2010 at 11:15 AM

Can someone give me a user manual to use the simulator I am new to Racal HSM. 

Jan 20, 2010 at 4:12 PM

As mentioned in the project frontpage:

What would one need to use this library?
A good level of understanding of the Thales HSM is essential. Knowledge of VB.Net and Visual Studio 2008 is also recommended, but any person that attempts to use the library without knowing how the Thales HSM works does not stand any real chance of making good use of the library.

I never got around creating any serious documentation, apart from the source code comments which are pretty complete but don't really help end-users. In order to understand how the simulator works, you would need to know how a Thales HSM works. In order to do that, you need to gain access to the Thales guides.

Jan 21, 2010 at 9:39 AM

I have comipled the HSM in .net and depolyed it. If you could tell me what is the process I need to do to connect to the HSM it will be helpfull.


Jan 21, 2010 at 4:40 PM

You need to open a socket and connect to the simulator's port (default value is 9998 if you haven't changed ThalesParameters.xml). You then build a command message and send it to the simulator, which responds back. All messages are preceeded by a 2-byte software header that holds the length of the message data (excluding the length of the header itself).

Jan 22, 2010 at 1:06 PM

Can you provide me with sample message with hex and binary format. This will help me code.


Jan 22, 2010 at 5:39 PM
Edited Jan 22, 2010 at 5:43 PM

Sure, try sending 0000BU0200406FBB23A5214DF. Don't forget to start with the 2-byte software header.

Mar 3, 2010 at 12:43 PM


Thanks for the help I am now able to generate Keys. Does the simulator support PIN Veriification and PIN Translation command. Which commands does it support ?



Saji Pillai

Mar 3, 2010 at 6:05 PM

The following PIN verification commands are supported:

  • DC/EC: Verify terminal/interchange PIN using the VISA method.
  • BC/BE will be implemented soon: Verify terminal/interchange PIN using the comparison method.

The following translation commands are supported:

  • JG: Translate PIN block from LMK to ZPK.
  • JC: Translate PIN block from TPK to LMK.
  • CA: Translate PIN block from TPK to ZPK.
  • JE: Translate PIN block from ZPK to LMK.
  • CC: Translate PIN block from ZPK to another ZPK.
Oct 4, 2010 at 10:12 AM

hi all.

@nickntg first off, thanks for developing this, now i won't have to get a Thales HSM to test my application :D

if i understand you correctly, i need to prefix commands sent via TCP/IP with 0000 if i want to get any response. i was testing from a Java application with this code (sorry for pasting it inline - for some reason the code editor window isn't working properly on my connection/machine:

Socket socket = new Socket("", 9998);

InputStream in = socket.getInputStream();
OutputStream out = socket.getOutputStream();
BufferedOutputStream buffered = new BufferedOutputStream(out, 1024);

// perform a diagnostics check
// send header
 String command = "0000NC"; // <-- doesn't work without the 0000
byte [] inBuffer = (" " + command).getBytes();
inBuffer[0] = (byte) (command.length() / 256);
inBuffer[1] = (byte) (command.length() % 256);
System.out.println((int) inBuffer[1]);

i kept seeing exceptions in the simulator when the 0000 (sub)string was not present.  it wasn't until i found this thread that i tested using it and it worked. i just thought it might make it clear to everyone who wasn't using the ThalesCore.dll assembly.

Oct 4, 2010 at 11:23 AM

That's correct, 0000 is a small header that must come before each message.

To be accurate, you don't need to send 0000 - any four characters will do. The purpose of this header is to be able to identify request/response pairs in a high-load scenario. If you send simultaneous requests to the simulator (or a real HSM for that matter), you need to be able to match the correct responses to original requests because they might not arrive in the original order. You can use the header to do that.

Sep 17, 2011 at 1:24 PM

I guess the header should be 1234, right?

I'm sorry, if i am wrong...

Sep 17, 2011 at 3:14 PM

Yo must download the last version of Thales Simulator, use the project PVVClashing Demo, it's very usefull.

From: [email removed]
To: [email removed]
Date: Sat, 17 Sep 2011 05:24:46 -0700
Subject: Re: How to use the simulator [thalessim:81410]

From: naresh519
I guess the header should be 1234, right?
I'm sorry, if i am wrong...
Read the full discussion online.
To add a post to this discussion, reply to this email (
To start a new discussion for this project, email
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at