Thalse hsm communication

244 views
Skip to first unread message

Kapilashantha Rajapaksha

unread,
Sep 14, 2024, 10:16:32 PM9/14/24
to jpos-...@googlegroups.com
Is it possible to use Q2 server to keep persistent socket connection with Hsm an proceess async calling.?

Appreciate any direction from experts 

Alejandro Revilla

unread,
Sep 14, 2024, 10:22:54 PM9/14/24
to jpos-...@googlegroups.com
We've impleented drivers for most HSMs (Atalla, Thales, Utimaco, Futurex, etc. and cloud HSM offerings) using Q2.

Because the specs are not public, this code is not open source, but it can certainly be done. We use them as part of jCard/jPTS.



On Sat, Sep 14, 2024 at 11:16 PM Kapilashantha Rajapaksha <kapila...@gmail.com> wrote:
Is it possible to use Q2 server to keep persistent socket connection with Hsm an proceess async calling.?

Appreciate any direction from experts 

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV2a79sCz%2BkXu493p00P-8S6GPi-Ah5c_HP1BP7vC-v%3D3g%40mail.gmail.com.

Kapilashantha Rajapaksha

unread,
Sep 14, 2024, 10:36:30 PM9/14/24
to jpos-...@googlegroups.com
Thanks for your reply and got it.  So i guess that i have to look my own way right?



chhil

unread,
Sep 15, 2024, 8:41:02 PM9/15/24
to jpos-...@googlegroups.com
Talk to the hsm using a mux by determining which field to match on for request response matching, we use the header with an incremental counter that is echoed back by Thales. 
A mux can do an asynch request. 

-chhil

On Sun, Sep 15, 2024, 7:46 AM Kapilashantha Rajapaksha <kapila...@gmail.com> wrote:
Is it possible to use Q2 server to keep persistent socket connection with Hsm an proceess async calling.?

Appreciate any direction from experts 

--

Kapilashantha Rajapaksha

unread,
Sep 15, 2024, 10:00:37 PM9/15/24
to jpos-...@googlegroups.com
For this, I can use  first 4 bytes (header), it will respond  with the same header. But when I check mux, the package always iso message. Can mux use any non-standard protocols ? 

Andrés Alcarraz

unread,
Sep 15, 2024, 11:14:16 PM9/15/24
to jPOS Users
Look for FSDISOMsg, I believe there are some threads about that in the list.

----
Enviado desde mi móvil, disculpas por la brevedad.

Sent from my cellphone, I apologize for the brevity.

Andrés Alcarraz.

murtuza chhil

unread,
Sep 15, 2024, 11:48:36 PM9/15/24
to jPOS Users

Kapilashantha Rajapaksha

unread,
Sep 16, 2024, 2:56:56 AM9/16/24
to jpos-...@googlegroups.com
Hi Chhil,

I'm looking at mentioned post. 

image.png

HSMChannel class I couldn't find with jpos lib (latest).

Thanks

Mark Salter

unread,
Sep 16, 2024, 4:14:58 AM9/16/24
to jpos-...@googlegroups.com
Which Channel are you currently talking to your HSM through?  Use that
instead?


--

Mark


signature.asc

Kapilashantha Rajapaksha

unread,
Sep 16, 2024, 5:19:57 AM9/16/24
to jpos-...@googlegroups.com
Hi Mark,

I'm currently not calling to hsm, this effort to do from jpos lib,

as per Chhil code, I cannot find out hsm packager in jpos lib now

image.png

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.  Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

Andrés Alcarraz

unread,
Sep 16, 2024, 6:23:26 AM9/16/24
to jPOS Users
You don't need that class, that part of the post is not the answer, but the question.

You need to look for the part where the channel to talk to the HSM is defined (21_hsm_channel.xml), in the participant you can would need to use the mux, not the channel.

The answer will not provide a complete working example, just read through it and understand the concepts.

----
Enviado desde mi móvil, disculpas por la brevedad.

Sent from my cellphone, I apologize for the brevity.

Andrés Alcarraz.

Andrés Alcarraz

unread,
Sep 16, 2024, 6:37:22 AM9/16/24
to jPOS Users

BTW, you will still need to implement the FSD schema for talking to the HSM.

----
Enviado desde mi móvil, disculpas por la brevedad.

Sent from my cellphone, I apologize for the brevity.

Andrés Alcarraz.

Kapilashantha Rajapaksha

unread,
Sep 16, 2024, 9:21:15 PM9/16/24
to jpos-...@googlegroups.com
I tried below 

package org.example;

import org.jpos.util.FSDMsg;

public class Main1 {


public static void main(String [] args) throws Exception {
ThalesAdaptor adaptor = new ThalesAdaptor("xx.xx.xx.xx", 1700);
adaptor.connect();
FSDMsg req = adaptor.diagnostics();
req.dump(System.out, " ");
FSDMsg resp = adaptor.command(req);
resp.dump(System.out, " ");
resp.dump(System.out, " ");
}
}



package org.example;

import org.jpos.iso.FSDISOMsg;
import org.jpos.iso.channel.FSDChannel;
import org.jpos.iso.packager.FSDPackager;
import org.jpos.util.FSDMsg;

public class ThalesAdaptor {
private FSDChannel channel;

public ThalesAdaptor(String host, int port) {
channel = new FSDChannel();
channel.setHost(host, port);
channel.setPackager(new FSDPackager());
}

public void connect() throws Exception {
channel.connect();
}

private FSDMsg createRequest(String command) {
FSDMsg req = new FSDMsg("file:cfg/hsm-");

if (command != null)
req.set("command", command);

return req;
}

private FSDMsg createResponse(String response) {
FSDMsg resp = new FSDMsg("file:cfg/hsm-resp-");

if (response != null)
resp.set("response", response);

return resp;
}

public FSDMsg diagnostics() {
return createRequest("NC");
}

public FSDMsg generateDoubleLengthKey() {
FSDMsg req = createRequest("A0");
req.set("mode", "0");
req.set("key-type", "001");
req.set("key-scheme-lmk", "U");

return req;
}

public FSDMsg command(FSDMsg request) throws Exception {
StringBuffer sbuffer = new StringBuffer(request.get("command"));
sbuffer.setCharAt(1, (char) (sbuffer.charAt(1) + 1));
FSDMsg resp = createResponse(sbuffer.toString());

FSDISOMsg msg = new FSDISOMsg(request); // NEW
msg.setHeader(new byte[] { (byte) 1, (byte) 2, (byte) 3, (byte) 4});

channel.send(msg);

byte [] buffer = new byte [1024];
byte [] buffer2 = new byte[1024];

//channel.getBytes(buffer);
FSDISOMsg rep = new FSDISOMsg(resp); // NEW
rep.merge(channel.receive()); // NEW

// message length (network byte order) and header account for the
// first 6 received bytes. remove them for the actual message
//System.arraycopy(buffer, 6, buffer2, 0, buffer.length - 6);

//resp.unpack(buffer2);

// return resp;

return rep.getFSDMsg(); // NEW
}
}



Project folders 

image.png


hsm-base.xml

<?xml version="1.0" encoding="UTF-8"?>
<schema>
<field id="command" type="A" length="2" key="true" />
</s
hsm-base-resp.xml
<?xml version="1.0" encoding="UTF-8"?>
<schema>
<field id="response" type="A" length="2" key="true" />
<field id="error" type="A" length="2" />
</s

<?xml version="1.0" encoding="UTF-8"?>
<schema id='NC'>
</s

<?xml version="1.0" encoding="UTF-8"?>
<schema id='ND'>
<field id="lmk-check-value" type="A" length="16" />
<field id="firmware-number" type="A" length="9" />
</s

pom.xml 

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.jpos</groupId>
<artifactId>jpos</artifactId>
<version>2.1.9</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.12</version>
</dependency>
</dependencies>


I'm getting below exception during packing 

<fsdmsg schema='file:cfg/hsm-base'>
   command: 'NC'
 </fsdmsg>
