Jump to content
43oh

Mifare classic tag - not sure how to tell the read is successful


Recommended Posts

Hi All,

I am trying to study again on a Mifare reader, that i used to play with using this library on Arduino:

https://github.com/marcboon/RFIDuino/tree/master/SL018">https://github.com/marcboon/RFIDuino/tree/master/SL018

When a tag is sensed, the demo program from the link above is displaying information like this:



 

 

### CMD_LOGIN - read@@Block 0C: 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 ................@@Block 0D: 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 ................@@Block 0E: 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 ................@@Block 0F: 00 00 00 00 00 00 FF 07 80 69 FF FF FF 
FF FF FF .........i......

 




I used to believe the data are actually from the tag, but as i read more about the standard from the Internet, I became aware that Mifare provides sector encryption. So, I'm not sure the demo code will still give some data (garbage, zeros, or something else) on sectors that are encrypted, or the code will display error message instead.

If anyone have used this library and can kindly teach me on this? I have studied the demo code and found that it is using a read login code that passes a "transport key" of 0xFF as in the void SL018::authenticate(byte sector) method :



 

 

void SL018::authenticate(byte sector){
data[0] = 9;
data[1] = CMD_LOGIN;
data[2] = sector;
data[3] = 0xAA;
memset(data + 4, 0xFF, 6);
transmitData();
}

 


There is another method that accept a "decryption key" but it is not used in the demo code:



 

 

void SL018::authenticate(byte sector, byte keyType, byte key[6]){
data[0] = 9;
data[1] = CMD_LOGIN;
data[2] = sector;
data[3] = keyType;
memcpy(data + 4, key, 6);
transmitData();
}

 





The demo code called the authenticate method with the standard "FF" (only one argument, the sector) on every write:




 

 

...else{
authenticated = false;
rfid.authenticate(block >> 2);
}

 




Any hints will be much appreciated. Thanks in advance.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...