Reply To: KeyA and KeyB and how to protect the contacless card from cloning?

Forum MIFARE general topics and applications KeyA and KeyB and how to protect the contacless card from cloning? Reply To: KeyA and KeyB and how to protect the contacless card from cloning?

Re: KeyA and KeyB and how to protect the contacless card from cloning?

15. February 2016 at 10:45
Kind Thanks,

I read a lot about Mifare card. The driver interface that I have don’t explain very much. Even in demo code there isn’t any comment to make any sense.
In my app;

1) I can connect to the card
2) Load the Key (“FFFFFFFFFFFF” to save in terminal IC register somehow)
3) Authenticate
4) Read the block
5) Write to the block


I am having difficulty to understand the access bit rules. My understanding is this;
There are 2 access bit rules. 1 for the Data Block access bits and the other for Sector trailer access bit rules. Am I right?

I have a data that shown below.

My_Data1 = “2153”;
My_Data2 = “es56fg87p4f2”;
My_Data3 = “5852337644220001”;
My current default KeyA = “FFFFFFFFFFFF”
My current default KeyB = “FFFFFFFFFFFF”


If I use KeyA I can read and write my data into the Sector 1, Block 0, Block 1 and Block 2.
My main problem is I don’t know the access bits for data block or the sector trailer block.

First of all with my app I want to change all the KEY A, KEY B and the access bits. I need to use Key A for writing data into the card and I want to use Key B to read the data from card. Is it possible?

If so;
Example:
My new KeyA will be = “1665FE2AE945”
My new KeyB will be = “3321FB75A356”

1) How to change my Key A and Key B?
2) Do I need to change the sector trailer access bit?
3) How do I set new sector trailers bit?
4) How do I set new data block access bits for KEY_A for writing and KEY_B is for reading?
I know I have to use new sector trailer as;
" | access bits | general purpose byte | "

But is possible for you to give me an example regarding to use my above data, current key and new key?
So I can get in my brain. I am very confuse because of reading a lot and not having good documentation of API for my terminal.

Kind Regards,
+ 0  |  - 0