JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html
https://ftsafe.en.alibaba.com/index.html
Including new Packages
-
- Posts: 9
- Joined: Sun Sep 06, 2015 1:11 pm
- Points :508
- Contact:
Including new Packages
Hello All,
I'm using the JCIDE tool to create a Mobile SIM card applet. I've noticed the tool STK doesn't has this packages:
import sim.toolkit.*;
import sim.access.*;
When I build the Package, the JCIDE reports the errors:
C:\WORKSP~1\SOSREC~1\src\SOSREC~1\appsosrecoveryv2.java:31: error: package sim.toolkit does not exist
import sim.toolkit.*;
^
C:\WORKSP~1\SOSREC~1\src\SOSREC~1\appsosrecoveryv2.java:32: error: package sim.access does not exist
import sim.access.*;
I need help to know how to include this packages to create Mobile SIM cards related applets.
Thanks
Regards
I'm using the JCIDE tool to create a Mobile SIM card applet. I've noticed the tool STK doesn't has this packages:
import sim.toolkit.*;
import sim.access.*;
When I build the Package, the JCIDE reports the errors:
C:\WORKSP~1\SOSREC~1\src\SOSREC~1\appsosrecoveryv2.java:31: error: package sim.toolkit does not exist
import sim.toolkit.*;
^
C:\WORKSP~1\SOSREC~1\src\SOSREC~1\appsosrecoveryv2.java:32: error: package sim.access does not exist
import sim.access.*;
I need help to know how to include this packages to create Mobile SIM cards related applets.
Thanks
Regards
- UNKNwYSHSA
- Posts: 630
- Joined: Thu May 21, 2015 4:05 am
- Points :3055
- Contact:
Re: Including new Packages
I have a test to create an javacard applet use JCIDE.
1 (Optional step), unzip the jar to %JCKIT_INSTALL_DIR%\SDK\Tools\JCIDE\apis\jc222, this is for the code auto-complete;
2 JCIDE main menu -> Build -> Property -> Local JCKit configurations:
A Add sim.jar to the -classpath item in "java.exe option";
B Add stk export file dir path to -exportpath item in "JCKit Option";
3 I found the hello world code in the ToolkitInterface.java; Copy the code as my helloStk code; Code as following:
4 Build the project, that's OK.
You can have a test of this applet on your card, it's run normal or not? Wait your message.
1 (Optional step), unzip the jar to %JCKIT_INSTALL_DIR%\SDK\Tools\JCIDE\apis\jc222, this is for the code auto-complete;
2 JCIDE main menu -> Build -> Property -> Local JCKit configurations:
A Add sim.jar to the -classpath item in "java.exe option";
B Add stk export file dir path to -exportpath item in "JCKit Option";
3 I found the hello world code in the ToolkitInterface.java; Copy the code as my helloStk code; Code as following:
Code: Select all
package helloStk;
import javacard.framework.*;
import sim.toolkit.*;
//
// The HelloWorld class is a simple Toolkit applet, which may be used as an
// example to show how such an applet will be installed and registered and
// how it will be triggered.
//
public class helloStk extends Applet implements ToolkitInterface,ToolkitConstants {
// data fields
private static final byte CMD_QUALIFIER = (byte)0x80;
private byte[] menuEntry = {'S','e','r','v','i','c','e','1'};
private byte[] textBuf = {'H','e','l','l','o',' ','w','o','r','l','d',' ','!'};
private ToolkitRegistry reg;
//
// Constructor of applet
//
public helloStk() {
// get a Registry object...
// ...and initialize it according to the applet characteristics
reg.initMenuEntry(menuEntry, (short)0, (short)menuEntry.length, PRO_CMD_DISPLAY_TEXT, false, (byte) 0, (short) 0);
}
//
// Install method
// *param bArray the array containing installation parameters
// *param bOffset the starting offset in bArray
// *param bLength the length in bytes of the parameter data in bArray
//
public static void install(byte bArray[], short bOffset, byte bLength) throws ISOException {
// create and register applet
helloStk HelloWorldApplet = new helloStk();
HelloWorldApplet.register();
}
//
// Process toolkit events
// *param event the type of event to be processed
// *exception ToolkitException
//
public void processToolkit(byte event) throws ToolkitException {
// get the ProactiveHandler system instance
ProactiveHandler proHdlr = ProactiveHandler.getTheHandler();
if (event == EVENT_MENU_SELECTION) {
// prepare a Display Text command
proHdlr.init((byte) PRO_CMD_DISPLAY_TEXT, (byte)CMD_QUALIFIER, (byte)0x02);
proHdlr.appendTLV((byte)(TAG_TEXT_STRING | TAG_SET_CR), textBuf,
(short)0, (short)textBuf.length);
proHdlr.send();
}
}
@Override
public void process(APDU apdu) throws ISOException {
// TODO Auto-generated method stub
}
}
4 Build the project, that's OK.
You can have a test of this applet on your card, it's run normal or not? Wait your message.
You do not have the required permissions to view the files attached to this post. Please login first.
sense and simplicity
-
- Posts: 9
- Joined: Sun Sep 06, 2015 1:11 pm
- Points :508
- Contact:
Re: Including new Packages
Hi
Thanks for your answer. Although, I don't have the sim.jar package in my folder C:\JavaCardKit\JDK\lib, neither into C:\JCDK222\lib nor C:\JC_CLASSIC_HOME\lib.
I noticed that you get it from a open_source\javacard\sim-tools library. Could you give me the web link to download it?
Thanks
Thanks for your answer. Although, I don't have the sim.jar package in my folder C:\JavaCardKit\JDK\lib, neither into C:\JCDK222\lib nor C:\JC_CLASSIC_HOME\lib.
I noticed that you get it from a open_source\javacard\sim-tools library. Could you give me the web link to download it?
Thanks
-
- Posts: 9
- Joined: Sun Sep 06, 2015 1:11 pm
- Points :508
- Contact:
Re: Including new Packages
Hello,
I've found the package from https://github.com/Shadytel/sim-tools repository. I downloaded it and configured the JCIDE. Further your described information, I've to add C:\open_source\javacard\sim-tools\javacard\lib\sim.jar into the menu "Local Javac Option" classpath, as depicted in the follow picture:
http://goo.gl/3UGk7a
The build worked properly without errors. But, when I debug it there is an error when is loading the package onto the card via the Card Manager.
The Install Command for Load (80 E6 02 00 12 ...) worked properly. But the Load command Pack (80 E8 00 00 ...) failed with the SW 6A 88 (Referenced data or reference data not found):
http://goo.gl/3qck3B
Load Command Pack:
>> 80 E8 00 00 FF C4 82 01 C1 01 00 18 DE CA FF ED 02 02 04 00 01 05 11 22 33 44 55 08 68 65 6C 6C 6F 53 74 6B 02 00 21 00 18 00 21 00 0A 00 28 00 32 00 1A 00 D1 00 0A 00 14 00 00 00 92 03 19 00 00 00 00 00 00 03 01 00 04 00 28 03 03 01 07 A0 00 00 00 62 01 01 06 02 10 A0 00 00 00 09 00 03 FF FF FF FF 89 10 71 00 02 00 01 07 A0 00 00 00 62 00 01 03 00 0A 01 06 11 22 33 44 55 66 00 99 06 00 1A 00 00 43 80 03 03 00 03 07 02 00 00 00 CE 00 A8 80 02 00 81 01 01 08 81 00 00 07 00 D1 00 08 10 18 8C 00 03 18 10 08 90 0B 3D 03 10 53 38 3D 04 10 65 38 3D 05 10 72 38 3D 06 10 76 38 3D 07 10 69 38 3D 08 10 63 38 3D 10 06 10 65 38 3D 10 07 10 31 38 87 00 18 10 0D 90 0B 3D 03 10 48 38 3D 04 10 65 38 3D 05 10 6C 38 3D 06 10 6C 38 3D 07 10 6F 38 3D 08 10 20 38 3D 10 06 10 77 38 3D 10 07 01
Do you know what could be the problem? I really appreciate your golden support.
Thanks
I've found the package from https://github.com/Shadytel/sim-tools repository. I downloaded it and configured the JCIDE. Further your described information, I've to add C:\open_source\javacard\sim-tools\javacard\lib\sim.jar into the menu "Local Javac Option" classpath, as depicted in the follow picture:
http://goo.gl/3UGk7a
The build worked properly without errors. But, when I debug it there is an error when is loading the package onto the card via the Card Manager.
The Install Command for Load (80 E6 02 00 12 ...) worked properly. But the Load command Pack (80 E8 00 00 ...) failed with the SW 6A 88 (Referenced data or reference data not found):
http://goo.gl/3qck3B
Load Command Pack:
>> 80 E8 00 00 FF C4 82 01 C1 01 00 18 DE CA FF ED 02 02 04 00 01 05 11 22 33 44 55 08 68 65 6C 6C 6F 53 74 6B 02 00 21 00 18 00 21 00 0A 00 28 00 32 00 1A 00 D1 00 0A 00 14 00 00 00 92 03 19 00 00 00 00 00 00 03 01 00 04 00 28 03 03 01 07 A0 00 00 00 62 01 01 06 02 10 A0 00 00 00 09 00 03 FF FF FF FF 89 10 71 00 02 00 01 07 A0 00 00 00 62 00 01 03 00 0A 01 06 11 22 33 44 55 66 00 99 06 00 1A 00 00 43 80 03 03 00 03 07 02 00 00 00 CE 00 A8 80 02 00 81 01 01 08 81 00 00 07 00 D1 00 08 10 18 8C 00 03 18 10 08 90 0B 3D 03 10 53 38 3D 04 10 65 38 3D 05 10 72 38 3D 06 10 76 38 3D 07 10 69 38 3D 08 10 63 38 3D 10 06 10 65 38 3D 10 07 10 31 38 87 00 18 10 0D 90 0B 3D 03 10 48 38 3D 04 10 65 38 3D 05 10 6C 38 3D 06 10 6C 38 3D 07 10 6F 38 3D 08 10 20 38 3D 10 06 10 77 38 3D 10 07 01
Do you know what could be the problem? I really appreciate your golden support.
Thanks
Last edited by JorgeGomes on Wed Sep 16, 2015 4:45 pm, edited 2 times in total.
- UNKNwYSHSA
- Posts: 630
- Joined: Thu May 21, 2015 4:05 am
- Points :3055
- Contact:
- UNKNwYSHSA
- Posts: 630
- Joined: Thu May 21, 2015 4:05 am
- Points :3055
- Contact:
-
- Posts: 9
- Joined: Sun Sep 06, 2015 1:11 pm
- Points :508
- Contact:
Re: Including new Packages
Hello UNKNwYSHSA,
I have change the images by its link. Try to see them.
My intentions is to use telecomm cards. But, the problems I described is when I run the build option in the JCIDE tool. I couldn't overcome this step. I followed instructions but this step failed. Have you get success?
Thanks
I have change the images by its link. Try to see them.
My intentions is to use telecomm cards. But, the problems I described is when I run the build option in the JCIDE tool. I couldn't overcome this step. I followed instructions but this step failed. Have you get success?
Thanks
- UNKNwYSHSA
- Posts: 630
- Joined: Thu May 21, 2015 4:05 am
- Points :3055
- Contact:
Re: Including new Packages
You met problem on the load step when debugging?
I think the reason is the JCIDE debugger can't support SIM card functions debug. You can try the CAP on your real SIM card, waiting for your test result. And sorry for my later reply,
I think the reason is the JCIDE debugger can't support SIM card functions debug. You can try the CAP on your real SIM card, waiting for your test result. And sorry for my later reply,
sense and simplicity
- UNKNwYSHSA
- Posts: 630
- Joined: Thu May 21, 2015 4:05 am
- Points :3055
- Contact:
Re: Including new Packages
I don not has one SIM card, so i can't do the test.
I just hope my method can help you to solve this problem.
So waiting you reply.
I just hope my method can help you to solve this problem.
So waiting you reply.
sense and simplicity
-
- Posts: 9
- Joined: Sun Sep 06, 2015 1:11 pm
- Points :508
- Contact:
Re: Including new Packages
Hello
I've tried to download the generated cap without success. It was expected cause I didn't configured nothing related to the card keys (ENC, KEK and MAC), and the reported error from pyApdutool was:
~Connect successful.
Select CardManager begin...
Select CardManager successful.
Disconnect successful.
Connect successful.
Download Cap begin...
Download Cap error: Check Card Cryptogram failed.
Could you give a tip how and where I can configure the card keys? These cards that I've using have Secure Domain AID A0 00 00 00 03 00 00 00, the same that the JCIDE is using by default. If I need change it, how I can do it?
Thanks
Regards
I've tried to download the generated cap without success. It was expected cause I didn't configured nothing related to the card keys (ENC, KEK and MAC), and the reported error from pyApdutool was:
~Connect successful.
Select CardManager begin...
Select CardManager successful.
Disconnect successful.
Connect successful.
Download Cap begin...
Download Cap error: Check Card Cryptogram failed.
Could you give a tip how and where I can configure the card keys? These cards that I've using have Secure Domain AID A0 00 00 00 03 00 00 00, the same that the JCIDE is using by default. If I need change it, how I can do it?
Thanks
Regards
Who is online
Users browsing this forum: No registered users and 53 guests