0

I'm using react-native-nfc-manager package for reading and writing NFC card from my app, i want to write my card from my app no other app can change data. I have gone through multiple apps from playstore one of which is NFC tools in that there is feature of password protect, and that feature i didn't able to get in react-native-nfc-manager. Can anyone please let me know, how should i apply password protect NFC feature in react native or any other way without making card readonly

  • 1
    Password protection is very dependant on the exact make and model of the NFC card, so without you tell us the make and model of the NFC card you are using it is hard to answer your question. – Andrew Jul 19 '21 at 08:25
  • Thanks for replying, I'm using NXP NTAG215 chip by LINQS, memory size of 496 bytes, Its re-writable card, please let me know any other details i can provide. – Mitesh Kambli Jul 19 '21 at 10:28

1 Answers1

0

The exact details of how to password protect writing this card are at https://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf Section 8.8

A summary is below:-

  1. Write the password to the correct memory address for the NTag215 (page 85h for the 215 chip)

  2. Write the Pack to the correct memory address (first 2 bytes of page 86h)

  3. Write to the AUTH0 memory area to set the first page to be protected by the password, usually you protect from page zero 00h (Last byte of page 83h)

To write to a password protected Card you first need to send the PWD_AUTH command before and other commands to write.

So configuring and using password protection on these NFC cards requires you to send (Transceive) low level commands to the card, these cards are NfcA based so react-native-nfc-manager has an NfcAHandler to transceive to them.

In react-native-nfc-manager Demo App is shows how to transceive custom commands.

The write page custom command begins with A2h.

The password auth custom command begins with 1Bh

I've not tried this with react-native but it should all be possible by combining the low level NfcA methods of react-native-nfc-manager with the detail in the cards datasheet on how to password protect that card.

Andrew
  • 8,198
  • 2
  • 15
  • 35
  • Thank you very much for your reply @Andrew, i have tried using tranceive custom commands to write for example : A2 00 01 02 03 04 from demo App, then card got protected, but now i don't understand how to unlock/ remove password from card. can you please help me. – Mitesh Kambli Jul 20 '21 at 04:13
  • If you have successfully set a write password on the Tag then before you can send it other write commands in the same session you need to send it the `PWD_AUTH` (`1Bh`) command with a payload of the password. Once authenticated for the session while the card is in range you can read and write freely, including writing to the config pages to turn off the password protection (reset the values to the defaults) – Andrew Jul 20 '21 at 08:38
  • Thanks @Andrew, i have tried tranceive command for reseting the password like for eg: 1B 00 01 02 03 but it returns tranceive command failed. can you please help me what i'm doing wrong. like i have write NFC tag using A2h can you please provide an example of transceive command to remove password protect from NFC Tag 215 – Mitesh Kambli Jul 21 '21 at 05:27