Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

jCardSim as Javacard Applet debugger

Other Tools
User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

jCardSim as Javacard Applet debugger

Post by UNKNwYSHSA » Wed Aug 26, 2015 3:09 am

Today, i use the jCardSim to simulate an javacard, and i can debug my applet code with eclipse java.
But, when install the applet, if my code as following:

Code: Select all

   public static void install(byte[] bArray, short bOffset, byte bLength) {
      new TestApplet().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
   }

There is an exception raised;
when my code as following:

Code: Select all

   public static void install(byte[] bArray, short bOffset, byte bLength) {
      new TestApplet().register();
   }

The install operation process succeeded;
What's the wrong?
sense and simplicity

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: jCardSim as Javacard Applet debugger

Post by UNKNwYSHSA » Sat Aug 29, 2015 11:13 pm

Oh no, the problem here, the authors did not do a good job handling this code.

Code: Select all

    /* Simulator.class */
    /**
     * Install
     * <code>Applet</code> into Simulator without installing data
     *
     * @param aid applet aid or null
     * @param appletClass applet class
     * @return applet <code>AID</code>
     * @throws SystemException if <code>appletClass</code> not instanceof
     * <code>javacard.framework.Applet</code>
     */
    public AID installApplet(AID aid, Class<? extends Applet> appletClass) throws SystemException {
        return installApplet(aid, appletClass, new byte[]{}, (short) 0, (byte) 0);
    }
sense and simplicity

hosseinpro
Posts: 13
Joined: Wed Jun 28, 2017 6:35 pm
Points :190
Contact:

Re: jCardSim as Javacard Applet debugger

Post by hosseinpro » Thu Aug 09, 2018 1:04 am

How can I run jCardSim in Eclipse?

kuafu
Posts: 317
Joined: Thu Jun 25, 2015 2:09 am
Points :4551
Contact:

Re: jCardSim as Javacard Applet debugger

Post by kuafu » Thu Aug 09, 2018 4:38 am

https://www.slideshare.net/ssusered0e6d/con1160
https://github.com/licel/jcardsim
This slide maybe help you.

Code: Select all

/ 1. create simulator
CardSimulator simulator = new CardSimulator();

// 2. install applet
AID appletAID = AIDUtil.create("F000000001");
simulator.installApplet(appletAID, HelloWorldApplet.class);

// 3. select applet
simulator.selectApplet(appletAID);

// 4. send APDU
CommandAPDU commandAPDU = new CommandAPDU(0x00, 0x01, 0x00, 0x00);
ResponseAPDU response = simulator.transmitCommand(commandAPDU);

// 5. check response
assertEquals(0x9000, response.getSW());
well

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 22 guests

JavaCard OS : Disclaimer