3

I am a beginner in developpement, i am trying to load stk applet into Sim card, this is my question :

I have an STK applet code source.

I have a smart card reader (gemplus pc/sc)

I have a SIM card and the administration code

I installed eclipse and added JAvaCard and SIM API libraries

when i try to run the applet i get this error :

    Charger : la classe ImsiManager.class est introuvable.
java.lang.ClassNotFoundException: ImsiManager.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

and a appletviewer window appear with " applet non inisialized" as a message.

please can someone help? I need to know how can I load this applet into my sim card ? all suggestions are welcome

Thank you.

DGz
  • 109
  • 2
  • 6
  • Take a look at these slides : https://www.defcon.org/images/defcon-21/dc-21-presentations/Koscher-Butler/DEFCON-21-Koscher-Butler-The-Secret-Life-of-SIM-Cards-Updated.pdf I think those are useful for you. – Ebrahim Ghasemi Apr 22 '15 at 16:25
  • As far as I know you **CAN'T** run SIM applets in Eclipse IDE without any simulator. You need to use a SIM card simulator or try to run it on a real SIM card. For uploading (and installing) your applets, first of all you need to convert your applet to CAP file. You need to work with converter tool in Java Card development kit. instead of that you can simply use **Eclipse-JCDE** plugin to convert your applets. After converting you need to upload this CAP file on the SIM card. You can use some already-written open source tools. **GlobalPlatformPro** is one of them.(Google it) – Ebrahim Ghasemi Apr 22 '15 at 16:28
  • Thank you for response ! I have a real SIM card and a reader , i think i can load my applet into this sim card... But I think that I should add the JCOP plug-in to eclipse in order to get the .cap file. i cant find the package (JCOP) in internet, i wonder if it is availble in free ? do you have an idea ? – DGz Apr 23 '15 at 09:32
  • No, you can't find a free version of it. But you can use **Eclipse-JCDE** plugin instead. (download here : http://sourceforge.net/projects/eclipse-jcde/files/) I don't have any idea that you can use it for convert applets that contain SIM APIs or not, but I'm sure that it is sufficient for converting Java Card applets to CAP files – Ebrahim Ghasemi Apr 23 '15 at 09:48
  • I added Eclipse JCDE plugin and it's work , i can now create applet , convert it to a .cap file and give it an AID .... – DGz Apr 23 '15 at 12:29
  • Thank you again , you can write your comment as an answer , then i can make the question as solved – DGz Apr 23 '15 at 12:31

2 Answers2

2

You can't run SIM applets in Eclipse IDE without using a simulator and you need to use a SIM card simulator (It can be a plugin for your IDE also) or try to run your applet on a real SIM card.

Moreover, for uploading (and installing) your applets, first of all you need to convert that program to a CAP file. There is a tool in Java Card development kit named converter that you can use it to convert applets to CAP files.

Instead of using converter tool directly, you can simply use Eclipse-JCDE plugin to work with this tool and convert your applets.

After converting you need to upload this CAP file on the SIM card. You can use some already-written open source tools to aim this goal. GlobalPlatformPro is well-documented one.

Note that : I'm afraid if the Java Card Development kit is able to convert applets with proprietary SIM APIs to CAP files. but for applets that contains only Java Card API, you can use it simply.

Ebrahim Ghasemi
  • 5,850
  • 10
  • 52
  • 113
  • Exactly ! i am having problems with my applet because of the SIM APIs, any idea to resolve this problem ? – DGz Apr 23 '15 at 14:08
  • @DGz Unfortunately no idea. where did you download the SIM APIs? I think in some ETSI packages you can find useful tools. There was some question in this community useful for you. Look at SIM tagged questions – Ebrahim Ghasemi Apr 23 '15 at 23:27
  • Yes It is a ETSI package, I downloaded the SIM API packages from this : http://stackoverflow.com/questions/22362327/sim-toolkit-application-javacard-development-kit/22471187#22471187 – DGz Apr 24 '15 at 07:44
  • @DGz I left a comment there.I Hope David help us :) – Ebrahim Ghasemi Apr 24 '15 at 07:56
  • Thank you @Abraham, I hope too :) – DGz Apr 24 '15 at 09:25
  • @DGz Please try again with David comments and update me about your results. :) http://stackoverflow.com/questions/22362327/sim-toolkit-application-javacard-development-kit/22471187?noredirect=1#comment47824007_22471187 – Ebrahim Ghasemi Apr 25 '15 at 12:20
  • OK, i'll informe you :) – DGz Apr 27 '15 at 08:31
  • 1
    Hello Abraham, I did exactly what David said , i extract the Annex_B_Export_Files and copied the sim directory into the export files directory (api_export_files), everything work normaly, now i can convert applets even with SIM API proprietary. Dont hesitate if you have any questions. – DGz Apr 28 '15 at 08:11
0

How to convert code to cap file:

  • USE JCWDE Eclipse plugin to convert your code to CAP file. Check eclipse marketplace for plugin and its related guide. You will need JAVACARD development kit for this activity, go to Oracle website to download it or simply google it.

How to load cap file to card:

  • Visit Simalliance website, download Simalliance catloader tool. It support loading and exploring the cards. You should have related card keys to load/install or delete the applications on card.

  • Check Catloader manual on how to use the tool. ITS FREE to USE.

Enjoy :)