JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

Get 6C80 in the response APDU

JavaCard Applet Development Related Questions and Answers.
nikonai
Posts: 17
Joined: Mon Feb 22, 2016 4:37 am
Points :177
Contact:

Get 6C80 in the response APDU

Post by nikonai » Mon Feb 22, 2016 4:57 am

Here is part of my applet code which is to handle specific APDU command :

Code: Select all

...

private void updateCardMetaData(APDU apdu){
        byte[] buffer = apdu.getBuffer();
        short len = (short) (buffer[ISO7816.OFFSET_LC] & 0x00FF);
        cardMetaData=    processCardMetaData(buffer,len);
        short    length =(short) cardMetaData.length;
        Util.arrayCopyNonAtomic(cardMetaData, (short) 0, buffer, (short) 0,
        (short) length);
   
     apdu.setOutgoingAndSend((short) 0, length);
    }
 ...
//Code for processCardMetaData
private byte[] processCardMetaData(byte[] buffer,short len){
        //cardMetaData
        byte tempData[]= new byte[128];
        short counter=(short)0;
        short counter2=(short)(counter+5);
        while(counter<len){
            tempData[counter]    =buffer[counter2];
            counter+=1;
            counter2+=1;//=(short)(counter2+1);
        }
        return tempData;
    }


This is the APDU command which is supposed to write data to the card.

Code: Select all

 --> 805500002D416D626F6B6120496D6D6163756C617465204F64696D617C3130313337
36303130303030303035317C31323135

<-- 6C80

I don't expect any data in the response. Why do I get that error? Is there any error in my applet code?

User avatar
mabel
Posts: 237
Joined: Mon May 18, 2015 3:09 am
Points :1705
Contact:

Re: Get 6C80 in the response APDU

Post by mabel » Thu Feb 25, 2016 11:17 pm

From your code, it looks like you are copying the input data into cardMetaData buffer and copying back to the global buffer.

And last line in your function 'updateCardMetaData' you are trying to return the length bytes of data(128B) which is why you are getting 0x6C80.

If you don't expect any data in the response and just want to return "90 00", put ISOException.throwIt((short) 0x9000) instead of apdu.setOutgoingAndSend((short) 0, length).

Hope it helps!

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 47 guests

JavaCard OS : Disclaimer