I am rather new to NFC communications, but I need a Flutter app that uses DESFIRE EV1 cards. Now, I am attempting to send the native authentication command, but the response is an error 67, which I believe is a length error. I would appreciate any insight as to why this is happening.
void _startScanning() async {
try {
NFCTag tag = await FlutterNfcKit.poll();
print("Tag: ${tag.id}");
setState(() {
_connectedTag = tag;
});
if (_connectedTag != null) {
print("Tag detected");
switch (_connectedTag!.type) {
case NFCTagType.mifare_desfire:
print("DESFire Tag");
if (_connectedTag != null) {
try {
//authenticate to master
Uint8List command = Uint8List.fromList([0x0A, 0x00]);
// Convert response to string (or handle accordingly)
print("Command Data: $command");
// Transceive the command
var response = await FlutterNfcKit.transceive(command);
String responseData = response.map((e) => e.toRadixString(16).padLeft(2, '0')).join(' ');
print("Response Data: $response");
try {
//fail on purpose
var result2 = await FlutterNfcKit.transceive(response);
print("Response Data: $result2");
} catch (e) {
print("Error: $e");
}
} catch (e) {
print("Error: $e");
}
}
FlutterNfcKit.finish(iosAlertMessage: "");
break;
case NFCTagType.mifare_ultralight:
print("MIFARE Ultralight Tag");
break;
case NFCTagType.mifare_classic:
print("MIFARE Classic Tag");
break;
case NFCTagType.iso7816:
print("ISO 7816 Tag");
_sendMifareCommand([0x1A, 0x00]);
break;
case NFCTagType.iso15693:
print("ISO 15693 Tag");
break;
default:
print("Unknown Tag");
}
}
} catch (e) {
print("Error: $e");
}
}