Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

Including new Packages

JavaCard Applet Development Related Questions and Answers.
mainakanyi
Posts: 20
Joined: Mon Nov 28, 2016 9:13 am
Points :90
Contact:

Re: Including new Packages

Post by mainakanyi » Tue Nov 29, 2016 8:22 am

UNKNwYSHSA wrote:The command "install for load" is already failed. So the install command can't be succeeded.
Please tell me more information of your card, eg. the card name or model. I haven't seen the APDU commands before.


I am using Gemalto USB Smart Card reader and a g&d micro sim card, but I am not sure about the model

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: Including new Packages

Post by UNKNwYSHSA » Tue Nov 29, 2016 8:33 am

I already got the informations. Your card maybe this one:


Can you give me the code of "install" method in package "testing.applet.kanyi"? Your cap is loaded, but install failed.
sense and simplicity

mainakanyi
Posts: 20
Joined: Mon Nov 28, 2016 9:13 am
Points :90
Contact:

Re: Including new Packages

Post by mainakanyi » Tue Nov 29, 2016 8:39 am

UNKNwYSHSA wrote:I already got the informations. Your card maybe this one:


Can you give me the code of "install" method in package "testing.applet.kanyi"? Your cap is loaded, but install failed.


Package AID: 04 02 05 07 08 05 03 00 11 07 08 05 04 03 02
Applet class AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20
Instance AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: Including new Packages

Post by UNKNwYSHSA » Tue Nov 29, 2016 8:41 am

I means the source code. Did you have the source code of package "testing.applet.kanyi"?? I only need the code of method "install".
sense and simplicity

mainakanyi
Posts: 20
Joined: Mon Nov 28, 2016 9:13 am
Points :90
Contact:

Re: Including new Packages

Post by mainakanyi » Tue Nov 29, 2016 8:55 am

UNKNwYSHSA wrote:I means the source code. Did you have the source code of package "testing.applet.kanyi"?? I only need the code of method "install".

UNKNwYSHSA wrote:I means the source code. Did you have the source code of package "testing.applet.kanyi"?? I only need the code of method "install".

package testing.applet.kanyi;

import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISOException;
import sim.toolkit.EnvelopeHandler;
import sim.toolkit.ProactiveHandler;
import sim.toolkit.ToolkitConstants;
import sim.toolkit.ToolkitException;
import sim.toolkit.ToolkitInterface;
import sim.toolkit.ToolkitRegistry;

public class AppletKanyi extends Applet implements ToolkitInterface, ToolkitConstants {
// DON'T DECLARE USELESS INSTANCE VARIABLES! They get saved to the EEPROM,
// which has a limited number of write cycles.
private byte helloMenuItem;

static byte[] welcomeMsg = new byte[] { 'W', 'e', 'l', 'c', 'o', 'm', 'e', ' ',
't', 'o', ' ', 'T', 'o', 'o', 'r', 'C',
'a', 'm', 'p', ' ', '2', '0', '1', '2' };

static byte[] menuItemText = new byte[] { 'H', 'e', 'l', 'l', 'o', ',', ' ', 'S', 'T', 'K'};

private AppletKanyi() {
// This is the interface to the STK applet registry (which is separate
// from the JavaCard applet registry!)
ToolkitRegistry reg = ToolkitRegistry.getEntry();

// Define the applet Menu Entry
helloMenuItem = reg.initMenuEntry(menuItemText, (short)0, (short)menuItemText.length,
PRO_CMD_SELECT_ITEM, false, (byte)0, (short)0);
}

// This method is called by the card when the applet is installed. You must
// instantiate your applet and register it here.
public static void install(byte[] bArray, short bOffset, byte bLength) {
AppletKanyi applet = new AppletKanyi();
applet.register();
}

// This processes APDUs sent directly to the applet. For STK applets, this
// interface isn't really used.
public void process(APDU arg0) throws ISOException {
// ignore the applet select command dispached to the process
if (selectingApplet())
return;
}

// This processes STK events.
public void processToolkit(byte event) throws ToolkitException {
EnvelopeHandler envHdlr = EnvelopeHandler.getTheHandler();

if (event == EVENT_MENU_SELECTION) {
byte selectedItemId = envHdlr.getItemIdentifier();

if (selectedItemId == helloMenuItem) {
showHello();
}
}
}

private void showHello() {
ProactiveHandler proHdlr = ProactiveHandler.getTheHandler();
proHdlr.initDisplayText((byte)0, DCS_8_BIT_DATA, welcomeMsg, (short)0,
(short)(welcomeMsg.length));
proHdlr.send();
return;
}
}

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: Including new Packages

Post by UNKNwYSHSA » Tue Nov 29, 2016 8:59 am

Here's one sample code:
http://www.andresteder.com/static/api/s ... istry.html
https://java.net/projects/phoneme/sourc ... istry.java

Change your code same as this sample. and retry again.
Your applet is only a helloworld. :D
sense and simplicity

mainakanyi
Posts: 20
Joined: Mon Nov 28, 2016 9:13 am
Points :90
Contact:

Re: Including new Packages

Post by mainakanyi » Tue Nov 29, 2016 9:08 am

UNKNwYSHSA wrote:Here's one sample code:
http://www.andresteder.com/static/api/s ... istry.html
https://java.net/projects/phoneme/sourc ... istry.java

Change your code same as this sample. and retry again.
Your applet is only a helloworld. :D


Ok! Let me change. Thanks

mainakanyi
Posts: 20
Joined: Mon Nov 28, 2016 9:13 am
Points :90
Contact:

Re: Including new Packages

Post by mainakanyi » Tue Nov 29, 2016 9:23 am

mainakanyi wrote:
UNKNwYSHSA wrote:Here's one sample code:
http://www.andresteder.com/static/api/s ... istry.html
https://java.net/projects/phoneme/sourc ... istry.java

Change your code same as this sample. and retry again.
Your applet is only a helloworld. :D


Ok! Let me change. Thanks


Has loaded successfully. But refused to install. What do I need to put in this textfields?
You do not have the required permissions to view the files attached to this post. Please login first.

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: Including new Packages

Post by UNKNwYSHSA » Tue Nov 29, 2016 9:16 pm

Two point:
1 Don't take attention to the install parameters, the parameters is not used in the "install" method from your source code;
2 Change your applet AID and try again:

Code: Select all

    Package AID: 04 02 05 07 08 05 03 00 11 07 08 05 04 03 02
    Applet class AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20
    Instance AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20
Change AID to:

Code: Select all

    Package AID: 04 02 05 07 08 05 03 00 11 07
    Applet class AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20
    Instance AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20
Maybe the problem is that the applet AID is not startswith package AID.
sense and simplicity

mainakanyi
Posts: 20
Joined: Mon Nov 28, 2016 9:13 am
Points :90
Contact:

Re: Including new Packages

Post by mainakanyi » Wed Nov 30, 2016 2:07 am

UNKNwYSHSA wrote:Two point:
1 Don't take attention to the install parameters, the parameters is not used in the "install" method from your source code;
2 Change your applet AID and try again:

Code: Select all

    Package AID: 04 02 05 07 08 05 03 00 11 07 08 05 04 03 02
    Applet class AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20
    Instance AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20
Change AID to:

Code: Select all

    Package AID: 04 02 05 07 08 05 03 00 11 07
    Applet class AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20
    Instance AID: 04 02 05 07 08 05 03 00 11 07 00 30 50 40 30 20
Maybe the problem is that the applet AID is not startswith package AID.



Ok. Let me do so.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 12 guests

JavaCard OS : Disclaimer