Search code examples
androidmifareapducontactless-smartcard

I got '67 00' error when I create value file for DESFire


I'm working with DESFire cards and I now want create a value file in my application (app has ID 00 00 01).

I successfully selected my app with the given ID and then send my command for creating the value file to the isodep.transceive method.

My command is here:

byte[] cmdCreateValueFile = new byte[]{
        //cmd
        (byte)0xCC,
        //file no
        (byte)0x01, 
        //com.sett.
        (byte)0x00 ,
        //access rights
        (byte)0x44 , (byte)0x44,
        //lower limit
        (byte)0x00 ,(byte)0x00 ,(byte)0x00 ,(byte)0x00 ,
        //upper limit
        (byte)0x00 ,(byte)0x0F ,(byte)0x42 ,(byte)0x40 ,
        //initial value
        (byte)0x00 ,(byte)0x00 ,(byte)0x00 ,(byte)0x00 ,
        //limited credit enabled
        (byte)0x00
};

My DESFire application has 6 keys and I want to use key #4 for READ, WRITE, READ & WRITE, and change access rights.

I expected to receive status code 91 00, which means successfully creation of file, but the response is 67 00, which means wrong length.


Solution

  • You are mixing ISO commands (CLA INS P1 P2 LC DATA...) and native commands (INS DATA). Your previous command was an ISO command, that is why your card expects all commands to be ISO commands.