Exception in thread "main" org.jpos.iso.ISOException: java.lang.NullPointerException (java.lang.NullPointerException)
at org.jpos.iso.FSDISOMsg.pack(FSDISOMsg.java:44)
at org.jpos.iso.BaseChannel.pack(BaseChannel.java:986)
at org.jpos.iso.BaseChannel.send(BaseChannel.java:598)
at org.jpos.iso.channel.FSDChannel.send(FSDChannel.java:61)
at org.example.ThalesAdaptor.command(ThalesAdaptor.java:60)
at org.example.Main1.main(Main1.java:13)
Nested:java.lang.NullPointerException
at java.base/java.lang.String.getBytes(String.java:1817)
at org.jpos.util.FSDMsg.packToBytes(FSDMsg.java:240)
at org.jpos.iso.FSDISOMsg.pack(FSDISOMsg.java:42)
at org.jpos.iso.BaseChannel.pack(BaseChannel.java:986)
at org.jpos.iso.BaseChannel.send(BaseChannel.java:598)
at org.jpos.iso.channel.FSDChannel.send(FSDChannel.java:61)
at org.example.ThalesAdaptor.command(ThalesAdaptor.java:60)
at org.example.Main1.main(Main1.java:13)
Disconnected from the target VM, address: '127.0.0.1:54046', transport: 'socket'


When I point debug 


image.png



Looking for your advice. 

Thanks 

Andrés Alcarraz

unread,
Sep 16, 2024, 9:54:21 PM9/16/24
to jpos-...@googlegroups.com

I can’t see how FSDMsg.pack() can return a null.

Could you share that project (that I guess is just a POC without sensitive info) as a packaged file or, better yet, through git? So you make us easier to help you than having to create the project and every single file to reproduce?

Andrés Alcarraz

Kapilashantha Rajapaksha

unread,
Sep 16, 2024, 10:10:43 PM9/16/24
to jpos-...@googlegroups.com
Hi Alcarraz, 

Attached my project . Nothing any sensitive info 

HSM.zip

Andrés Alcarraz

unread,
Sep 16, 2024, 11:30:54 PM9/16/24
to jpos-...@googlegroups.com
Hi Rajapaksha,

It seems that |FSDChannel| assume it is always configured through
|setConfiguration|. So when you just use the default constructor it
initializes with a null |charset| wich is what is causing the NPE. A
simple workaround would be to call |channel.setConfiguration(new
SimpleConfiguration())| just after the call to the default constructor:

|public ThalesAdaptor(String host, int port) throws
ConfigurationException { channel = new FSDChannel();
channel.setConfiguration(new SimpleConfiguration());
channel.setHost(host, port); channel.setPackager(new FSDPackager()); } |

This won’t happen in the real project when you use Q2 to initiate
everything, which I encourage you to do as early as possible, i.e., as
soon as this first POC works. I will try to create an issue and a PR to
fix this.

I couldn’t test the receive part since I don’t have an HSM to connect
to, and I don’t want to set up a simulator or an echo. Also, you don’t
need to create the response in your adaptor, the channel will create it
for you. I believe you need to also set the schema for the response,
which I think you can do by adding it to the configuration object for now.

Andrés Alcarraz
>> channel =new FSDChannel();
>> channel.setHost(host, port);
>> channel.setPackager(new FSDPackager());
>> }
>>
>> public void connect()throws Exception {
>> channel.connect();
>> }
>>
>> private FSDMsgcreateRequest(String command) {
>> FSDMsg req =new FSDMsg("file:cfg/hsm-");
>>
>> if (command !=null)
>> req.set("command", command);
>>
>> return req;
>> }
>>
>> private FSDMsgcreateResponse(String response) {
>> FSDMsg resp =new FSDMsg("file:cfg/hsm-resp-");
>>
>> if (response !=null)
>> resp.set("response", response);
>>
>> return resp;
>> }
>>
>> public FSDMsgdiagnostics() {
>> return createRequest("NC");
>> }
>>
>> public FSDMsggenerateDoubleLengthKey() {
>> FSDMsg req = createRequest("A0");
>> req.set("mode","0");
>> req.set("key-type","001");
>> req.set("key-scheme-lmk","U");
>>
>> return req;
>> }
>>
>> public FSDMsgcommand(FSDMsg request)throws Exception {
>> StringBuffer sbuffer =new StringBuffer(request.get("command"));
>> sbuffer.setCharAt(1, (char) (sbuffer.charAt(1) +1));
>> FSDMsg resp = createResponse(sbuffer.toString());
>>
>> FSDISOMsg msg =new FSDISOMsg(request);// NEW msg.setHeader(new byte[] { (byte)1, (byte)2, (byte)3, (byte)4});
>>
>> channel.send(msg);
>>
>> byte [] buffer =new byte [1024];
>> byte [] buffer2 =new byte[1024];
>>
>> //channel.getBytes(buffer); FSDISOMsg rep =new FSDISOMsg(resp);// NEW rep.merge(channel.receive());// NEW // message length (network byte order) and header account
>> for the // first 6 received bytes. remove them for the actual
>> message //System.arraycopy(buffer, 6, buffer2, 0, buffer.length -
>> 6); //resp.unpack(buffer2); // return resp; return rep.getFSDMsg();// NEW }
>> }
>>
>>
>>
>> Project folders
>>
>> <http://127.0.0.1:54046>', transport: 'socket'
>>
>>
>> When I point debug
>>
>>
>> <https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV2a79sCz%2BkXu493p00P-8S6GPi-Ah5c_HP1BP7vC-v%3D3g%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>
>> --
>> --
>> jPOS is licensed under AGPL - free
>> for community usage for your
>> open-source project. Licenses are
>> also available for commercial usage.
>> Please support jPOS, contact:
>> sa...@jpos.org
>> ---
>> You received this message because you
>> are subscribed to the Google Groups
>> "jPOS Users" group.
>> To unsubscribe from this group and
>> stop receiving emails from it, send
>> an email to
>> jpos-users+...@googlegroups.com.
>> To view this discussion on the web
>> visit
>> https://groups.google.com/d/msgid/jpos-users/CAPazefBcHNX0ezAUPF86Zj1fDsOXi%3DkS_L8dVY0-T-k3ZXGYmQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jpos-users/CAPazefBcHNX0ezAUPF86Zj1fDsOXi%3DkS_L8dVY0-T-k3ZXGYmQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>
>> --
>> --
>> jPOS is licensed under AGPL - free for
>> community usage for your open-source
>> project. Licenses are also available for
>> commercial usage. Please support jPOS,
>> contact: sa...@jpos.org
>> ---
>> You received this message because you are
>> subscribed to the Google Groups "jPOS
>> Users" group.
>> To unsubscribe from this group and stop
>> receiving emails from it, send an email
>> to jpos-users+...@googlegroups.com.
>>
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV3xf69OgAaF44d8fcVvgx8Fzy%2BeqHc3XwUaZsUSiyNBdw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV3xf69OgAaF44d8fcVvgx8Fzy%2BeqHc3XwUaZsUSiyNBdw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>
>> --
>> --
>> jPOS is licensed under AGPL - free for community
>> usage for your open-source project. Licenses are
>> also available for commercial usage. Please
>> support jPOS, contact: sa...@jpos.org
>> ---
>> You received this message because you are
>> subscribed to the Google Groups "jPOS Users" group.
>> To unsubscribe from this group and stop receiving
>> emails from it, send an email to
>> jpos-users+...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jpos-users/41195d3b-7583-4170-b1b3-597f9905cddfn%40googlegroups.com
>> <https://groups.google.com/d/msgid/jpos-users/41195d3b-7583-4170-b1b3-597f9905cddfn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>
>> --
>> --
>> jPOS is licensed under AGPL - free for community
>> usage for your open-source project. Licenses are also
>> available for commercial usage. Please support jPOS,
>> contact: sa...@jpos.org
>> ---
>> You received this message because you are subscribed
>> to the Google Groups "jPOS Users" group.
>> To unsubscribe from this group and stop receiving
>> emails from it, send an email to
>> jpos-users+...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV2XMuSBRfUJy05c5Qx5xFFnSn1sm7q5UgDibqpsVfeS-g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV2XMuSBRfUJy05c5Qx5xFFnSn1sm7q5UgDibqpsVfeS-g%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>
>> --
>> --
>> jPOS is licensed under AGPL - free for community usage for
>> your open-source project. Licenses are also available for
>> commercial usage. Please support jPOS, contact: sa...@jpos.org
>> ---
>> You received this message because you are subscribed to the
>> Google Groups "jPOS Users" group.
>> To unsubscribe from this group and stop receiving emails from
>> it, send an email to jpos-users+...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jpos-users/CAACHDe02RuZeyPywRGZ7-LJz01Vya36jvCQYRdasgXYmRQ%3DMjg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jpos-users/CAACHDe02RuZeyPywRGZ7-LJz01Vya36jvCQYRdasgXYmRQ%3DMjg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>
>> --
>> --
>> jPOS is licensed under AGPL - free for community usage for your
>> open-source project. Licenses are also available for commercial
>> usage. Please support jPOS, contact: sa...@jpos.org
>> ---
>> You received this message because you are subscribed to the
>> Google Groups "jPOS Users" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an email to jpos-users+...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV0-ONCzyDGf3j9X%2BWqRXgt3ZO-ROUoidCHgvL%2BLRjGz%2BA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV0-ONCzyDGf3j9X%2BWqRXgt3ZO-ROUoidCHgvL%2BLRjGz%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> ​
> --
> --
> jPOS is licensed under AGPL - free for community usage for your
> open-source project. Licenses are also available for commercial
> usage. Please support jPOS, contact: sa...@jpos.org
> ---
> You received this message because you are subscribed to the Google
> Groups "jPOS Users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to jpos-users+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jpos-users/afd6b2cf-618a-42d5-a94f-733025042d8e%40gmail.com
> <https://groups.google.com/d/msgid/jpos-users/afd6b2cf-618a-42d5-a94f-733025042d8e%40gmail.com?utm_medium=email&utm_source=footer>.
>
> --
> --
> jPOS is licensed under AGPL - free for community usage for your
> open-source project. Licenses are also available for commercial usage.
> Please support jPOS, contact: sa...@jpos.org
> ---
> You received this message because you are subscribed to the Google
> Groups "jPOS Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jpos-users+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV2RSAZFj%3DLd9iPmqLNeitfBASLBuakmxV4Uo0BWNHK9vQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/jpos-users/CAKV%2BfV2RSAZFj%3DLd9iPmqLNeitfBASLBuakmxV4Uo0BWNHK9vQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Kapilashantha Rajapaksha

