JCOP
Java to CAP
Compiling the java:
We use JCOP41 cards so:
We need JavaCard old-style ie 2.2.1 and javaCompiler1.3
Eclipse uses 2.2.2+ so cant be used for the final compile.
I suspect Netbeans might be persuaded to do the decent thing.
You dont have to dig up java 1.3, use java 1.6 with -target 1.1 -source 1.3
here is the compile batch file
...........................................................
copy "C:\Users\Chris Skinner\Documents\NetBeansProjects\Shamu\src\sham\Shamu.java" \card\src\sham
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"
:: the above line is pointless?? or does it give us api.jar??
set PATH=.;%JC_HOME%\bin;%JAVA_HOME%\bin;%PATH%
cd \card\src\sham
del *.class
::C:\card\jsdk13\bin\javac -g -classpath ".;%JC_HOME%\lib\api.jar" Shamu.java NOT NOW NEEDED
javac -target 1.1 -source 1.3 -g -classpath ".;%JC_HOME%\lib\api.jar" Shamu.java
pause
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;
cd \card\src\
java -classpath "%_CLASSES%" com.sun.javacard.converter.Converter -config Shamu.opt
...........................................................
You cant just say "converter",
I jumped through all the classpath hoops as above
shamu.opt is a configuration file viz:
......................................................
-out EXP JCA CAP
-exportpath sham\exp
-applet 0x1:0x9:0x0:0x0:0x1:0x3:0x1:0x0:0x4:0x1 sham.Shamu
sham
0x1:0x9:0x0:0x0:0x1:0x3:0x1:0x0:0x4 1.0
......................................................
It is suggester that the package name should have at least 2 layers... ie I could use a few more...
We dont ever use the EXP and JCA output?
__________________________________________________________________
CAP to Card
I have used jcManager source to write a CAPLoader
CAPLoader loads CAP produced by this method. (onto JCOP41 cars)
It Doesnt load many sample CAPs that float down through the Internet.
I guess theyre mostly 2.2.2+
CAPLoader does use SCP02 (Secure Channel Protocol 02) so we are not entirely back in the dark ages.
Oddly, It authenticates to old JCOP31 cards, so they can evidently use SCP02
packerreadwrite.cap does NOT load
ReplyDeleteso I looked inside with a unzipper
but blow-me-down it does NOT have a mainfest!!
http://askra.de/software/jcdocs/kit-user-2.2.1/cJDKAppManifest.html
nicely explains the manifest, but if some buffoon decides a CAP is better without a manifset, then I guess thats all she wrote.