Detect Protect Tag

Asked by Rafael on 2016-09-23

Sorry to bother with the same subject, but as you can detect whether a tag has a password or not?

Question information

Language:
English Edit question
Status:
Solved
For:
nfcpy Edit question
Assignee:
No assignee Edit question
Solved by:
Stephen Tiedemann
Solved:
2016-10-27
Last query:
2016-10-27
Last reply:
2016-09-23

To clarify, this is about NTAG21x.

An NTAG21x always has a password, so there is no point in detecting it. The password after manufacturing is well-known so that it can be changed by the owner. Password protection of user memory starts from a specific page number that is written into a configuration register. Initially that page number is 255, far beyond the user memory. Protecting means to set this start page number to a value within user memory. The tag.protect() method's start_from argument allows user code to specify the begin of the protected memory range.

The location of the configuration registers depends on the tag memory size, i.e. different for each product. If you look at the implementation of tag._protect_with_password at https://github.com/nfcpy/nfcpy/blob/master/nfc/tag/tt2_nxp.py#L390 you'll find how to read the configuration data (L398) and where the relevant information is (L404).

Rafael (hibara94) said : #2

Thanks Stephen Tiedemann, that solved my question.