0

during the creation of a transaction mac file, at a Mifare Desfire Ev2 card, I receive an error. "com.nxp.nfclib.exceptions.PICCException: Parameter Error SW2 = -98" I am using the Taplinx libary, with the following transaction file settings:

public static final byte[] KEY_AES128_00_DEFAULT =
            {
                    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00
            };
    DESFireFile.Ev2TransactionMacFileSettings fileSettings = new DESFireFile.Ev2TransactionMacFileSettings(
                        IDESFireEV2.CommunicationType.Plain,    //comSettings
                        (byte) 0x00,                            //readAccess
                        (byte) 0x0f,                            //writeAccess
                        (byte) 0x00,                            //readWriteAccess
                        (byte) 0x00,                            //changeAccess
                        (byte) 0x00,                            //tmKeyOption
                        KEY_AES128_00_DEFAULT,                  //tmKey
                        (byte) 0x00);                           //tmKeyVersion

I think that this should be right acording to the Documentation: https://www.mifare.net/developer/javadoc/android/ but I still receive the error. If anybody knows something please let me know. Thanks <3

eT4aa
  • 11
  • 4

1 Answers1

0

After 3 days hard work this is the solution I got:

DESFireFile.Ev2TransactionMacFileSettings fileSettings = new DESFireFile.Ev2TransactionMacFileSettings(
                IDESFireEV1.CommunicationType.Plain,   //comSettings
                (byte) 0x0,                            //readAccess
                (byte) 0xF,                            //writeAccess
                (byte) 0xF,                            //readWriteAccess
                (byte) 0x0,                            //changeAccess
                (byte) 0x2,                            //tmKeyOption
                KEY_AES128_00_DEFAULT,                 //tmKey
                (byte) 0x0);                           //tmKeyVersion
        desfire.createFile(0x00, fileSettings);
eT4aa
  • 11
  • 4