This discussion is archived
1 Reply Latest reply: Jul 18, 2012 8:18 PM by safarmer RSS

6F00 in some cases: mysterious Java Card....

923272 Newbie
Currently Being Moderated
Hi,

I actually work on an applet which must register the AID of other applets (client applet )present on the smart card, that is to say it stores them in a list of byte arrays.
I succeed in registering them during their instantiation thanks to a shareable interface and in listing them in an APDU.
I am testing the deletion of the registration. This one occurs on request of the client applet. I use the following method eGoUnregister(temp) with temp which is the APDU buffer. Indeed, as I recover the AID via a shareable interface, I must use a global array.
Then I have retrieved the buffer containing the AID of the client applet, I make a search into the list of stored AIDs: I seearch the index of the list of AID and after that, I shift all the other AIDS to delete the client AId which want the deletion of its registration.
Here is my code:
/**
* Delete an AID from the list of AID.
* @param bArray the array containing the AID of the applet whose the deletion of the registration is required.
* @return true if the AID has been deleted from the list of AID, false else.
*/
public boolean deleteAID(byte[] bArray) {
               
          byte length = bArray[0]; //= anAID.getBytes(bufferTemp, (short)0);
          /* Research of the AID into the list*/
          byte index = MAX_NB_AID;
          for (byte i = 0x00; i<MAX_NB_AID;i++){
          if (length == list.getLength()){
               
                    if (Util.arrayCompare(list[i].getEgoAID(), (short)0, bArray, (short)1, length)==0){
                         
                         index = i;                         
                         break; // index checked
                    }
                    
               }
                         
          }
               
               /*Shift the others egoAID in the list if a deletion must be realized*/
               if (index == MAX_NB_AID) return false;
               else{
                    for (byte i = index; i< MAX_NB_AID-1;i++){
                    
                                   list[i].setLength(list[i+1].getLength());
                                        list[i].setEgoAID_Byte(list[i+1].getEgoAID());
                                        
                                   }
                    
                    ISOException.throwIt((short)0x6565);
                    
                    Util.arrayFillNonAtomic(bArray, (short)0, (short)0x10, (byte)0x00);
                    
                    list[MAX_NB_AID-1].setEgoAID_Byte(bArray);
                    list[MAX_NB_AID-1].setLength((byte)0);
                    return true;     
               }          
                                   
          }
Thos code works when the last registered applet want to delete its registration. But, if I want to delete the registration of the other applet than the last applet, I have a status word 6F00 and the deletion of the registration is not done.
Have you an idea of the problem???
Thanks very much in advance for all your ideas. I do not know where to search anymore.
  • 1. Re: 6F00 in some cases: mysterious Java Card....
    safarmer Expert
    Currently Being Moderated
    Can you show more of the code (the fields used etc)?

    You should also use &#123;code} blocks when posting code to make it readable.
    /**
    * Delete an AID from the list of AID.
    * @param bArray the array containing the AID of the applet whose the deletion of the registration is required.
    * @return true if the AID has been deleted from the list of AID, false else.
    */
    public boolean deleteAID(byte[] bArray) {
      byte length = bArray[0]; //= anAID.getBytes(bufferTemp, (short)0);
      /* Research of the AID into the list*/
      byte index = MAX_NB_AID; 
    
      for (byte i = 0x00; i<MAX_NB_AID;i++){
        if (length == list.getLength()){
          if (Util.arrayCompare(list.getEgoAID(), (short)0, bArray, (short)1, length)==0){
            index = i;  
            break; // index checked
          }
    
        }
    
      }
    
      /*Shift the others egoAID in the list if a deletion must be realized*/
      if (index == MAX_NB_AID) 
        return false;
      else{ 
        for (byte i = index; i< MAX_NB_AID-1;i++){
          list.setLength(list[i+1].getLength());
          list.setEgoAID_Byte(list[i+1].getEgoAID());
        }
    
        ISOException.throwIt((short)0x6565);
    
        Util.arrayFillNonAtomic(bArray, (short)0, (short)0x10, (byte)0x00);
        list[MAX_NB_AID-1].setEgoAID_Byte(bArray);
        list[MAX_NB_AID-1].setLength((byte)0);
        return true;  
      } 
    
    }
    Shane

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points