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.

Get 6F00 Error code

JavaCard Applet Development Related Questions and Answers.
Riddle
Posts: 12
Joined: Mon Dec 28, 2015 11:41 pm
Points :70
Contact:

Get 6F00 Error code

Post by Riddle » Mon Jun 26, 2017 3:11 am

When I run my client applet, the output appeared 6F 00 error code. Where do I make the mistake? Could somebody give me some clues? Thanks.

Here is my code.
Server Applet

Code: Select all

package hcl.demo.server;

import javacard.framework.AID;
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.JCSystem;
import javacard.framework.Shareable;
import javacard.framework.Util;

public class PurseApplet extends Applet implements PersonalizeInterface {
     
     
     public static byte[] client_bytes = {0x04,0x04,0x04,0x04,0x04};
     private static byte[] data = {0x02,0x03,0x04,0x06,0x07,0x08,0x09,0x01};
     private static byte[] rdata = null;
     

     public static void install(byte[] bArray, short bOffset, byte bLength) {
          // GP-compliant JavaCard applet registration
          new PurseApplet().register(bArray, (short) (bOffset + 1),
                    bArray[bOffset]);
     }
     
     public Shareable getShareableInterfaceObject(AID client_AID, byte parameter)
     {
          AID clientAID = JCSystem.lookupAID(client_bytes, (short)0, (byte)client_bytes.length);
          if(!clientAID.equals(client_AID))
          {
          return null;         
          }
         
          getByte();
         
          return (PersonalizeInterface)this;
         
     }

     public void process(APDU apdu) {
          // Good practice: Return 9000 on SELECT
          if (selectingApplet()) {
               return;
          }

          byte[] buf = apdu.getBuffer();
          switch (buf[ISO7816.OFFSET_INS]) {
          case (byte) 0x00:
               break;
          default:
               // good practice: If you don't know the INStruction, say so:
               ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
          }
     }
     
     public byte[] getByte() {
          // TODO Auto-generated method stub
          rdata = data;
          return rdata;
         
     }

     

}



Shareable Interface

Code: Select all

package hcl.demo.server;

import javacard.framework.Shareable;

public interface PersonalizeInterface extends Shareable{
     
     public byte[] getByte();

}


Client Applet

Code: Select all

package hcl.demo.shareObject;

import hcl.demo.server.PersonalizeInterface;
import javacard.framework.AID;
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.JCSystem;
import javacard.framework.Util;


public class Client extends Applet {
     private static byte[] purse_AID_bytes = {0x06,0x06,0x06,0x06,0x06};
     private static byte[] data = {0x02,0x03,0x04,0x06,0x07,0x08,0x09,0x01};
     

     public static void install(byte[] bArray, short bOffset, byte bLength) {
          // GP-compliant JavaCard applet registration
          new Client().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
     }
     
     public static void uninstall(byte[] bArray, short bOffset, byte bLength) {
          // GP-compliant JavaCard applet registration
          purse_AID_bytes=null;
          data=null;
         
          //new Client().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
     }

     public void process(APDU apdu) {
         
          // Good practice: Return 9000 on SELECT
          if (selectingApplet()) {
               return;
          }

          byte[] buf = apdu.getBuffer();
          switch (buf[ISO7816.OFFSET_INS]) {
          case (byte) 0x00:getServerByte(apdu,buf);
               break;
          default:
               // good practice: If you don't know the INStruction, say so:
               ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
          }
     }

     

     public void getServerByte(APDU apdu,byte[] buff) {
          // TODO Auto-generated method stub
         
          PersonalizeInterface personalizeInterface = null;
         
          // Obtain the server AID
          AID purse_AID = JCSystem.lookupAID(purse_AID_bytes, (short)0, (byte)purse_AID_bytes.length);
          if(purse_AID != null)
          {
               
               personalizeInterface = (PersonalizeInterface) (JCSystem.getAppletShareableInterfaceObject(purse_AID, (byte)0));
          }
         
          if(personalizeInterface != null)
          {
               Util.arrayCopy(personalizeInterface.getByte(),(short) 0, buff, (short) 0, (short)8);
               apdu.setOutgoingAndSend((byte)0, (short)8);
               
          }
          else
          {
               ISOException.throwIt(ISO7816.SW_APPLET_SELECT_FAILED);
          }
         
     }

     
}

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

Re: Get 6F00 Error code

Post by UNKNwYSHSA » Mon Jun 26, 2017 10:41 pm

Which command got 0x6F00 error?
sense and simplicity

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 30 guests

JavaCard OS : Disclaimer