unread,
Sep 17, 2024, 2:46:12 AM9/17/24
to jpos-...@googlegroups.com
Hi Alcarraz ,

thanks a lot, but i have got unpacking error now.

For your investigation , I have used demo hsm NC server class as well.

Exception in thread "main" org.jpos.iso.ISOException:
java.net.MalformedURLException: no protocol: base.xml
(java.net.MalformedURLException: no protocol: base.xml)
at org.jpos.iso.FSDISOMsg.unpack(FSDISOMsg.java:52)
at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:983)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:753)
at org.example.ThalesAdaptor.command(ThalesAdaptor.java:77)
at org.example.Main1.main(Main1.java:15)
Nested:java.net.MalformedURLException: no protocol: base.xml
at java.base/java.net.URL.<init>(URL.java:772)
at java.base/java.net.URL.<init>(URL.java:654)
at java.base/java.net.URL.<init>(URL.java:590)
at org.jpos.util.FSDMsg.loadSchema(FSDMsg.java:660)
at org.jpos.util.FSDMsg.getSchema(FSDMsg.java:635)
at org.jpos.util.FSDMsg.getSchema(FSDMsg.java:619)
at org.jpos.util.FSDMsg.unpack(FSDMsg.java:198)
at org.jpos.util.FSDMsg.unpack(FSDMsg.java:221)
at org.jpos.iso.FSDISOMsg.unpack(FSDISOMsg.java:49)
at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:983)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:753)
at org.example.ThalesAdaptor.command(ThalesAdaptor.java:77)
at org.example.Main1.main(Main1.java:15)

From Hsm side , I can see below trace

HSM REC :
0000 00 06 30 30 30 30 4E 43 00 00 00 00 00 00 00 00 ..0000NC........
0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0060 00 00 00 00 ....

HSM RES :
0000 00 21 31 32 33 34 4E 44 30 30 33 33 36 30 36 35 .!1234ND00336065
0010 36 34 36 36 31 31 32 36 31 35 31 35 30 30 2D 30 64661126151500-0
0020 30 33 30


I've resent with hsm demo server for NC





On Tue, Sep 17, 2024 at 11:30 AM Andrés Alcarraz <alca...@gmail.com> wrote:

> Hi Rajapaksha,
>
> It seems that FSDChannel assume it is always configured through
> setConfiguration. So when you just use the default constructor it
>> public static void main(String [] args) throws Exception {
>> ThalesAdaptor adaptor = new ThalesAdaptor("xx.xx.xx.xx", 1700);
>> adaptor.connect();
>> FSDMsg req = adaptor.diagnostics();
>> req.dump(System.out, " ");
>> FSDMsg resp = adaptor.command(req);
>> resp.dump(System.out, " ");
>> resp.dump(System.out, " ");
>> }
>> }
>>
>>
>>
>>
>> package org.example;
>> import org.jpos.iso.FSDISOMsg;import org.jpos.iso.channel.FSDChannel;import org.jpos.iso.packager.FSDPackager;import org.jpos.util.FSDMsg;
>> public class ThalesAdaptor {private FSDChannel channel;
>> public ThalesAdaptor(String host, int port) {channel = new FSDChannel();channel.setHost(host, port);channel.setPackager(new FSDPackager());
>> }
>> public void connect() throws Exception {channel.connect();
>> }
>> private FSDMsg createRequest(String command) {
>> FSDMsg req = new FSDMsg("file:cfg/hsm-");
>> if (command != null)
>> req.set("command", command);
>> return req;
>> }
>> private FSDMsg createResponse(String response) {
>> FSDMsg resp = new FSDMsg("file:cfg/hsm-resp-");
>> if (response != null)
>> resp.set("response", response);
>> return resp;
>> }
>> public FSDMsg diagnostics() {return createRequest("NC");
>> }
>> public FSDMsg generateDoubleLengthKey() {
>> FSDMsg req = createRequest("A0");
>> req.set("mode", "0");
>> req.set("key-type", "001");
>> req.set("key-scheme-lmk", "U");
>> return req;
>> }
>> public FSDMsg command(FSDMsg request) throws Exception {
>> StringBuffer sbuffer = new StringBuffer(request.get("command"));
>> sbuffer.setCharAt(1, (char) (sbuffer.charAt(1) + 1));
>> FSDMsg resp = createResponse(sbuffer.toString());
>>
>> FSDISOMsg msg = new FSDISOMsg(request); // NEW msg.setHeader(new byte[] { (byte) 1, (byte) 2, (byte) 3, (byte) 4});
>> channel.send(msg);
>> byte [] buffer = new byte [1024];byte [] buffer2 = new byte[1024];
>> //channel.getBytes(buffer); FSDISOMsg rep = new FSDISOMsg(resp); // NEW rep.merge(channel.receive()); // NEW // message length (network byte order) and header account for the // first 6 received bytes. remove them for the actual message //System.arraycopy(buffer, 6, buffer2, 0, buffer.length - 6); //resp.unpack(buffer2); // return resp; return rep.getFSDMsg(); // NEW }
>> }
>>
>>
>>
>>
>> Project folders
>>
>> [image: image.png]
>> Disconnected from the target VM, address: '127.0.0.1:54046', transport:
>> 'socket'
>>
>>
>> When I point debug
>>
>>
>> [image: image.png]
>>>>> [image: image.png]
> https://groups.google.com/d/msgid/jpos-users/85f5a401-8758-454c-8111-4c1cea4ebf3a%40gmail.com
> <https://groups.google.com/d/msgid/jpos-users/85f5a401-8758-454c-8111-4c1cea4ebf3a%40gmail.com?utm_medium=email&utm_source=footer>
> .
>
HSM.zip

Mark Salter

unread,
Sep 17, 2024, 4:29:32 AM9/17/24
to jpos-...@googlegroups.com

Did you change these two lines at all :-

    FSDMsg req = new FSDMsg("file:cfg/hsm-");

	FSDMsg resp = new FSDMsg("file:cfg/hsm-resp-");

If so, what to?

I think these should be the correct URL form for a file:// and need to resolve relative to the current runtime directory location.  
Check the documentation.

--

Mark

signature.asc

Mark Salter

unread,
Sep 17, 2024, 4:30:02 AM9/17/24
to jpos-...@googlegroups.com

Did you change these two lines at all :-

    FSDMsg req = new FSDMsg("file:cfg/hsm-");

	FSDMsg resp = new FSDMsg("file:cfg/hsm-resp-");

If so, what to?

I think these should be the correct URL form for a file:// and need to resolve relative to the current runtime directory location.  
Check the documentation.

--

Mark

signature.asc

Kapilashantha Rajapaksha

unread,
Sep 17, 2024, 6:17:11 AM9/17/24
to jpos-...@googlegroups.com
Hi Mark,

I changed and try 
private FSDMsg createRequest(String command) {
FSDMsg req = new FSDMsg("file://cfg/hsm-");


if (command != null)
req.set("command", command);

return req;
}

private FSDMsg createResponse(String response) {
    FSDMsg resp = new FSDMsg("file://cfg/hsm-resp-");


if (response != null)
resp.set("response", response);

return resp;
}

But now i'm getting below error in packing (not receiving any message to hsm server side )

Exception in thread "main" org.jpos.iso.ISOException: java.net.UnknownHostException: cfg (java.net.UnknownHostException: cfg)
at org.jpos.iso.FSDISOMsg.pack(FSDISOMsg.java:44)
at org.example.ThalesAdaptor.command(ThalesAdaptor.java:73)
at org.example.Main1.main(Main1.java:15)
Nested:java.net.UnknownHostException: cfg
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
at java.base/java.net.Socket.connect(Socket.java:751)
at java.base/sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:1045)
at java.base/sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:1010)
at java.base/sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1102)
at java.base/sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1088)
at java.base/sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:314)
at java.base/sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:420)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:654)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:150)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:861)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:217)
at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:277)
at org.jdom2.input.SAXBuilder.build(SAXBuilder.java:1141)
at org.jpos.util.FSDMsg.loadSchema(FSDMsg.java:662)
at org.jpos.util.FSDMsg.getSchema(FSDMsg.java:635)
at org.jpos.util.FSDMsg.getSchema(FSDMsg.java:619)
at org.jpos.util.FSDMsg.pack(FSDMsg.java:234)
at org.jpos.util.FSDMsg.packToBytes(FSDMsg.java:240)
at org.jpos.iso.FSDISOMsg.pack(FSDISOMsg.java:42)
at org.example.ThalesAdaptor.command(ThalesAdaptor.java:73)
at org.example.Main1.main(Main1.java:15)

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.  Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

