Forum / MIFARE SmartCard IC`s / MIFARE DESFire / Change app key
Tagged: mifare desfire ev1 AES key
-
Hello,
I am trying to change an app key over a Mifare Desfire EV1 card.
So, I am authenticated using my Masterkey, then I have created an application (11 11 11) for test :
>>> cmd = 90 CA 00 00 05 11 11 11 E9 8E 00
<<< data = A5 7D B8 9C 77 A2 17 37
<<< sw = 91 00
My first question is, what is the default key for this application ? is it the Master key ?
Then I am trying to change the app key :
Let's suppose that the current app key is :
k_old = "22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22" (AES Key)
and the new key is :
k_new = "33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33"
Now I have to execute the C4 command with some cipher data as input. To calculate the cipher data I did those operations, but I am not sure about it :
data = k_new XOR k_old
c1 = crc32(data)
c2 = crc32(k_new)
then :
cipher = AES-128-CBC (Session_key, data + c1 + c2 + padding, iv=0)
then the final commande is :
90 C4 00 00 21 80 cipher
Is that correct ?
And I also have a question about how crc32 is calculated I found several algorithms on the internet, and there is no way to check if mine is correct.
Thank you :)
+ 0 | - 0
-
AuthorPosts
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.