4

I am usually writing Java Card Software with JCOP, but nowadays I am trying out other development structures to get a little more insight. So I am using a simple HelloWorld.java as I have started with this one on JCOP as well - http://umer555.wordpress.com/2012/05/17/java-card-hello-world-applet/

Now I tried to run this on NetBeans with Java Card 3.0 (Classic, so I guess it should work the just like 2.2.2) and it works like a charm out of the Box.

Next step for me is trying it with Eclipse and JCDE. Now, by creating the cap file I get this as the first three lines (which respond 9000 in APDUTool):

powerup;
// Select the installer applet
0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F;
0x80 0xB0 0x00 0x00 0x00 0x7F;

As the next step I try to create my "HelloWorld" applet with AID 010203040501

// create HelloWorld applet
0x80 0xB8 0x00 0x00 0x8 0x6 0x01 0x02 0x03 0x04 0x05 0x01 0x00 0x7F;

this returns

0x80 0xb8 0x00 0x00 0x08 0x06 0x01 0x02 0x03 0x04 0x05 0x01 0x00 0x7f;
CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 08, 06, 01, 02, 03, 04, 05, 01, 00, Le: 00
, SW1: 64, SW2: 44

and JCWDE reports an "Exception from the invoked install() method: ..."

So from the response I figure that somehow the applet is not loaded into the simulator, but I don't know why this is the case!

achiever
  • 309
  • 1
  • 16
  • When I try to run `jcwde jcwde.app` from the console instead inside Eclipse I get a `java.lang.ClassNotFoundException: helloworld.HelloWorld com.sun.javacard.jcwde.SimulationException` My jcwde.app lies in the same Folder as HelloWorld.java does. – achiever Oct 07 '13 at 18:11
  • Tricky question, the only thing that I see is that you've got a 7F hexadecimal value at the end that does not seems to be used. – Maarten Bodewes Oct 13 '13 at 23:57
  • that is used by the apdutool for every apdu! I don't know the meaning of it, but it just kind of needs it! – achiever Oct 16 '13 at 14:03
  • 1
    @MaartenBodewes Too late and I am sure you know it now, but maybe it helps newer viewers! :D I read somewhere that this `0x7F` is mandatory for the APDU-Tool and this simulators. Because the APDU-Tool and these simulators communicate based on a protocol named `TLP224`(An old reader), and in this protocol `0x7F` means "no data expected!" (Something like `Le`,I think!) – Ebrahim Ghasemi Mar 13 '15 at 05:48
  • @Abraham Never too late to learn. – Maarten Bodewes Mar 13 '15 at 12:37
  • @MaartenBodewes I meant : "I'm pretty sure you already got it (understand it)" :) – Ebrahim Ghasemi Mar 13 '15 at 14:35

1 Answers1

0

There is no "installer applet" in the card. There is a card manager applet, that does all cad system operations.

Card manager AID known to me are:

const
  VISA_CARDMANAGER_AID = 'A0000000030000';
  MASTERCARD_CARDMANAGER_AID = 'A0000000040000';
  GEMPLUS_CARDMANAGER_AID = 'A000000018434D00';

Is your card really JCOP one?

To start installing an applet you need to issue Install/Load command first (CLA=80/84, INS = E6). In your case you start from 80/84 and B8 on some reason.

After Install/Load you need to issue LOAD commands to upload cap file to the card.

Please refer to the GlobalPlatform documentation to know more about APDU commands (search Google for the document named "GPCardSpec_v2.2.pdf" or download it from here: http://www.globalplatform.org/specificationscard.asp

Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
  • No, I am not using JCOP for this one, I try to use the JCDE-Plugin for Eclipse. With Netbeans or JCOP I don't have a problem running it. – achiever Oct 25 '13 at 17:12