Search code examples
encodingcryptographyhexemvhsm

HSM KW command to validate ARQC


I am trying to send KW command to Thales HSM, the description for one of the field data is:

 ----------------------------------------------------------------
| PAN/PAN Sequence No | 8B | this field will be fixed at 8 bytes |
 ----------------------------------------------------------------

Let say my data is 6542000000193400.

Does that means I have to convert it from hex to char?


Solution

  • Yes, it would mean that you would need to decode your hexadecimals to char before inserting it into the command data.

    You've written your data in hexadecimals. So if your data really is in hexadecimals inside your application then you need to hex decode to bytes. Bytes are represented by the char or unsigned char in the C/C++ language.

    Note that bytes are often represented to you (by e.g. debuggers) in hexadecimals. So you should be careful not to decode bytes that are not actually hexadecimals. Check the origin and size of the hex before you start.