Hello Eddy,
we have checked your issue, but are unable to reproduce on a fresh card. What we did:
mIDESFireEV2.selectApplication(0);
mIDESFireEV2.authenticateEV2First(0, DESFireKeys.aesKeyDataDefault, null);
mIDESFireEV2.format();
basically, this is using a fresh card and runs the format command, no issue can be observed.
As the error reported is 126, this indicates a length error, it seems that the phone is transmitting the command wrongly. Do you have the possibility to provide an APDU log, meaning what data is sent between the card and the phone via NFC?
And: Do you have a possibility to verify with a fresh card without any settings made? It is possible to deactivate the format command on MIFARE DESFire EV2, in which case the card would reply with only one byte error code, and not with the expected 1 byte success code + 8 byte CMAC. So pleas verify that Format is allowed on the card you are using.
Br,
Florian
Customer Application Support Engineer - Gratkorn - Austria