Mifare 1K TAG Read and Write using KEYB

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

Mifare 1K TAG Read and Write using KEYB

2,826 Views
selvaraj1
Contributor I

Hi ,

Here using PN512 Reader for our Project.And Using Mifare 1K Tag.

For KeyA Based Authentication ,Read and Write Operation which getting success.

For KeyB only getting Authentication Success.Read and Write Operation getting Fail.

This will be on Default Access Bit- FF078069 and Both Keys are <FF FF FF FF FF FF>.

Same type of some NXP 1K Cards Getting Success on KEYB Read and Write.

 For Success and Fail Status Response Below from PN512.

Success:

Authentication of block 08 successful, continue operation.
Mifare Read: Block=08, Data:
30313100000000000000000000000000
Fail.
Authentication of block 08 successful, continue operation.
*** ERROR! MifareRead: Block=08, Status = 091b
Here 091b- refers to NACK detected.(negative acknowledgement)

Please give the Solution for this Issue.

Thanks

Labels (1)
  • RF

0 Kudos
4 Replies

2,282 Views
selvaraj1
Contributor I

Dear Jonathan,

we make the correction in the Library. and it's working on KEYB.

Thanks
Selva

0 Kudos

2,282 Views
Jonathan_Iglesias
NXP TechSupport
NXP TechSupport

Dear SELVARAJ KARUPPASAMY,

I see the internal case you posted once you determine it has been solved,  I will post here the answer.

BR

Jonathan

0 Kudos

2,282 Views
selvaraj1
Contributor I

Dear Jonathan,

   In PN512 Reader -Once change the KEY Block Access bit From -FF078069-   to 7F078869. then we can Read and write the Data Block Using KEY B. our issue will be solved By changing the Key Access Bit conditions.

  

Our New Product Development Using CLRC66303 reader chip.

For KeyA Login Authendication, Read and Write getting Success. 

Here Facing KEYB Authentication Fail.Does Not Login Using KeyB for this Access Bit Conditions (7F078869).

Here using OM26630FDK -Development Kit. Any Script File toTest the Authenticate, Read and Write using KeyB for Classic 1K/4Kcards.

Thanks

0 Kudos

2,282 Views
Jonathan_Iglesias
NXP TechSupport
NXP TechSupport

Hope you are doing great,

there was a mistake in the library, this will be fixed in the next release. The issue is following.

By using Key-B the pointer of ‘pKey’ is set to start at index ‘6’ of 'aKey’
pastedImage_1.png

Instead of all 0xFF the last 4 bytes are different. This causes the authentication to fail.

pastedImage_2.png

Conclusion: Initialization of the key is wrong/not done.

The keys are set by following function: pastedImage_3.png

If we further look into this function we will see that the size of the key is retrieved by ‘phKeyStore_GetKeySize(wKeyType)’
pastedImage_4.png
pastedImage_5.png

So we will copy 12 bytes, of course!, for Key-A and Key-B. But if we look at the key we pass:pastedImage_6.png it is only 6 byte long!!! The rest will be whatever is written after that. Actually we have here a perfect example of a boundary violation! By changing it to actual 12 bytes everything works as expected!! pastedImage_7.png

BR

Jonathan

0 Kudos