NXP NFC Reader Library - Authentication with two/three possible A keys?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NXP NFC Reader Library - Authentication with two/three possible A keys?

971 Views
bwinter
Contributor II

With our new reader we are trying to update a sector in a Mifare Classic card.

Problem: We have old mifare cards in which we want to write additional data.

However there are 3 possible keys that have access to Sector 1.
- The old Mifare classic "A0 A1 A2 A3 A4 A5" key
- The new Mifare classic "FF FF FF FF FF FF" key
- Our empty key "01 23 45 67 89 AB" key.

We are now using the NXP NFC Reader Library (in the past a custom library)
Doing a discovery works perfect.
Doing a "phalMfc_Authenticate" with the first key (A0..A5) which is right works and data can be read and written.

However when the first "phalMfc_Authenticate" (A0..A5) fails and trying to continue with "phalMfc_Authenticate"  (FF..FF) the card always fails as if the key was wrong. But if i start with the second key (FF..FF) it is accepted.

Looking at the datasheet of the MF1S50 (Mifare classic)  i don't see the flow to follow with a failure on an Authenticate.

Looking through the NXP NFC Reader Library i don't see the method how to recover from a Authenticate failure.

Do note: i a trying to do this with the NFC reader library without turning off the field and re-doing the anticollision loop. (The Card number is known and sector 0 already has been validated by the program)

 

 

Labels (1)
0 Kudos
2 Replies

940 Views
bwinter
Contributor II

The datasheets of all Classic variants have never been very clear in which state the card is.
If i take for example the MIFARE Classic EV1 1K (MF1S50YYX_V1) datasheet Figure 4 after the "Select Card" block we can move to the "authentication" block but no path is given when authentication fails (and in which state the card ends).

As wrote above we are working with our new hardware and new firmware using the latest NXP NFC Reader Library (and not an ancient version).
Digging into our old firmware (with compiled library) pointed to ReAuthent which seems to reselect the card without doing the complete  anticollision loop which of course save some time (reading and validating card type and other data blocks already succeeded)

I think i will have to search for the easiest way to do this for the same card with de NXP NFC Reader Library routines.

0 Kudos

946 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @bwinter ,

 

In case of authentication failure, the tag/card is back to IDLE state, you need not reset the RF field, just follow the Identification and Selection Procedure as described in Figure 4. MIFARE Classic command flow diagram from the data sheet before issuing authentication command again.

 

Hope that makes sense,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos