Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to Load Shareable Interface Package into the java card-Error 6985: Command not allowed

843851Jan 23 2009 — edited Jul 15 2010
Hi All,
My Environment is
jdk1.5.0_12
jre1.5.0_12
Gemalto GemCombiXpresso R4
GPShell 1.4.2.0 & Global Platform
windows xp

I have sucessfully loaded many applets into the Javacard with the above setup. Currently i am trying to create a shareable interface class and load it to the card. When i try to load the packages created by the shareable interface and applet packages associated with the shareable interface i am getting the following error in GPShell prompt is "load_applet() returns 0x80206985 (6985: Command not allowed - Conditions of use not satisfied.)"

The Procedure Followed
1) Created three java files as below
Code_Files.txt
server.java-The server applet which implements the shareable object.
client.java- The Aplet which uses the shareable interface object.
shareable.java- The shareable interface package.

2) Compiled them sucessfuly
3) converted the class files to cap files sucessfully
4) generated the bin files required for loading by following steps given in gpshell doc.
5) Failed to load applets into the card ("load_applet() returns 0x80206985 (6985: Command not allowed - Conditions of use not satisfied.)

The Code for each of this files is attached, Kindly let me know if i am wrong at any stage , Also i was not able to load any packages other than applets into the card, is there a different process to be followed to upload packages.

{code}
Shareable.java
package com.sun.javacard.samples.ShareableInterfaceTest.ShareableInterFace;
import javacard.framework.*;
public interface ShareableInterFace extends Shareable
{

public void grantMiles (short amount);
}

server.java
package com.sun.javacard.samples.ShareableInterfaceTest.Server; // Folder Name Where the java file is located
import javacard.framework.*;
import com.sun.javacard.samples.ShareableInterfaceTest.ShareableInterFace.*;// importing the shareable interface class package

public class Server extends Applet implements ShareableInterFace // Server is the java file name
{
//Required AppletCode

short Miles=1000;
public Shareable getShareableInterfaceObject(AID client_aid, byte parameter)
{
return this;
}
public void grantMiles(short amount)
{
Miles=(short)(Miles+amount);

}

}

client.java

package com.sun.javacard.samples.ShareableInterfaceTest.Client; // Folder Name Where the java file is located
import javacard.framework.*;
import com.sun.javacard.samples.ShareableInterfaceTest.ShareableInterFace.*; // shareable interface class file import
public class Client extends Applet
{ // ECouponjava1 is the java file name


// required applet methds

private void TestSIO(APDU apdu)
{
byte[] buffer = apdu.getBuffer();
AID JCRec_ServerAID= JCSystem.lookupAID(SERVER_AID,(short)0,(byte)SERVER_AID.length);
if(JCRec_ServerAID==null)
ISOException.throwIt(SW_APP_DN_EXIST);

ShareableInterFace sio= (ShareableInterFace)JCSystem.getAppletShareableInterfaceObject(JCRec_ServerAID,(byte)0);
short amt=100,AmtCal=0;
sio.grantMiles((short)amt);

short le = apdu.setOutgoing();
apdu.setOutgoingLength((byte)2);
buffer[0] = (byte)(AmtCal >> 8);
buffer[1] = (byte)(AmtCal & 0xFF);
apdu.sendBytes((byte)0, (byte)2);

}

} //
{code}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2010
Added on Jan 23 2009
14 comments
845 views