I am developing an Android app and I need some help to figure out how to set password protection to a NTAG216 and how to authenticate using the same password. The goal that I have to reach is to enable only specific users to write and read a NTAG21G. I don't want to make it only readable or something similar. The documentation and the example provided with the Mifare SDK did not help me, in addition I have made unusable some tags.
Mariusz,
first you need to program the password with programPWDPack method: your_object.programPWDPack(byte[] pwd, byte[] pack)
pwd = 4 bytes of password, pack = you could send {0x00, 0x00} to make it simple
Second you have to set which parts are protected with enablePasswordProtection method: your_object.enablePasswordProtection(false, objnTag210.getFirstUserpage())
Instead of getting the first user page you could also send parameter value = 2 to also password protect lock bits and capability container at memory Page02 and Page03 so no one could mess with those. Otherwise getFirstUserpage() will return 4.
Your tag is now password protected.
You then do the authentication with: your_object.authenticatePwd(byte[] pwd, byte[] pack)
Pwd is the user input, for pack you have to send {0x00, 0x00} again.