Topic: Formatting Desfire as Tag 4

Hello, I'm trying to format a DESFIRE EV1 using the libfreefare functions.  I followed the instructions int he tutorial and the NXP document, yet Android cannot recognize the tag. I do all the steps, from creating the standard ISO DF file (07 d2 76 00 00 85 01 01), the E103 and E104 to changing the key settings to 0x09. 

The problem in the example is that we authenticate with the master key (null =00 00 00 00 ... ), and create all this stuff, yet unless i authenticate again, i can't read the ndef data.

Android does not authenticate when reading Tag 4, it just sends a select command on 07 d2 76 00 00 85 01 01 or 07 d2 76 00 00 85 01 00, and tries to select E103, without authentication.  Even when i set the file permissions to 0xEEEE i still can't select them without authenticating.

My question is, how can i make the 0xE103 and 0xE104 be selectable without authentication so Android can read the tags. I have some non-desfire tags, which support ISO files, and those work fine with Android as you don't have to authenticate to read/write data.

Re: Formatting Desfire as Tag 4

Hello,

In libfreefare project, there is a example to format DESFire cards as NDEF tags, I think you should use it smile

Romuald Conty

3 (edited by sullenx 2012-06-29 01:44:06)

Re: Formatting Desfire as Tag 4

Thanks for the response.  I have studied the examples and they are pretty straight forward, which is great.  When I use the create_ndef example, I have no problems creating the tag.  I can read it using the read_ndef example as well.  Unfortunatelly, Android does not recognize the tag, it just shows it as unformatted.
Looking in the adb, i see it tries to select the E103 file without authentication, I can confirm it using scriptor:

00 a4 04 00 07 d2 76 00 00 85 01 01
6a 82 file not found

00 a4 04 00 07 d2 76 00 00 85 01 00
90 00 - weird since this df was not created , also when the format picc command, this file is still selectable

00 a4 00 0c 02 e1 03
6a 82 file not found. Then it gives up

Now with the Libfreefare functions I can verify that the file is there but I have to authenticate, android does not authenticate to while trying to read ndef.  How can I make the tags compative to Android?

Re: Formatting Desfire as Tag 4

I figured it out!... The formatting is very misleading!...it sets the key settings to 0x09!, which locks it up and requires authentication. Setting the key to 0x0f !

Master Key settings (0x0f):
    0x08 configuration changeable;
    0x04 PICC Master Key not required for create / delete;
    0x02 Free directory list access without PICC Master Key;
    0x01 Allow changing the Master Key;
Master Key version: 0 (0x00)

Now android can recognize the tag and read/write to it freely. Obviously, I'll start playing around with the keys to achieve a more secure setting, but this is a good start!

Re: Formatting Desfire as Tag 4

Which version of libfreefare did you try?
With latest SVN, formatting of an EV1 is using NDEF mapping v2 and leaves key settings at 0xF.
Formatting of lod Desfire is using NDEF mapping v1 and key settings = 0x9

Phil