Converting .class file to .cap JavaCard 3.0.2 Connected Edition

730 views Asked by At

I want to make use of the new api function such as strings, threads, longs etc...I'm struggling to convert the class file to cap file when I include Strings in my code, the converter gives me errors: "unsupported String type constant". When I remove the String, then the converter converts it to a cap file without errors. Is there something extra I need to do to convert .class to .cap to use the connected api?

Using: JavaCard302 and jdk1.6u11

wrote a bat file that does my compiling and converting:

echo off

set appName=testCrypt


set targetdir=C:\SC\%appName%\%appName%
rmdir /S /Q %targetdir%


..\JDK1.6\bin\javac.exe -g -d %appName% -classpath ".;%JC_HOME%\lib\api_connected.jar" %appName%.java

..\JavaCard302\bin\converter.bat -i -applet 0x01:0x02:0x03:0x04:0x05:0x06:0x07:0x08:0x09:0x00:0x00 %appName%.%appName% -classdir %appName% -exportpath %JC_HOME%\api_export_files %appName% 0x01:0x02:0x03:0x04:0x05:0x06:0x07:0x08:0x09:0x00 1.0
2

There are 2 answers

1
user4935264 On

Javacard only support below keywords,It is only a subset of Java。 abstract default if private this boolean do implements protected throw break else import public throws byte extends instanceof return try case final int short void catch finally interface static while class for new super switch continue goto package

0
alex137 On

CAP files are only for classic applets. Connected applets are servlets packaged in JAR files.

JavaCard classic edition supports a very limited subset of Java. In particular Strings are not supported. This is why the CAP converter is rejecting your code.

To my knowledge, the connected edition is a dead technology. No smart-card product supports it.

The reason is that It was developed to support big SIM cards with lots of memory and high bandwidth interfaces (USB, MMC) but these never took up. Today's SIM cards or Secure Elements are still very limited devices.