Andrés Alcarraz

unread,
Sep 17, 2024, 6:21:48 AM9/17/24
to jPOS Users
Did you read my message? Where I told you you had to set the schema for the response in the channel?



----
Enviado desde mi móvil, disculpas por la brevedad.

Sent from my cellphone, I apologize for the brevity.

Andrés Alcarraz.

El mar, 17 set. 2024, 01:46, Kapilashantha Rajapaksha <kapila...@gmail.com> escribió:
Hi Alcarraz ,
Thanks 
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
<div title="MDH:SSBjYW4ndCBzZWUgaG93IGBGU0RNc2cucGFjaygpYCBjYW4gcmV0dXJuIGEgYG51bGxgLjxicj48 YnI+Q291bGQgeW91IHNoYXJlIHRoYXQgcHJvamVjdCAodGhhdCBJIGd1ZXNzIGlzIGp1c3QgYSBQ T0Mgd2l0aG91dCBzZW5zaXRpdmUgaW5mbykgYXMgYSBwYWNrYWdlZCBmaWxlIG9yLCBiZXR0ZXIg eWV0LCB0aHJvdWdoIGdpdD8gU28geW91IG1ha2UgdXMgZWFzaWVyIHRvIGhlbHAgeW91IHRoYW4g aGF2aW5nIHRvIGNyZWF0ZSB0aGUgcHJvamVjdCBhbmQgZXZlcnkgc2luZ2xlIGZpbGUgdG8gcmVw cm9kdWNlPzxicj48YnI+PGJyPjxwcmUgY2xhc3M9Im1vei1zaWduYXR1cmUiIGNvbHM9IjcyIj5B bmRyw6lzIEFsY2FycmF6PC9wcmU+PGRpdiBjbGFzcz0ibW96LWNpdGUtcHJlZml4Ij5PbiAxNi85 LzI0IDIwOjIwLCBLYXBpbGFzaGFudGhhIFJhamFwYWtzaGEgd3JvdGU6PGJyPjwvZGl2PjxibG9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0xqakRadVRhR2RIUUsvVVBuYm1OK0hHdGg3 d01PakdZeVVGSFlvTmhISmFVclFOOUFSQ3JqbEpnWWdNQkV3Y200UDE0WVcwTmZSaHBhT0FVenRX cUtOaXltWTVDY0lpUzlaaGpZc25WcWdlYk1tTU5SUzVUN2R0V0ZnWlFNanRTS2twc29mbXovSEd4 WVVDNmxsTTI1NXh0RGlQdTVWTkExZzRleUdGczJhd2FMYUMwdzFMLzlmbFd5TElqWXJGQThleDBG aTNod3UxaHJ5Vm1KZU9ySUtsYUZ2YVFNOURXV3U5YWdCQTd0V2NEQ3UrR29VRit2QXZxVUR0eDVx WE1OYkI2Wk4ycUNSZmo2ZWhVUlUrUzJTTWtROFZzWFhxUmJiWDVOYWJLc29PVm5JWmxWaFlHa

Kapilashantha Rajapaksha

unread,
Sep 17, 2024, 9:48:20 PM9/17/24
to jpos-...@googlegroups.com
HI Alcarraz,

"I couldn’t test the receive part since I don’t have an HSM to connect to, and I don’t want to set up a simulator or an echo. Also, you don’t need to create the response in your adaptor, the channel will create it for you. I believe you need to also set the schema for the response, which I think you can do by adding it to the configuration object for now."

Can you give me some direction, i tried many options but still was not able to do success? 

Example 

Properties props = new Properties ();
props.put ("basepath", "file:cfg/hsm-");
props.put ("host", "localhost");
props.put ("port", "1700");




Andrés Alcarraz

unread,
Sep 17, 2024, 10:43:53 PM9/17/24
to jPOS Users



<property name="schema" value="file:cfg/hsm-resp-" />
<property name="host" value="192.168.xxx.xxx" />
<property name="port" value="xxxxx" />

----
Enviado desde mi móvil, disculpas por la brevedad.

Sent from my cellphone, I apologize for the brevity.

Andrés Alcarraz.

chhil

unread,
Sep 17, 2024, 10:54:49 PM9/17/24
to jpos-...@googlegroups.com
Deploy a FSDChannel. And configure the path to the hsm schema file. Remember that a single schema file is configured to pack requests and unpack responses. Your schema has one hsm-base for requests and one hsm-resp-base for responses.

See if you can have one base file 
hsm-base.xml
Rename hsm-resp-ND.xml to hsm-ND.xml and change its content to 

<?xml version="1.0" encoding="UTF-8"?>
<schema id='ND'>
<field id="error" type="A" length="2" />
<field id="lmk-check-value" type="A" length="16" />
<field id="firmware-number" type="A" length="9" />
</schema>

So this way you have a single schema that handles requests responses.
Now let this handle both requests and responses.
So a NC/ND pair can be handled by this.

You can add a counter to the schema for the header to get echoed back and use that in the mux.
So the base will have something like the following as the first field.
<field id="header" type="N" length="4"/>



Kapilashantha Rajapaksha

unread,
Sep 18, 2024, 2:32:04 AM9/18/24
to jpos-...@googlegroups.com
Hi Chhil ,

still unable to get successful  result 

hsm-base.xml
<?xml version="1.0" encoding="UTF-8"?>
<schema>
<field id="command" type="A" length="2" key="true" />
</sc
hsm-NC.xml


<?xml version="1.0" encoding="UTF-8"?>
<schema id='NC'>
</schema>
 hsm-ND.xml

<?xml version="1.0" encoding="UTF-8"?>
<schema id='ND'>
<field id="error" type="A" length="2" />
<field id="lmk-check-value" type="A" length="16" />
<field id="firmware-number" type="A" length="9" />
</schema>


code modify 

channel = new FSDChannel();

Properties props = new Properties ();
props.put ("schema", "file:cfg/hsm-");

