Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@therealri Im trying to authenticated a card but any solutions its working for me in all the code that i have trying return code: operation_failed #109

Open
saulmonci opened this issue Jan 7, 2021 · 0 comments

Comments

@saulmonci
Copy link

@therealri I think that the problem is here:

I am looking into the technical documentation of Mifare Classic 1K.

Section 8.6 is about Memory organization.

... memory is organized in 16 sectors of 4 blocks. One block
contains 16 bytes.

When accessing these blocks with this library, blocks are numbered as follows:

  • sector 0:
    • block 0 – manufacturer data (read only)
    • block 1 – data block
    • block 2 – data block
    • block 3 – sector trailer
  • sector 1:
    • block 4 – data block
    • block 5 – data block
    • block 6 – data block
    • block 7 – sector trailer
  • sector 2:
    • block 8 – data block
    • block 9 – data block
    • block 10 – data block
    • block 11 – sector trailer
  • and so on

That's important, it's that the last block in each sector is "sector trailer" (see Section 8.6.3), which contains access conditions for the other 3 data blocks.

So block 7, which you are trying to write to in your code, is not for data. After you write to it, it changes access conditions (including key) and you cannot authenticate your card then.

I don't have any Mifare Classic card to test it, but according to documentation it is quite clear.

Could you please update your code (remove interaction with block 7, see updated gist here) and test it with a NEW BLANK card if it works?

Hope it helps and looking forward to your answer.

PS Don't forget to star ⭐️ my library, if you find it useful. 😃 Thanks.

Originally posted by @pokusew in #16 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant