Compile a Java Card Applet, Load onto JCOP card, execute..
Applet Source is in \card\src\joe\Fred.java
joe is the package
Batch file to make CAP
_________________________________________________________
prompt $g
set JC_HOME=C:\card\java_card_kit-2_2_1
:: CARE set JAVA_HOME does NOT change javac version
set JAVA_HOME="C:\Program Files\Java\jre1.5.0_05"
set PATH=.;%JC_HOME%\bin;%JAVA_HOME%\bin;%PATH%
:: path overkill?
cd \card\src\joe
C:\card\jsdk13\bin\javac -g -classpath ".;%JC_HOME%\lib\api.jar" Fred.java
:: this JCOP card uses javacard 2.2.1 and javac 1.3
:: j1.5 gives: unsupported class file format of version 49.0.
:: nb classpath api.jar does give access to javacard.framework
set _CLASSES=C:\card\java_card_kit-2_2_1\lib\apduio.jar;C:\card\java_card_kit-2_2_1\lib\api.jar;C:\card\java_card_kit-2_2_1\lib\capdump.jar;C:\card\java_card_kit-2_2_1\lib\converter.jar;C:\card\java_card_kit-2_2_1\lib\offcardverifier.jar;
:: do this once only ......... xcopy /S C:\card\java_card_kit-2_2_1\api_export_files\*.* exp\
cd \card\src\
java -classpath "%_CLASSES%" com.sun.javacard.converter.Converter -config Fred.opt
____________________________________________________
You have to hunt around Oracle's archives to find the JDK1.3
____________________________________________________
____________________________________________________
Fred.opt
____________________________________________________
-out EXP JCA CAP
-exportpath joe\exp
-applet 0x1:0x0:0x0:0x0:0x1:0x3:0x1:0x0:0x1:0x1 joe.Fred
joe
0x1:0x0:0x0:0x0:0x1:0x3:0x1:0x0:0x1 1.0
____________________________________________________
Any old AID will do, but there are international Company standards in the Real World
To load the CAP I use jcManager
later on I'll try to do a low level load
Install for load etc etc
gpshell didnt load the HelloWorld that jcManager did,
so expect more difficulties
____________________________________________________
____________________________________________________
anubis script to run the Applet
(I copied CLA 80 and INS 20 from a wallet program)
I guess they can be anything...
____________________________________________________
atr = open();
prints(atr);
prints(" Select joe ");
cmd = new ApduCmd("00A404000A0100000001030100010100");
card_response = execute(cmd);
prints(card_response);
prints(" Get Data ");
cmd = new ApduCmd("B020000008111213141516171800");
card_response = execute(cmd);
prints(card_response);
____________________________________________________
right now the Applet just returns 2 bytes.
Now to get it to do Something interestng.
....
Also I would like to get NetBeans Card going with javac 1.3 and jcdk 2.2.1
- is that even possible??
Warning!
ReplyDeletejcManager 'Reset Card' is a Powerful Tool
It appears to have removed Mifare & another commercial App from my card.
My own app is there, and working
but any attempt to delete it & reload gets
6985 error code for
"6985-Transaction condition error (Previous transaction is not properly complete) ",
OMG I have fried my card!
btw java 1.6 has an option to run as 1.3
ReplyDeleteYou dont need to actually dig up Java 1.4