Using M0 Command.

Jan 17, 2013 at 2:51 PM
Edited Jan 17, 2013 at 3:08 PM

Hi,

 

I am trying to use the M0 command to encryt a data block.

Here is my raw byte command sent to the hsm:

004530303030303030304D303030313130304232373441353632423730343234443343323734413536324237303432344433433030304630303030303030303030303030303030

Which is broken down as:

00453030303030303030 - Message Header (E00000000)

4D30 - M0

3030 - 00 (Mode Flag - 00 - ECB)

31 - 1 (Input format - 1N)

31 - 1 (Output format - 1N)

303042- 00B (Key type - DEK)

3237344135363242373034323444334332373441353632423730343234443343 - 274A562B70424D3C274A562B70424D3C (Key - 16H)

30303046 - 000F (Data length - 4H)

30303030303030303030303030303030 - 0000000000000000 (Data - 16H)

 

Here is the response from the HSM:

Raw response data: 4D313036

Response code: M1

Error code: 06 (Invalid Message length)

I am wondering why is it complaining about my message length which I think is ok. Please help with this.

Jan 18, 2013 at 6:25 PM

Never mind. I got it fixed.

The problem was my data length, it was supposed to be 0010 instead of 000F.