props.put ("host", "localhost");
props.put ("port", "1700");
Configuration c = new SimpleConfiguration (props);
channel.setConfiguration(c);
channel.setPackager(new FSDPackager());

Error 

HSM REC : 
0000  00 06 30 30 30 30 4E 43  00 00 00 00 00 00 00 00  ..0000NC........
0010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0060  00 00 00 00                                       ....

HSM RES : 
0000  00 21 31 32 33 34 4E 44  30 30 33 33 36 30 36 35  .!1234ND00336065
0010  36 34 36 36 31 31 32 36  31 35 31 35 30 30 2D 30  64661126151500-0
0020  30 33 30                                          030

Exception in thread "main" org.jpos.iso.ISOException: java.io.FileNotFoundException: cfg\hsm-null.xml (The system cannot find the file specified) (java.io.FileNotFoundException: cfg\hsm-null.xml (The system cannot find the file specified))
at org.jpos.iso.FSDISOMsg.unpack(FSDISOMsg.java:52)
at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:983)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:753)
at org.example.ThalesAdaptor.command(ThalesAdaptor.java:88)
at org.example.Main1.main(Main1.java:17)
Nested:java.io.FileNotFoundException: cfg\hsm-null.xml (The system cannot find the file specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:84)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:180)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:654)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:150)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:861)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:217)
at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:277)
at org.jdom2.input.SAXBuilder.build(SAXBuilder.java:1141)
at org.jpos.util.FSDMsg.loadSchema(FSDMsg.java:662)
at org.jpos.util.FSDMsg.getSchema(FSDMsg.java:640)
at org.jpos.util.FSDMsg.unpack(FSDMsg.java:451)
at org.jpos.util.FSDMsg.unpack(FSDMsg.java:198)
at org.jpos.util.FSDMsg.unpack(FSDMsg.java:221)
at org.jpos.iso.FSDISOMsg.unpack(FSDISOMsg.java:49)
at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:983)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:753)
at org.example.ThalesAdaptor.command(ThalesAdaptor.java:88)
at org.example.Main1.main(Main1.java:17)


Looking for your support. 




chhil

unread,
Sep 18, 2024, 3:00:14 AM9/18/24
to jpos-...@googlegroups.com

When you see a Nested:java.io.FileNotFoundException: cfg\hsm-null.xml

it implies while parsing the message it did not find the command specific schema file.

So if you sent NC and got back a ND it will look for the hsm-ND.xml file.

Your schema does not include the 4 digit 1234 that you are getting. So its seeing 12 and looking for the xml schema hsm-12.xml and it cannot find it.

Include the header definition  as the first field of the base file.

-chhil



Kapilashantha Rajapaksha

unread,
Sep 18, 2024, 4:37:19 AM9/18/24
to jpos-...@googlegroups.com
Hi Chhil,  
thanks for help but i have seen this behavior 

<?xml version="1.0" encoding="UTF-8"?>
<schema>
    <field id="header" type="N" length="4"/>
    <field id="command" type="A" length="2" key="false" />
</schema>
if key ="false" no any error 

but result like below 

HSM REC : 
0000  00 06 30 30 30 30 4E 43  00 00 00 00 00 00 00 00  ..0000NC........
0010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0060  00 00 00 00                                       ....

HSM RES : 
0000  00 21 30 30 30 30 4E 44  30 30 33 33 36 30 36 35  .!0000ND00336065
0010  36 34 36 36 31 31 32 36  31 35 31 35 30 30 2D 30  64661126151500-0
0020  30 33 30                                          030

 <fsdmsg schema='file:cfg/hsm-base'>
   response: 'ND'
   header: '    '
   command: '  '
 </fsdmsg>
Error code : null
Lmk-check-value : null
Firmware-number : null




<?xml version="1.0" encoding="UTF-8"?>
<schema>
    <field id="header" type="N" length="4"/>
    <field id="command" type="A" length="2" key="true" />
</s

 <fsdmsg schema='file:cfg/hsm-base'>
   command: 'NC'
 </fsdmsg>
0000  30 30 30 30 4E 43                                 0000NC

>>>>>>>>>>>>>>>>>>>> run
HSM REC : 
0000  00 06 30 30 30 30 4E 43  00 00 00 00 00 00 00 00  ..0000NC........
0010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0060  00 00 00 00                                       ....

HSM RES : 
0000  00 21 30 30 30 30 4E 44  30 30 33 33 36 30 36 35  .!0000ND00336065
0010  36 34 36 36 31 31 32 36  31 35 31 35 30 30 2D 30  64661126151500-0
0020  30 33 30                                          030

Exception in thread "main" org.jpos.iso.ISOException: java.io.FileNotFoundException: cfg\hsm-null.xml (The system cannot find the file specified) (java.io.FileNotFoundException: cfg\hsm-null.xml (The system cannot find the file specified))
at org.jpos.iso.FSDISOMsg.unpack(FSDISOMsg.java:52)
at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:983)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:753)
at org.example.ThalesAdaptor.command(ThalesAdaptor.java:88)
at org.example.Main1.main(Main1.java:18)
at org.example.Main1.main(Main1.java:18)

What could be the problem ?

chhil

unread,
Sep 18, 2024, 6:06:06 AM9/18/24
to jpos-...@googlegroups.com

You should start debugging the pack and unpack routines for fsdmg.

The test pack and unpack looks fine at the FSDMsg level in the the following test code. 

FSDMsg m = new FSDMsg("file:/blah/jpostest/hsm-");

m.set("command", "NC");

System.out.println(m.pack());

m = new FSDMsg("file:/blah/jpostest/hsm-");

String resp = "1234ND00336065001064661126151500-0"; // See output, firmware gets cut. Need to adjust size.

m.unpack(resp.getBytes());

m.dump(System.out, "");


Output

0000NC

<fsdmsg schema='file:/blah/jpostest/hsm-base'>

stan: '1234'

command: 'ND'

error: '00'

lmk-check-value: '3360650010646611'

firmware-number: '26151500-'

</fsdmsg>



hsm-base.xml

<?xml version="1.0" encoding="UTF-8"?>
<schema>
<field id="stan" type="N" length="4"/>
<field id="command" type="A" length="2" key="true" />
</schema>



hsm-NC.xml

<?xml version="1.0" encoding="UTF-8"?>
<schema id='NC'>
</schema>



hsm-ND.xml

<?xml version="1.0" encoding="UTF-8"?>
<schema id='ND'>
<field id="error" type="A" length="2" />
<field id="lmk-check-value" type="A" length="16" />
<field id="firmware-number" type="A" length="9" />
</schema>




-chhil

Kapilashantha Rajapaksha

unread,
Sep 19, 2024, 2:01:46 AM9/19/24
to jpos-...@googlegroups.com
Hi Chhil,

I manged to unpack response with below code 

 byte [] buffer = new byte [100];
byte [] buffer2 = new byte [100];

FSDISOMsg rep = new FSDISOMsg(resp);
// ISOMsg m =  channel.receive();
channel.getBytes(buffer);
System.out.println(ISOUtil.hexdump(buffer));
System.arraycopy(buffer, 2, buffer2, 0, buffer.length - 2);
// System.out.println(ISOUtil.hexdump(buffer2));
resp.unpack(buffer2);

 <fsdmsg schema='file:cfg/hsm-base'>
   command: 'NC'
 </fsdmsg>
0000  31 32 33 34 4E 43                                 1234NC

0000  00 21 31 32 33 34 4E 44  30 30 33 33 36 30 36 35  .!1234ND00336065
0010  36 34 36 36 31 31 32 36  31 35 31 35 30 30 2D 30  64661126151500-0
0020  30 33 30 00 00 00 00 00  00 00 00 00 00 00 00 00  030.............
0030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0060  00 00 00 00                                       ....

 <fsdmsg schema='file:cfg/hsm-base'>
   response: 'ND'
   stan: '1234'
   command: 'ND'
   error: '00'
   lmk-check-value: '3360656466112615'
   firmware-number: '1500-0030'
 </fsdmsg>
Error code : 00
Lmk-check-value : 3360656466112615
Firmware-number : 1500-0030

 <fsdmsg schema='file:cfg/hsm-base'>
   command: 'NC'
 </fsdmsg>
0000  31 32 33 34 4E 43                                 1234NC

