mxgxw / MFRC522-python

A small class to interface with the NFC reader Module MFRC522
GNU Lesser General Public License v3.0
521 stars 419 forks source link

Iterative Authentication Failing #16

Open rshugrue opened 9 years ago

rshugrue commented 9 years ago

Scenario:

I want to dump all of the data like the DumpClassic1k funtion except one of my sections of sectors has a different auth key. (Sector 11 has a non-factory auth key, so Sectors 8-10 don't authenticate).

So, I kick off that function expecting Sectors 8-11 to fail auth. But, ALL sectors after 8 fail. 12, 13, ... 63.

The issue (after making my own versions of that function and working through it) is that the auth function doesn't reset after a failure. So, any future calls fail too regardless of the auth key. Now, if you create a whole new instance (ie. Rerun your script) of the MFRC522, then it works again (well, until you get a single failure.) I've output the status value and it seems that the status is never reset. Status is "0" until a failed auth. Then it is "2" and all subsequent auth calls have status "2" regardless if they SHOULD succeed or not. If I remove the "failed" sector in my iteration and run only against sectors that pass auth, then all status's are "0" (even the ones that showed a "2" in the previous scenario where they ran after a failure.)

Any help is appreciated. This utility is awesome and I really like its functionality. Just need this flaw fixed. Thanks.