I have an ACR122U reader and several NTAG215 cards,and then I use C#、PCSC sharp to develop it. I want to set a password and authenticate it,I think the default key is "00 00 00 00" or "FF FF FF FF",and PACK is "00 00". So I changed the AUTH0 from FFh to 40h, so Page 64 ~ 132 should be password protected. Then I want to authenticate page 64 and write something into it, but I have problem with authenticate this step.
The following is my code
using (var ctx = ContextFactory.Instance.Establish(SCardScope.System))
{
using (var isoReader = new IsoReader(ctx, connReader, SCardShareMode.Shared, SCardProtocol.Any, false))
{
string defaultKey = "FF FF FF FF";
string[] key = defaultKey.Split(" ");
byte[] load_keys = new byte[4];
int count = 0;
for (int i = key.Length - 1; i >= 0; i--)
{
load_keys[count] = Convert.ToByte(key[i], 16);
count++;
}
//0x1B, load_keys[0], load_keys[1], load_keys[2], load_keys[3]
byte[] auth = { 0xD4, 0x42, 0x1B, load_keys[0], load_keys[1], load_keys[2], load_keys[3] };
var read = new CommandApdu(IsoCase.Case4Short, isoReader.ActiveProtocol)
{
CLA = 0xFF,
INS = 0x00,
P1 = 0x00,
P2 = 0x00,
Le = 0x07,
Data = auth
};
var rsp_read = isoReader.Transmit(read);
txtLog.Text += $"Authenticate Response ( SW1 : {Convert.ToString(rsp_read.SW1, 16).PadLeft(2, '0').ToUpper()} , SW2 : {Convert.ToString(rsp_read.SW2, 16).PadLeft(2, '0').ToUpper()} )" + br;
var data_read = rsp_read.GetData();
for (int i = 0; i < data_read.Length; i++)
{
txtAuth.Text += Convert.ToString(data_read[i], 16).PadLeft(2, '0').ToUpper() + " ";
}
}
}
The response I got is [ SW1 : 90 , SW2 : 00 ] and [ D5 43 01 ] I thought I should get a response with PACK, but status code is 01. I don't know which part is wrong, please help me, thanks!
I have read the following articles, but still can't get the answer.