Quantcast
Channel: Thales Simulator Library
Viewing all articles
Browse latest Browse all 332

New Post: How to interact with HSM using JAVA

$
0
0
Hi Amrutansu,

Sorry for long silence,

You are forgetting to add software header (message length) to command, OutputStream do not add it itself.

If you want to use OutputStream just add the length of the command before it as 2 bytes, like in example below:
    private static byte[] length2byte (int len) {
        byte[] b = new byte[2];
        b[0] = (byte)(len / 256);
        b[1] = (byte)(len % 256);
        return b;
    }
The method abowe returns the 2 byes containing the length of message. For example, if you need to send to HSM 0001NC the commmand itself should look like \00\060001NC. With '\' I have escaped binary data.

That should work for you.

Regards,
Juris

Viewing all articles
Browse latest Browse all 332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>