Forum / MIFARE SmartCard IC`s / MIFARE DESFire / Mifare Desfire EV1 ChangeKey 0x1E error
-
Hi all,
I'm new with desfire. I can authenticate me without any problem. But, I have a 0x1E error with ChangeKey command (and the same error with change key settings command).
Here is what I do in detail :
MASTER KEY = 00 00 00 00 00 00 00 00
INIT VECTOR = 00 00 00 00 00 00 00 00
Authenticate : (with key number 0x00)
--> 90 0A 00 00 01 00 00
90 AF 00 00 10 5B D8 9F 65 31 76 AE 3A 7A 11 28 C9 D4 03 51 29 00
90 54 00 00 08 C5 E6 52 C9 D6 D0 F4 39 00
<-- 91 1E
I think the problem is my CRC or my session key but I don't known what is wrong in my procedure.
In addition, here is my crc calulation code (in C#) :
public static byte[] ComputeCrc16(byte[] data, int len)
{
ushort polynomial = 0x8408;
ushort preset = 0xFFFF;
int i, j;
int current_crc_value = preset;
for (i = 0; i < len; i++)
{
current_crc_value = current_crc_value ^ data;
for (j = 0; j > 1) ^ polynomial;
}
else
{
current_crc_value = (current_crc_value >> 1);
}
}
}
data = (byte)(current_crc_value & 0x00ff);
data = (byte)((current_crc_value >> 8) & 0x00ff);
return data;
}
+ 0 | - 0
Hi all,
I'm new with desfire. I can authenticate me without any problem. But, I have a 0x1E error with ChangeKey command (and the same error with change key settings command).
Here is what I do in detail :
MASTER KEY = 00 00 00 00 00 00 00 00
INIT VECTOR = 00 00 00 00 00 00 00 00
Authenticate : (with key number 0x00)
command: 90 0A 00 00 01 00 00
response: 91 AF 57 B0 C3 5A 08 0A E6 08
RndB = D6 F7 79 68 D2 76 7E A3
RndB' = F7 79 68 D2 76 7E A3 D6
Generated RndA = B0 A6 40 5F 57 79 4A 93
After cipher operations :
command: 90 AF 00 00 10 5B D8 9F 65 31 76 AE 3A 7A 11 28 C9 D4 03 51 29 00
response 90 00 B5 3B F4 99 FE AC 13 E4
After cipher operations :
Received datas = A6 40 5F 57 79 4A 93 B0
Session key : B0 A6 40 5F D6 F7 79 68
AUTHENTICATION OK!
After this I try to send the change key settings command (for example) :
New setting value : 0F
CRC = 70 F7
After cipher operations :
command: 90 54 00 00 08 C5 E6 52 C9 D6 D0 F4 39 00
response: 91 1E
I think the problem is my CRC or my session key but I don't known what is wrong in my procedure.
In addition, here is my crc calulation code (in C#) :
public static byte[] ComputeCrc16(byte[] data, int len)
{
ushort polynomial = 0x8408;
ushort preset = 0xFFFF;
int i, j;
int current_crc_value = preset;
for (i = 0; i < len; i++)
{
current_crc_value = current_crc_value ^ data;
for (j = 0; j > 1) ^ polynomial;
}
else
{
current_crc_value = (current_crc_value >> 1);
}
}
}
data = (byte)(current_crc_value & 0x00ff);
data = (byte)((current_crc_value >> 8) & 0x00ff);
return data;
}
+ 0 | - 0
Hi,
This problem is solved. The error is in my CRC algorithm. The preset value must be 0x6363.
+ 1 | - 0
Hello Samuel,
I have a similiar issue. I am trying to write data to a MIFARE DESFire EV1 card. Unfortunately i receive the error code 1E - which means invalid CRC. I saw your code snippet, and i would like to compare it with my implementation. Unfortunately it seems your snippet is incomplete (2nd for loop?). Would you mind reposting a complete code snippet?
thanks in advance,
Regards,
Michael
+ 0 | - 0
Hi,
Do you Solve this Problem? I have the same problem now.
can you show the CRC calulation code ?
Thanks for help.
+ 0 | - 0
Hi,
Im tryng to change the key of picc level for DES to AES but I cant the card alwasy response me with 0x1E. Can you give me more information about the secuencial steps to follow in this case.
writing my log below.
Forgive but I have been wrong with some dates, so I rewrite a new log:
Current DES key: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00.
New AES key: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00.
Session key: 0x00, 0x00, 0x00, 0x00, 0x74, 0x92, 0xaf, 0xb0.
CRC16 :0x1B, 0x5B.
the CRC16 is calculated over: 0xC4, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01.
finally (before encrypted to send): 0xC4, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1B, 0x5B, 0x00, 0x00, 0x00, 0x00, 0x00.
finally (encrypted to send): 0xC4, 0x80, 0x39, 0x2A, 0xE1, 0xF2, 0x27, 0xB9, 0xD8, 0xA8, 0x58, 0x24, 0x79, 0x63, 0x49, 0x66, 0xB4, 0x1B, 0x1B, 0x1F, 0x1E, 0x64, 0xEB, 0x8F, 0x7F, 0xB6.
thanks and regards.
+ 0 | - 0
-
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.