0000  00 21 31 32 33 34 4E 44  30 30 33 33 36 30 36 35  .!1234ND00336065
0010  36 34 36 36 31 31 32 36  31 35 31 35 30 30 2D 30  64661126151500-0
0020  30 33 30 00 00 00 00 00  00 00 00 00 00 00 00 00  030.............
0030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
0060  00 00 00 00                                       ....

 <fsdmsg schema='file:cfg/hsm-base'>
   response: 'ND'
   stan: '1234'
   command: 'ND'
   error: '00'
   lmk-check-value: '3360656466112615'
   firmware-number: '1500-0030'
 </fsdmsg>
Error code : 00
Lmk-check-value : 3360656466112615
Firmware-number : 1500-0030


Can't we use below directly but it's returns IsoMsg?
channel.receive();




Mapfunde Venon

unread,
Sep 19, 2024, 5:12:07 AM9/19/24
to jpos-...@googlegroups.com
you can define the response schema as well like you did the request eg:

request. hsm-NC.xml

<?xml version="1.0" encoding="UTF-8"?>
<schema id='NC'>
</schema>


response: hsm-ND.xml

<?xml version="1.0" encoding="UTF-8"?>
<schema id='ND'>
<field id="error" type="A" length="2" />
<field id="lmk-check-value" type="A" length="16" />
<field id="firmware-number" type="A" length="9" />
</schema>

Regards

Venon Mapfunde(PMP,Msc Software Engineering,Bsc Computer Science & Mathematics)
Tel:+263 775 091 262
Email:taka...@gmail.com
Skype: venon.mapfunde


Kapilashantha Rajapaksha

unread,
Sep 19, 2024, 5:22:56 AM9/19/24
to jpos-...@googlegroups.com
Hi my question how can use below 
channel.receive()

Without manually copy because it's not returning FSDmsg

Thanks 

Mapfunde Venon

unread,
Sep 19, 2024, 5:43:23 AM9/19/24
to jpos-...@googlegroups.com
Try this :

FSDISOMsg response = (FSDISOMsg)channel.receive() 
if (response != null) {
return ResponseEntity.ok(response.getFSDMsg().getMap());
} else {
return ResponseEntity.ok(tx.getFSDMsg().getMap());
}
not sure if that will work because i use a mux to send requests not directly through a channel like you are doing

Venon Mapfunde(PMP,Msc Software Engineering,Bsc Computer Science & Mathematics) Tel:+263 775 091 262 Email:taka...@gmail.com Skype: venon.mapfunde

Andrés Alcarraz

unread,
Sep 19, 2024, 7:02:20 AM9/19/24
to jPOS Users
Did you set the schema in the channel?

----
Enviado desde mi móvil, disculpas por la brevedad.

Sent from my cellphone, I apologize for the brevity.

Andrés Alcarraz.

chhil

unread,
Sep 19, 2024, 11:27:33 AM9/19/24
to jpos-...@googlegroups.com
Can't we use below directly but it's returns IsoMsg?

I cannot tell you, other than writing test snippets that use channels, I don't ever access channels directly.
You started off this thread wanting to do  asynch HSM communication, and you are trying to use the never recommended method of channels.

-chhil



Kapilashantha Rajapaksha

unread,
Sep 22, 2024, 10:59:47 PM9/22/24
to jpos-...@googlegroups.com
Hi Chhil, 
Yes , I'm agreed but just i wanted to know behavior of FSDmsg but now I tried to use Q2 and MUX but it seems like not deploying mux.xml file in my deploy folder 

mux.xml
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="mymux">
<in>hsm-receive</in>
<out>hsm-send</out>
<unhandled>mymux.unhandled</unhandled>
</mux>

<?xml version="1.0" encoding="UTF-8"?>
<channel-adaptor class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2" name="HSMChannel">
<channel class="org.jpos.iso.channel.FSDChannel" logger="Q2"
packager="org.jpos.iso.packager.DummyPackager">

<property name="schema" value="file:cfg/hsm-resp-" />
        <property name="packager-logger" value="Q2" />
<property name="host" value="127.0.0.1" />
<property name="port" value="1700" />


</channel>
<in>hsm-send</in>
<out>hsm-receive</out>


new Q2().start();
Thread.sleep(20000);
QMUX qmux = (QMUX) NameRegistrar.getIfExists("mux.my");


However below is returning null value 

QMUX qmux = (QMUX) NameRegistrar.getIfExists("mux.my");

Let me know what's wrong with me 

image.png

Kapilashantha Rajapaksha

unread,
Sep 23, 2024, 4:18:03 AM9/23/24
to jpos-...@googlegroups.com
HI Chhil & Alcarraz 

I manged to configure mux with Q2 , 

<?xml version="1.0" encoding="UTF-8"?>
<channel-adaptor class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2" name="HSMChannel">
<channel class="org.jpos.iso.channel.FSDChannel" logger="Q2"
packager="org.jpos.iso.packager.DummyPackager">
        <property name="schema" value="file:cfg/hsm-" />
        <property name="packager-logger" value="Q2" />
        <property name="host" value="127.0..1" />
        <property name="port" value="1700" />
        <property name="keep-alive" value="true"/>
    </channel>
<in>hsm-send</in>
<out>hsm-receive</out>
    <reconnect-delay>5000</reconnect-delay>
</chan

<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="hsm-mux">
    <in>hsm-receive</in>
<out>hsm-send</out>
    <key>stan</key>
<ready>thales-primary-channeladaptor.ready</ready>
<unhandled>mymux.unhandled</unhandled>
</mux>

base.xml 

<?xml version="1.0" encoding="UTF-8"?>
<schema>
<field id="stan" type="N" length="4"/>
<field id="command" type="A" length="2" key="true" />
</schema>

package org.example;

import org.jpos.q2.Q2;
import org.jpos.util.FSDMsg;

public class HsmMainRunner {



public static void main(String [] args) throws Exception {

        new Thread(new HsmDemoServer()).start();
Thread.sleep(2000);
new Q2().start();
Thread.sleep(2000);


ThalesAdaptor adaptor = new ThalesAdaptor();

FSDMsg req = adaptor.diagnostics();
req.dump(System.out, " ");
FSDMsg resp = adaptor.command(req);
resp.dump(System.out, " ");

}
}

package org.example;

import org.jpos.iso.FSDISOMsg;
import org.jpos.iso.ISOUtil;
import org.jpos.iso.channel.FSDChannel;
import org.jpos.q2.iso.QMUX;
import org.jpos.util.FSDMsg;
import org.jpos.util.NameRegistrar;

public class ThalesAdaptor extends FSDISOMsg {
private FSDChannel channel;

@Override
public String getMTI() {
String command = getFSDMsg().get("command");
if (command==null){
return getFSDMsg().get("response");
}
return command;


}

private FSDMsg createRequest(String command) {
FSDMsg req = new FSDMsg("file:cfg/hsm-");

if (command != null)
req.set("command", command);

return req;
}

private FSDMsg createResponse(String response) {
        FSDMsg resp = new FSDMsg("file:cfg/hsm-");


if (response != null)
resp.set("response", response);

return resp;
}

public FSDMsg diagnostics() {
return createRequest("NC");
}



    public FSDMsg command(FSDMsg request) throws Exception {
StringBuffer sbuffer = new StringBuffer(request.get("command"));
sbuffer.setCharAt(1, (char) (sbuffer.charAt(1) + 1));
FSDMsg resp = createResponse(sbuffer.toString());

FSDISOMsg msg = new FSDISOMsg(request);
        request.set("stan", "1234");
request.set("0", "0200");
System.out.println(ISOUtil.hexdump(msg.pack()));


QMUX qmux = (QMUX) NameRegistrar.getIfExists("mux.hsm-mux");

FSDISOMsg rep = new FSDISOMsg(resp);
        rep = (FSDISOMsg)qmux.request(msg,5000);
return rep.getFSDMsg();

}
}


I had to add below line (additionally in request , any workaround for that ?  )

  request.set("0", "0200");

I can see full response as below but getting exception too 

I suspect  something  wrong here.  Appreciate your advice ? because res is null 

   
rep = (FSDISOMsg)qmux.request(msg,5000);
return rep.getFSDMsg();

}



  <info>
    Q2 started, deployDir=C:\Users\kapila.shantha\IdeaProjects\HSM\deploy, environment=default
  </info>
</log>
<log realm="Q2.system" at="2024-09-23T16:01:58.888710700" lifespan="409ms">
  <version>
    jPOS 2.1.9 master/0060f93 (2023-12-22 21:41:39 UYT) 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jPOS Community Edition, licensed under GNU AGPL v3.0.
This software is probably not suitable for commercial use.
Please see http://jpos.org/license for details.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iQEcBAEBAgAGBQJMolHDAAoJEOQyeO71nYtFv74H/3OgehDGEy1VXp2U3/GcAobg
HH2eZjPUz53r38ARPiU3pzm9LwDa3WZgJJaa/b9VrJwKvbPwe9+0kY3gScDE1skT
ladHt+KHHmGQArEutkzHlpZa73RbroFEIa1qmN6MaDEHGoxZqDh0Sv2cpvOaVYGO
St8ZaddLBPC17bSjAPWo9sWbvL7FgPFOHhnPmbeux8SLtnfWxXWsgo5hLBanKmO1
1z+I/w/6DL6ZYZU6bAJUk+eyVVImJqw0x3IEElI07Nh9MC6BA4iJ77ejobj8HI2r
q9ulRPEqH9NR79619lNKVUkE206dVlXo7xHmJS1QZy5v/GT66xBxyDVfTduPFXk=
=oP+v
-----END PGP SIGNATURE-----

  </version>
</log>
<log realm="Q2.system" at="2024-09-23T16:01:58.936231200" lifespan="46ms">
  <info>
    deploy: C:\Users\kapila.shantha\IdeaProjects\HSM\deploy\hsm_channel.xml
  </info>
</log>
<log realm="Q2.system" at="2024-09-23T16:01:58.951842" lifespan="15ms">
  <info>
    deploy: C:\Users\kapila.shantha\IdeaProjects\HSM\deploy\mux.xml
  </info>
</log>
<log realm="channel/10.226.180.37:1700" at="2024-09-23T16:01:58.971446400" lifespan="9ms">
  <connect>
    Try 0 10.226.180.37:1700
      Connection established to 10.226.180.37:1700
  </connect>
</log>
 <fsdmsg schema='file:cfg/hsm-base'>
   command: 'NC'
 </fsdmsg>
0000  31 32 33 34 4E 43                                 1234NC

<log realm="channel/10.226.180.37:1700" at="2024-09-23T16:02:00.451144200">
  <send>
    <fsdmsg schema='file:cfg/hsm-base'>
      command: 'NC'
      stan: '1234'
      0: '0200'
    </fsdmsg>
  </send>
</log>
<log realm="channel/10.226.180.37:1700" at="2024-09-23T16:02:00.482209600">
  <fsd-channel-debug>
    received message length: 33
  </fsd-channel-debug>
</log>
<log realm="channel/10.226.180.37:1700" at="2024-09-23T16:02:00.485209900" lifespan="1513ms">
  <receive>
    <fsdmsg schema='file:cfg/hsm-base'>
      stan: '1234'
      command: 'ND'
      error: '00'
      lmk-check-value: '3360656466112615'
      firmware-number: '1500-0030'
    </fsdmsg>
  </receive>
</log>
<log realm="org.jpos.q2.iso.ChannelAdaptor" at="2024-09-23T16:02:00.485209900">
  <warn>
    channel-receiver-hsm-receive
    <exception name="Cannot invoke "String.substring(int, int)" because the return value of "org.jpos.iso.ISOMsg.getMTI()" is null">
    java.lang.NullPointerException: Cannot invoke "String.substring(int, int)" because the return value of "org.jpos.iso.ISOMsg.getMTI()" is null
at org.jpos.q2.iso.QMUX.getKey(QMUX.java:256)
at org.jpos.q2.iso.QMUX.notify(QMUX.java:222)
at org.jpos.space.TSpace.notifyListeners(TSpace.java:317)
at org.jpos.space.TSpace.out(TSpace.java:64)
at org.jpos.q2.iso.ChannelAdaptor$Receiver.run(ChannelAdaptor.java:339)
at java.base/java.lang.Thread.run(Thread.java:1583)
    </exception>
  </warn>
</log>
<log realm="Q2.system" at="2024-09-23T16:02:03.044183500">
  <info>
    shutting down (hook)
  </info>
</log>
<log realm="Q2.system" at="2024-09-23T16:02:03.966436400">
  <trace>
    undeploying:C:\Users\kapila.shantha\IdeaProjects\HSM\deploy\mux.xml
  </trace>
</log>
<log realm="Q2.system" at="2024-09-23T16:02:03.968442500">
  <info>
    undeployed:C:\Users\kapila.shantha\IdeaProjects\HSM\deploy\mux.xml
  </info>
</log>
<log realm="Q2.system" at="2024-09-23T16:02:03.968442500">
  <trace>
    undeploying:C:\Users\kapila.shantha\IdeaProjects\HSM\deploy\hsm_channel.xml
  </trace>
</log>
<log realm="Q2.system" at="2024-09-23T16:02:03.969448300">
  <info>
    undeployed:C:\Users\kapila.shantha\IdeaProjects\HSM\deploy\hsm_channel.xml
  </info>
</log>

Process finished with exit code 130

chhil

unread,
Sep 23, 2024, 9:52:47 PM9/23/24
to jpos-...@googlegroups.com

   
    private FSDMsg createResponse(String response) {
        FSDMsg resp = new FSDMsg("file:cfg/hsm-");

        if (response != null)
            resp.set("response", response);

        return resp;
    }


Not sure if this is the reason but you have copy pasted the code. You do not have a field called "response", you replaced it with "command" to unify the request rsp schemas.


-chhil

Alejandro Revilla

unread,
Sep 23, 2024, 9:56:39 PM9/23/24
to jpos-...@googlegroups.com

FYI, you don't have to sleep for 20 seconds. Instead, you can use NameRegistrar.get("mux.my", 20000L). This way, if the MUX becomes available before the 20-second wait—which it most likely will be—you can speed up your startup time.



Kapilashantha Rajapaksha

unread,
Sep 23, 2024, 11:45:41 PM9/23/24
to jpos-...@googlegroups.com
hi Chhil 

 I changed hsm-ND.xml  and hsm-NC.xml as below 

<?xml version="1.0" encoding="UTF-8"?>
<schema command='ND'>
    <field id="error" type="A" length="2" />
<field id="lmk-check-value" type="A" length="16" />
<field id="firmware-number" type="A" length="9" />
</schema>
<?xml version="1.0" encoding="UTF-8"?>
<schema command='NC'>
</schema>

And code 

private FSDMsg createResponse(String response) {
FSDMsg resp = new FSDMsg("file:cfg/hsm-");

if (response != null)
resp.set("command", response);


return resp;
}

public FSDMsg diagnostics() {
return createRequest("NC");
}



