Developing Android App in .net Maui. Having issues with NFCAdapter, specifically passing a specific sector key with AuthenticateSectorWithKeyA.
We print and encode our own Mifare 1K cards. Print software allows us to change the sector key A. I have tried multiple, and all ok, but need a specific key to work which is failing authentication.
No problem passing the following Keys and authenticating the sector with AuthenticateSectorWithKeyA.
byte[] keybytes = new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff };
OR
byte[] keybytes = new byte[] { (byte)0xAB, (byte)0xCD, (byte)0xEF, (byte)0x12, (byte)0x34, (byte)0x56 };
var auth = tag.AuthenticateSectorWithKeyA(0, keybytes);
All ok, var auth = true
But when I try the following Key it fails to authenticate. var auth = false.
byte[] keybytes = new byte[] { (byte)0x19, (byte)0x23, (byte)0x86, (byte)0x18, (byte)0x05, (byte)0x00 };
HEXString is 192386180500
Only thing I can see if the last two bytes have a zero prefix
SO
Tried:
byte[] keybytes = new byte[] { (byte)0xAB, (byte)0xCD, (byte)0xEF, (byte)0x12, (byte)0x34, (byte)0x56 };
Result: OK - var auth = True
Tried:
byte[] keybytes = new byte[] { (byte)0x19, (byte)0x23, (byte)0x86, (byte)0x18, (byte)0x05, (byte)0x00 };
Result: Fail - var auth = false
Use this key with non android RFID readers and all is ok. Need to use this key as we have produced thousands of RFID cards with this key A for sector 0.
Bit new to Hex and byte arrays, any help welcome.
Top comments (0)