nfc-tools / libfreefare

A convenience API for NFC cards manipulations on top of libnfc.
Other
402 stars 105 forks source link

Unknown key version - card locked after desfire test #115

Open alenloncaric opened 5 years ago

alenloncaric commented 5 years ago

Dear,

we have been running DESFIRE test from tests, testing all the commmands and somewhere we created some error on the card.

Now the key version returns C0, which is unknown. 2 Cards are having same issue (EV1)

*** mifare_desfire_get_key_version ***
===> 0000   90 64 00 00 01 00 00                             |.d.....         |
<=== 0000   c0 91 00   

What is C0? and how to overcome it ?

With kind regards,

darconeous commented 4 years ago

I'm guessing the PICC didn't have a good connection to the PCD during the test and that it didn't get formatted back to normal afterward.

I'm guessing the key in question is the master PICC key?

Casually looking over the sources for the tests, it isn't immediately clear to me how any key could be set with a version of 0xC0.

There should be a limited number of possibilities for what the actual key is. You may be able to try resetting the card using the new mifare-desfire-ev1-change-picc-key tool being introduced via #119. Something like this:

mifare-desfire-ev1-change-picc-key -k DES:0000000000000000
mifare-desfire-ev1-change-picc-key -k DES:4142434445464748
mifare-desfire-ev1-change-picc-key -k DES:43617264204d6173746572204b657921
mifare-desfire-ev1-change-picc-key -k DES:000000000000000000000000000000000000000000000000
mifare-desfire-ev1-change-picc-key -k AES:00000000000000000000000000000000

Hopefully one of those commands gets you unstuck.