public FSDMsg command(FSDMsg request) throws Exception {
StringBuffer sbuffer = new StringBuffer(request.get("command"));
sbuffer.setCharAt(1, (char) (sbuffer.charAt(1) + 1));
FSDMsg resp = createResponse(sbuffer.toString());

FSDISOMsg msg = new FSDISOMsg(request);
    request.set("stan", "1234");
request.set("0", "0200");
System.out.println(ISOUtil.hexdump(msg.pack()));


    QMUX qmux = (QMUX) NameRegistrar.getIfExists("mux.hsm-mux");

FSDISOMsg rep = new FSDISOMsg(resp);
    rep=  (FSDISOMsg)qmux.request(msg,5000);
return rep.getFSDMsg();

rep=  (FSDISOMsg)qmux.request(msg,5000);  
I have noticed that rep is NULL 
Below is the logs 

</log>
<log realm="Q2.system" at="2024-09-24T11:30:25.858238100" lifespan="48ms">
  <info>
    deploy: C:\Users\kapila.shantha\IdeaProjects\HSM\deploy\hsm_channel.xml
  </info>
</log>
<log realm="Q2.system" at="2024-09-24T11:30:25.868956400" lifespan="10ms">
  <info>
    deploy: C:\Users\kapila.shantha\IdeaProjects\HSM\deploy\mux.xml
  </info>
</log>
 <fsdmsg schema='file:cfg/hsm-base'>
   command: 'NC'
 </fsdmsg>
0000  31 32 33 34 4E 43                                 1234NC

<log realm="channel/10.226.180.37:1700" at="2024-09-24T11:30:25.885072" lifespan="8ms">
  <connect>
    Try 0 10.226.180.37:1700
      Connection established to 10.226.180.37:1700
  </connect>
</log>
<log realm="channel/10.226.180.37:1700" at="2024-09-24T11:30:25.886026200">
  <send>
    <fsdmsg schema='file:cfg/hsm-base'>
      command: 'NC'
      stan: '1234'
      0: '0200'
    </fsdmsg>
  </send>
</log>
<log realm="channel/10.226.180.37:1700" at="2024-09-24T11:30:25.913057">
  <fsd-channel-debug>
    received message length: 33
  </fsd-channel-debug>
</log>
<log realm="channel/10.226.180.37:1700" at="2024-09-24T11:30:25.917193600" lifespan="32ms">
  <receive>
    <fsdmsg schema='file:cfg/hsm-base'>
      stan: '1234'
      command: 'ND'
      error: '00'
      lmk-check-value: '3360656466112615'
      firmware-number: '1500-0030'
    </fsdmsg>
  </receive>

But I'm still getting below error 

<log realm="org.jpos.q2.iso.ChannelAdaptor" at="2024-09-24T11:30:25.917193600">
  <warn>
    channel-receiver-hsm-receive
    <exception name="Cannot invoke "String.substring(int, int)" because the return value of "org.jpos.iso.ISOMsg.getMTI()" is null">
    java.lang.NullPointerException: Cannot invoke "String.substring(int, int)" because the return value of "org.jpos.iso.ISOMsg.getMTI()" is null
at org.jpos.q2.iso.QMUX.getKey(QMUX.java:256)
at org.jpos.q2.iso.QMUX.notify(QMUX.java:222)
at org.jpos.space.TSpace.notifyListeners(TSpace.java:317)
at org.jpos.space.TSpace.out(TSpace.java:64)
at org.jpos.q2.iso.ChannelAdaptor$Receiver.run(ChannelAdaptor.java:339)
at java.base/java.lang.Thread.run(Thread.java:1583)
    </exception>
  </warn>
</log>

My concern why it's validating MTI  (without  request.set("0", "0200"); it's not getting reply as well )
 Hi Alejandro, 
Thanks for the information and already applied 


Look for your advice to resolve this (I have seen same issue here-QMUX not able to work with FSDMsg without MTI · Issue #428 · jpos/jPOS · GitHub but it does not work for me)


chhil

unread,
Sep 24, 2024, 9:31:30 AM9/24/24
to jpos-...@googlegroups.com

Put breakpoints and start debugging jpos code to figure out what's going on, is all that I can recommend.

Kapilashantha Rajapaksha

unread,
Sep 24, 2024, 10:25:14 PM9/24/24
to jpos-...@googlegroups.com
Hi Chhil ,

Finally I was able to communicate with HSM . 

Below is the approche I worked around and helpful to others too. 

Everyone given support thanks 

hsm-base.xml

<?xml version="1.0" encoding="UTF-8"?>
<schema>
<field id="stan" type="N" length="4"/>
<field id="command" type="A" length="2" key="true" />
</schema>

hsm-ND.xml
<?xml version="1.0" encoding="UTF-8"?>
<schema command='NC'>
</schema>

hsm-NC.xml
<?xml version="1.0" encoding="UTF-8"?>
<schema command='ND'>
<field id="error" type="A" length="2" />
<field id="lmk-check-value" type="A" length="16" />
<field id="firmware-number" type="A" length="9" />
</schema>

hsm-channel.xml 

<?xml version="1.0" encoding="UTF-8"?>
<channel-adaptor class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2" name="HSMChannel">
    <channel class="com.hsm.thales.HSMChannel" logger="Q2"
packager="org.jpos.iso.packager.DummyPackager">
<property name="schema" value="file:cfg/hsm-" />
        <property name="packager-logger" value="Q2" />
        <property name="host" value="10.226.180.37" />
        <property name="port" value="1700" />
        <property name="keep-alive" value="true"/>
    </channel>
<in>hsm-send</in>
<out>hsm-receive</out>
    <reconnect-delay>5000</reconnect-delay>
</channel-adaptor>

mux.xml

<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="hsm-mux">
    <in>hsm-receive</in>
<out>hsm-send</out>
    <key>stan</key>
<ready>thales-primary-channeladaptor.ready</ready>
<unhandled>mymux.unhandled</unhandled>
</mux>


src 

package com.hsm.thales;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.channel.FSDChannel;
import org.jpos.util.FSDMsg;
public class HSMChannel extends FSDChannel {
public HSMChannel() {
super();
}
@Override
public ISOMsg createMsg() {
FSDMsg fsdmsg = new FSDMsg ("file:cfg/hsm-");

return new HSMsg(fsdmsg);
}


}

package com.hsm.thales;

import org.jpos.q2.Q2;
import org.jpos.util.FSDMsg;
import org.jpos.util.NameRegistrar;

public class HsmMainRunner {

public static void main(String [] args) throws Exception {
        new Q2().start();
ThalesAdaptor.qmux= NameRegistrar.get("mux.hsm-mux", 20000L);

ThalesAdaptor adaptor = new ThalesAdaptor();
        FSDMsg req = adaptor.diagnostics();
req.dump(System.out, " ");
FSDMsg resp = adaptor.command(req);
resp.dump(System.out, " ");


}
}


package com.hsm.thales;

import org.jpos.iso.FSDISOMsg;
import org.jpos.util.FSDMsg;

public class HSMsg extends FSDISOMsg {
// Constructor

public HSMsg(FSDMsg f) {
super(f);
}

public HSMsg() {
super();

}

@Override
public String getMTI() {
String command = getFSDMsg().get("command");

if (command==null){
            return getFSDMsg().get("command");
}
return command;

}
}


package com.hsm.thales;

import org.jpos.iso.ISOUtil;
import org.jpos.q2.iso.QMUX;

import org.jpos.util.FSDMsg;

public class ThalesAdaptor {

static  QMUX qmux ;



private FSDMsg createRequest(String command) {
FSDMsg req = new FSDMsg("file:cfg/hsm-");

if (command != null)
req.set("command", command);
return req;
}

private FSDMsg createResponse(String response) {
        FSDMsg resp = new FSDMsg("file:cfg/hsm-");

if (response != null)
resp.set("command", response);

return resp;
}

public FSDMsg diagnostics() {
return createRequest("NC");
}



public FSDMsg command(FSDMsg request) throws Exception {
StringBuffer sbuffer = new StringBuffer(request.get("command"));
sbuffer.setCharAt(1, (char) (sbuffer.charAt(1) + 1));
FSDMsg resp = createResponse(sbuffer.toString());

        HSMsg msg = new HSMsg(request);

request.set("stan", "1234");
        System.out.println(ISOUtil.hexdump(msg.pack()));
HSMsg rep = new HSMsg(resp);
rep=(HSMsg) qmux.request(msg,5000);
return rep.getFSDMsg();

}
}


--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

chhil

unread,
Sep 25, 2024, 12:15:15 AM9/25/24
to jpos-...@googlegroups.com

Excellent!
Maybe point out what you fixed so that someone doesn't have to go through your various iterations of files and code to figure out would be helpful. Thanks.

kapila...@gmail.com

unread,
Sep 25, 2024, 2:11:54 AM9/25/24
to jPOS Users
I override below 
=====================================================
public class HSMChannel extends FSDChannel {
public HSMChannel() {
super();
}
@Override
public ISOMsg createMsg() {
FSDMsg fsdmsg = new FSDMsg ("file:cfg/hsm-");

return new HSMsg(fsdmsg);
}


}

=================================================================

chhil

unread,
Sep 25, 2024, 4:11:51 AM9/25/24
to jpos-...@googlegroups.com

       String command = getFSDMsg().get("command");

        if (command==null){
            return getFSDMsg().get("command");
        }

The command==null check does not make sense. You don't need it.
Both your request and response based off a single base schema have command in it, and it can only be null if the message only had the stan. It made sense when the schemas were different for request/response, where request had a "command" field and response had a "response" field.
I think most people have used separate schemas for req/rsp as those were what were floating around including the hsm code :).
I do think using a unified single schema makes most sense.

-chhil


--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages