From 0268a9f975aa8145751a94588fa4e7f6e4742ece Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 15 May 2012 21:22:16 +0000 Subject: [PATCH] examples/mifare-desfire-format also resets key settings --- examples/mifare-desfire-format.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/mifare-desfire-format.c b/examples/mifare-desfire-format.c index 90827b3..5bb4388 100644 --- a/examples/mifare-desfire-format.c +++ b/examples/mifare-desfire-format.c @@ -141,6 +141,15 @@ main(int argc, char *argv[]) } mifare_desfire_key_free (key_picc); + // Send Mifare DESFire ChangeKeySetting to change the PICC master key settings into : + // bit7-bit4 equal to 0000b + // bit3 equal to 1b, the configuration of the PICC master key MAY be changeable or frozen + // bit2 equal to 1b, CreateApplication and DeleteApplication commands are allowed without PICC master key authentication + // bit1 equal to 1b, GetApplicationIDs, and GetKeySettings are allowed without PICC master key authentication + // bit0 equal to 1b, PICC masterkey MAY be frozen or changeable + res = mifare_desfire_change_key_settings (tags[i],0x0F); + if (res < 0) + errx (EXIT_FAILURE, "ChangeKeySettings failed"); res = mifare_desfire_format_picc (tags[i]); if (res < 0) { warn ("Can't format PICC.");