Page 1 of 1

Get Response 6F00

Posted: Thu Sep 01, 2016 11:44 pm
by Janel
I wrote an applet, The followings are part of the code. When I sent my command to the card, it can return the data successfully. But about 50 times, it returned "6F00". What happened? How can I solve this problem?

Code: Select all

//Get data from APDU, generate random code, encrypt the data and then send it.
private void apro(APDU apdu) {
        byte[] buffer = apdu.getBuffer();
        byte[] random=new byte[4];
        gen_random(random);
        byte[] data=new byte[8];
        data[0]=random[0];
        data[1]=(byte)0x88;
        data[2]=(byte)0x32;
        data[3]=(byte)0x86;
        data[4]=(byte)0x80;
        data[5]=random[1];
        data[6]=random[2];
        data[7]=random[3];
        byte[] data2=encryptdata(data,keydata,(byte)0);
        Util.arrayCopyNonAtomic(data2, (short)0, buffer, (short)0, (short) 8);
        apdu.setOutgoingAndSend((short)0, (short)8);

Re: Get Response 6F00

Posted: Fri Sep 02, 2016 3:27 am
by Marshaldll
Just a small tip for you, allocate memory in constructor. Don't allocate it when executing APDU command.

Re: Get Response 6F00

Posted: Fri Sep 02, 2016 4:45 am
by chico0609
I guess that is because storage space is insufficient. You can use JCIDE to debug your applet, then watch memory space situation in the Memory window.

Re: Get Response 6F00

Posted: Fri Sep 02, 2016 5:23 am
by Tazmania09
If you allocated memory when executing APDU command, remember to call JCSystem.requestObjectDeletion () to collect garbage in order to avoid memory leak.