-2

I want a java code which can talk to jcwde similar to what APDUTool does. Jcwde/cjre works on TCP port 9025. Is there a way i can open a TCP connection with cjre and send APDU directly, instead of giving script file to APDUTool.

Also after opening the connection what all things does the APDUTool do.

I tried to find the source code of APDUTool but couldn't find it.

1 Answers1

0

I could find a way to do that, by using CadClientInterface.

This is in tools.jar that comes with JavaCard. The code snippet like the following can be used for this -

        CadClientInterface cad;
        Socket sock;
        sock = new Socket("localhost", 9025);
        InputStream is = sock.getInputStream();
        OutputStream os = sock.getOutputStream();
        cad=CadDevice.getCadClientInstance(CadDevice.PROTOCOL_T1, is, os);
        System.out.println("Powering Up the card");


        byte[] abc = cad.powerUp();
        System.out.println("after powere up");
        System.out.println("abc == " + abc);

        cad.powerDown();