Issue with NTAG213 Password Removal - Card Becomes Unusable After AUTH0 Modification

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue with NTAG213 Password Removal - Card Becomes Unusable After AUTH0 Modification

1,067 Views
kamal511
Contributor I

Problem:

I'm working on a Flutter app using the flutter_nfc_kit package to manage NFC cards (NTAG213). I have successfully implemented password protection for NTAG213 cards, but I am facing a critical issue while trying to remove the password.

The problem occurs when I modify the AUTH0 page during the password removal process. Specifically:

  1. Setting the AUTH0 page to 0xFF or 0x0F makes the card permanently unusable (dead).
  2. Setting the AUTH0 page to 0x00 doesn't work as expected and fails to remove the protection.

Here’s the specific part of my code related to the issue:


Code:

Future<bool> removePasswordProtection({
required List<int> password,
}) async {
try {
setStatus('Checking NFC availability...');
var availability = await FlutterNfcKit.nfcAvailability;
if (availability != NFCAvailability.available) {
setStatus('NFC not available');
return false;
}

setStatus('Scanning for NFC tag...');
setScanning(true);

var tag = await FlutterNfcKit.poll(
timeout: const Duration(seconds: 10), androidCheckNDEF: true);

setStatus('Checking if card is NTAG213...');
if (!await isNTAG213(tag)) {
setStatus('Not an NTAG213 card');
return false;
}

setStatus('Attempting authentication...');
var authCommand = Uint8List.fromList([
0x1B, // PWD_AUTH command
password[0],
password[1],
password[2],
password[3]
]);

try {
var authResponse = await FlutterNfcKit.transceive(authCommand);
print('Auth Response: ${authResponse.map((e) => e.toRadixString(16).padLeft(2, '0')).join(' ')}');
if (authResponse.length < 2) {
setStatus('Authentication failed: Invalid response');
return false;
}
} catch (e) {
setStatus('Authentication Error: $e');
return false;
}

// Remove password
await FlutterNfcKit.transceive(
Uint8List.fromList([0xA2, 0x2B, 0xFF, 0xFF, 0xFF, 0xFF])); // Clear password
await FlutterNfcKit.transceive(
Uint8List.fromList([0xA2, 0x2C, 0x00, 0x00, 0x00, 0x00])); // Clear PACK
await FlutterNfcKit.transceive(
Uint8List.fromList([0xA2, 0x29, 0xFF, 0x00, 0x00, 0x00])); // Modify AUTH0

setStatus('Password protection reset successfully');
await FlutterNfcKit.finish();
setScanning(false);
return true;
} catch (e) {
setStatus('Error: $e');
await FlutterNfcKit.finish();
setScanning(false);
return false;
}
}


What I’ve Tried:

  1. Setting the AUTH0 page value to:

    • 0xFF: Makes the card permanently unusable.
    • 0x0F: Same issue as above, card becomes dead.
    • 0x00: Does not successfully remove the password protection.
  2. Confirming that the card is indeed NTAG213 using a capability container check.

  3. Writing and verifying the password during the protection setup process works as expected.


Questions:

  1. What is the correct value for AUTH0 to properly disable password protection on NTAG213 cards without rendering them unusable?
  2. Are there any additional steps or specific commands needed to safely remove password protection for NTAG213 cards?
  3. Could this issue be related to the card's configuration or a missing step in the removal process?

Any insights or guidance on resolving this issue would be greatly appreciated!

0 Kudos
Reply
3 Replies

784 Views
kamal511
Contributor I

Hi @Fabian_R ,

Thank you for your detailed response and for sharing insights. Your explanation was really helpful, and I truly appreciate the effort you put into guiding me.

A big apology for my very late reply—I genuinely appreciate your patience. Kudos to you for the great support!

Thanks again for your time and assistance!

Best regards,
Kamal

0 Kudos
Reply

364 Views
AshrafxLevi
Contributor I
Hello Kamal, could you please send your email or WhatsApp number I want to inquire about some things if it is possible
0 Kudos
Reply

1,045 Views
Fabian_R
NXP TechSupport
NXP TechSupport

Hello, Thank you for your interest in our products.

AUTH0 is intended to be used for defining the starting page address of the protected area in Sector 0. Please take a look at the Memory Organization of the NTAG I2C. The starting address for AUTH0 is shown in the following image:

Fabian_R_0-1732564873752.png

 

This is from section 8.3.1 Memory map from NFC perspective. Please keep in mind that the value cant exceed 0xE0. 0xFF will result in an error that could lock the NTAG.

Unfortunately, the use of Flutter is out of my scope but, please take a look at RFIDDiscover for configuring the NTAGs using a GUI. The output log of this action will help you for implementing it to your Flutter application.

Best Regards,
Fabian
0 Kudos
Reply