<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[libnfc developers community - NXP MIFARE DESFire]]></title>
		<link>http://www.libnfc.org/community/</link>
		<description><![CDATA[The most recent topics at libnfc developers community.]]></description>
		<lastBuildDate>Wed, 16 Nov 2011 08:11:39 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Problem changing key]]></title>
			<link>http://www.libnfc.org/community/topic/264/problem-changing-key/new/posts/</link>
			<description><![CDATA[<p>Hi,</p><p>I am trying to change the keyno1 of my application but I am having some problems.<br />The keySettings are defined to 0f 02. I am able to authenticate to key0 and get the session key.</p><p>The old key is 00..00 since I have not changed it. And the new key I want to set is 0x00112233445566778899AABBCCDDEEFF. When I send the command to the PICC always returns a 911E (apparently it doesn´t like the CRC or the padding).</p><p>Assuming that my key is 00.00 the XOR does not affect the key, so the first parameter I guess should be the new key itself. Then I calculate the CRC and I get 69CC (Is that correct???), so I have to append it twice (once for the XORed key and once for the new key), and then I append 4 0x00s as padding.</p><p>Here are the values I am receiving right now:</p><p>Session Key: D8 15 60 CE 33 55 7D BC 3E F4 34 EA 1D FF F9 28<br />Old Key: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00<br />New Key: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF</p><p>Key Data: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF 69 CC 69 CC 00 00 00 00<br />Transmitted data: 71 66 0B 4C C6 EB A6 F9 D6 36 86 2F 6A ED 33 E5 D9 84 50 B0 04 6B A9 85</p><p>Can anyone complete the key changing using this values and pass mw the values I should receive in all the steps?? I must be doing something bad bat I have read the documentation and I don´t know where.</p><br /><p>Thanks, Gorka</p>]]></description>
			<author><![CDATA[dummy@example.com (liuxingyu20057)]]></author>
			<pubDate>Wed, 16 Nov 2011 08:11:39 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/264/problem-changing-key/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[[Call for Testers] Announcing Mifare DESFire support in libfreefare!]]></title>
			<link>http://www.libnfc.org/community/topic/199/call-for-testers-announcing-mifare-desfire-support-in-libfreefare/new/posts/</link>
			<description><![CDATA[<p>Good news everyone! The Mifare DESFire support in libfreefare [1] is complete! While some polishing is still required before merging the -desfire branch into libfreefare&#039;s trunk and releasing the updated code, I am confident enough in the implementation to do a call for testers!</p><p><strong>How to test?</strong></p><p>If you would like to give libfreefare&#039;s Mifare DESFire support a try:<br /></p><div class="codebox"><pre><code>svn co https://nfc-tools.googlecode.com/svn/branches/libfreefare-desfire
cd libfreefare-desfire
autoreconf -is
./configure --prefix=&quot;/usr&quot;
make
make install</code></pre></div><p>Then you can read the <em>mifare_desfire(3)</em> man page, and have a look to the examples and the unit test suite to get started.</p><p><strong>What to test ?</strong></p><p>Well, actually I only ported a regression test suite (supposed to be inspired by some code from NXP) to cutter [2] to check my implementation, and since I only own a single Mifare DESFire 4K card, I only have tested with it.</p><p>I would be interested in feedback about building the software on other platforms (I run FreeBSD-8 amd64), running the regression test suite, using Mifare DESFire 2K / 8K, your experiments results, etc…</p><p>I have to mention that I had some trouble when using a <em>Snapper Feeder</em> and the problem has been reported to Snapper, but the problem might be tied to this reader or at the chip the device uses since I could not reproduce it on a <em>touchatag</em> device, so if the communication with the tag stops unexpectedly at random locations, please try with another device and report the issue.</p><br /><p>Due credits:<br />This work was sponsored by IL4P [3] the Mifare DESFire tag was donated by SpringCard [4].</p><p><strong>Thank you for your feedback!</strong></p><p>Romain</p><p>References:<br />&nbsp; 1. <a href="http://code.google.com/p/nfc-tools/wiki/libfreefare">http://code.google.com/p/nfc-tools/wiki/libfreefare</a><br />&nbsp; 2. <a href="http://cutter.sourceforge.net/">http://cutter.sourceforge.net/</a><br />&nbsp; 3. <a href="http://www.il4p.fr/">http://www.il4p.fr/</a><br />&nbsp; 4. <a href="http://www.springcard.com/">http://www.springcard.com/</a></p>]]></description>
			<author><![CDATA[dummy@example.com (romain)]]></author>
			<pubDate>Wed, 24 Aug 2011 19:19:46 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/199/call-for-testers-announcing-mifare-desfire-support-in-libfreefare/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[DESFire Create Application command]]></title>
			<link>http://www.libnfc.org/community/topic/215/desfire-create-application-command/new/posts/</link>
			<description><![CDATA[<p>Hello folks</p><p>I&#039;m currently working on a DESFire implementation based on libnfc. <br />Currently I have a working implementation where I&#039;m able to authenticate, create and delete applications/files, etc...<br />Now I&#039;m working on security. I want different applications that use different keys to authenticate.<br />I have access to the documentation of NXP but it&#039;s still not clear how to do this.<br />Currently I create an application with the following raw APDU command:<br />0xca,0x0,0x0,cid,0x01,0x01 where &quot;cid&quot; is the application ID. I believe the next bit says that I use application key nimber 1? is that correct? And the one thereafter says that I want to use Native TDES mode? but I&#039;m unsure of that as well. Could somebody clarify the situation for me?</p>]]></description>
			<author><![CDATA[dummy@example.com (ctskin)]]></author>
			<pubDate>Tue, 31 May 2011 04:14:14 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/215/desfire-create-application-command/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[SmartMX]]></title>
			<link>http://www.libnfc.org/community/topic/388/smartmx/new/posts/</link>
			<description><![CDATA[<p>Hi there,</p><p>I was wondering if the MiFare SmartMx is similar to the Mifare DES. </p><p>Is there anyway to crack the keys on the MX? or sniff them out, this could work?</p>]]></description>
			<author><![CDATA[dummy@example.com (spookyman166)]]></author>
			<pubDate>Fri, 22 Apr 2011 05:53:35 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/388/smartmx/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[ISO7861-4 Extended APDUs (INTERNAL AUTHENTICATE) with DESFire EV 1]]></title>
			<link>http://www.libnfc.org/community/topic/357/iso78614-extended-apdus-internal-authenticate-with-desfire-ev-1/new/posts/</link>
			<description><![CDATA[<p>Hi @all.</p><p>I want to use a DESFire card to encrypt 16B data with an internal stored key.<br />(No mutual auth, only the Card should be authenticated)</p><p>IMHO the ISO7816-4 INTERNAL AUTHENTICATE command&nbsp; <a href="http://www.cardwerk.com/smartcards/smartcard_standard_ISO7816-4_6_basic_interindustry_commands.aspx#chap6_13">http://www.cardwerk.com/smartcards/smar &#133; x#chap6_13</a><br />can be used for that purpose.</p><p>As stated in <a href="http://ridrix.wordpress.com/2009/09/19/mifare-desfire-communication-example/">http://ridrix.wordpress.com/2009/09/19/ &#133; n-example/</a> <br />and <a href="http://www.nxp.com/acrobat_download2/expired_datasheets/MF3ICD8101_SDS_N_1.pdf">http://www.nxp.com/acrobat_download2/ex &#133; DS_N_1.pdf</a> (page 8)<br />the DESFire EV1 does support that command</p><p>I did not found that command used in the libnfc-source (I think you only use native and native-wrapped commands)<br />but it seems to be used in <a href="http://www.springcard.com/support/apidoc/pcsc_desfire/sprox_desfire_iso_c.html#robo114">http://www.springcard.com/support/apido &#133; ml#robo114</a></p><br /><p>I tried to dispatch some ISO7816-4 Commands to the PICC and got responses, but no success with INTERNAL AUTHENTICATE.</p><p>CMD-Bytes:</p><div class="codebox"><pre><code>                    byte[] internalAuth = new byte[]{ 
                            0x00,    //CLA    As defined in 5.4.1
                            (byte)0x88,    //INS    &#039;88&#039;  INTERNAL AUTHENTICATE
                            0x00,              //P1    Reference of the algorithm in the card
                            0x00,              //P2    Reference of the secret, see table 65
                            0x10,               //Lc    Length of the subsequent data field
                            
                            0x00,          //Payload, Authentication related data (e.g. challenge)
                            0x00,
                            0x00,
                            0x00,
                            0x00,
                            0x00,
                            0x00,
                            0x00,
                            0x00,          
                            0x00,
                            0x00,
                            0x00,
                            0x00,
                            0x00,
                            0x00,
                            0x00,
                            
                            0x10        //Le field     Maximum number of bytes expected in response 
                            
                    };</code></pre></div><p>Response<br /></p><div class="codebox"><pre><code>6d 00</code></pre></div><p>according to <a href="http://javacard.vetilles.com/2006/09/26/status-words-in-iso7816/">http://javacard.vetilles.com/2006/09/26 &#133; n-iso7816/</a><br />6d means &quot;The instruction code is not supported (usually with XX=00)&quot;</p><p>That is nothing I expected,&nbsp; <a href="http://www.cardwerk.com/smartcards/smartcard_standard_ISO7816-4_6_basic_interindustry_commands.aspx#chap6_13_5">http://www.cardwerk.com/smartcards/smar &#133; chap6_13_5</a> <br />lists the response codes for INTERNAL AUTHENTICATE as:</p><div class="codebox"><pre><code>The following specific error conditions may occur. 
SW1=&#039;69&#039; with SW2=&#039;84&#039;: Referenced data invalidated
                  &#039;85&#039;: Conditions of use not setisfied
SW1=&#039;6A&#039; with SW2=&#039;86&#039;: Incorrect parameters P1-P2
                  &#039;88&#039;: Referenced data not found</code></pre></div><p>Each of that would be fine, but what should I think about 6d, &quot;instruction not supported&quot;?</p><br /><p>OK, here are my Questions:<br />1. What is your opinion about using INTERNAL AUTHENTICATION to challenge/response-sign (arbitrary) 16b data?<br />2. How can I use ISO-7816-4 APDU&#039;s with DESFire (in general)?<br />3. How to use ISO-7816-4&#039;s INTERNAL AUTHENTICATE?</p><p>Thanks in advance,<br />Max</p>]]></description>
			<author><![CDATA[dummy@example.com (MaxGuenther)]]></author>
			<pubDate>Mon, 28 Mar 2011 10:18:09 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/357/iso78614-extended-apdus-internal-authenticate-with-desfire-ev-1/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[Automatic detection of removal of card]]></title>
			<link>http://www.libnfc.org/community/topic/326/automatic-detection-of-removal-of-card/new/posts/</link>
			<description><![CDATA[<p>Hello all,<br />I have a DesFire reader (with a controller, PCD etc) with a serial port through which it is connected to a PC. The firmware in the reader will poll for a card and after detecting the card will proceed to RATS command. Once this is done the reader will send a message through serial port that a valid (DesFire) card is detected. PC may then send, for example, create application command to the reader. There could be some time delay (may be even 5 minutes) between the reader indicating to PC and PC sending the command. In this time the card could have been removed and when the command from PC is sent to the reader, the reader should be able to inform PC of absence of the card. How can the reader keep polling for the presence of the same card? Is there any method to do this? Thanks for your time.</p><br /><p>Partha</p>]]></description>
			<author><![CDATA[dummy@example.com (Parthasaradhi)]]></author>
			<pubDate>Wed, 23 Feb 2011 09:57:45 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/326/automatic-detection-of-removal-of-card/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[CMAC and IV management in AES]]></title>
			<link>http://www.libnfc.org/community/topic/316/cmac-and-iv-management-in-aes/new/posts/</link>
			<description><![CDATA[<p>Hi,</p><p>I am trying to migrate the AES part of the DESFire Ev1 to the application I use in my mobile to read DESFire tags. I completed the authentication properly and now I have a problem trying to get the CMAC values and the IV vectors.</p><p>I know I have to implement the SP 800-38B specification to get the CMAC values. Actually, I can diversificate an AES Master Key, so the SubKey generation and the CMAC calculation shoul be ok. So, I guess it must bt a problem of concept. I tried to compare my code in JAVA with the one available in libnfc in C++ and I cannot get the wrong step.</p><p>Assume that I want to make a read and that I already have the sessionKey and a IV that is different from 0x00..000. When I start the subKey phase I think I have to use the 0x00..000 IV (not the new I got) and the sessionKey (not the application key) in order to get the k0 key , is that correct?</p><p>Well, once the SubKeys are correctly generated I have k1 and k2. The command I use to read is : BD010000000F0000. Then I guess I have to apply the padding to 32 bytes: &nbsp; &nbsp; (byte) 0xBD, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0F, (byte) 0x00, (byte) 0x00, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00. So now since I have applied padding I use k2 to xor the second half of my input and then I encrypt the result and encrypt it using the sessionKey and the IV (that is 0x93..32). The CMAC is 32 bytes long.</p><p>Can someone tell my what I am doing wrong or at least guide me, because I don´t know how to solve the problem.</p><p>Thanks a lot.</p><p>Gorka.</p>]]></description>
			<author><![CDATA[dummy@example.com (g.hernando)]]></author>
			<pubDate>Mon, 14 Feb 2011 10:10:13 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/316/cmac-and-iv-management-in-aes/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[Changing key type]]></title>
			<link>http://www.libnfc.org/community/topic/290/changing-key-type/new/posts/</link>
			<description><![CDATA[<p>Hi,</p><p>I&#039;m working with DESFire EV1 cards that have their key type set to 3DES. I&#039;d really like to change to 3 key 3DES or AES.&nbsp; I have two questions I haven&#039;t been able to figure out.</p><p>1. Is it possible to change the key type on existing cards?<br />2. How do I set the key type for new cards?</p><p>Thanks,</p><p>Tony</p>]]></description>
			<author><![CDATA[dummy@example.com (bigjay)]]></author>
			<pubDate>Fri, 21 Jan 2011 01:08:44 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/290/changing-key-type/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[mifare_desfire_authenticate's doubt]]></title>
			<link>http://www.libnfc.org/community/topic/257/mifaredesfireauthenticates-doubt/new/posts/</link>
			<description><![CDATA[<p>Hi everyone,</p><p>I want to make a program that accesses a DESFire and I have a doubt function mifare_desfire_authenticate(MifareTag tag, uint8_t key_no, MifareDESFireKey key). This function must be given as an argument MifareDESFireKey structure, this structure is the variable data, which I think is the encryption key, but the function don&#039;t use&nbsp; this variable.</p><p>My question is, is this function can be started any card or only those that have an 0s encryption key?</p><p>Thanks</p>]]></description>
			<author><![CDATA[dummy@example.com (Slalen)]]></author>
			<pubDate>Fri, 19 Nov 2010 08:59:10 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/257/mifaredesfireauthenticates-doubt/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[oyster transport card from london]]></title>
			<link>http://www.libnfc.org/community/topic/258/oyster-transport-card-from-london/new/posts/</link>
			<description><![CDATA[<p>Hi, i would like&nbsp; to share with all the members.<br />here are a oyster transport card from london the information inside is:</p><br /><br /><p>Standar AES 128<br />AIDs: 0x4f5931<br />file ids:<br />00 file type: standard data<br />comm.settings: file fully enciphered communication<br />acces rights r:3 w:15 r/w:15&nbsp; c.a.r:15<br />file size 16<br />01&nbsp; file type: standard data<br />comm.settings: file fully enciphered communication<br />acces rights r:3 w:15 r/w:15&nbsp; c.a.r:15<br />file size 16<br />02&nbsp; file type: standard data<br />comm.settings: file fully enciphered communication<br />acces rights r:2 w:3 r/w:3&nbsp; c.a.r:1<br />file size 224<br />03 file type: standard data<br />comm.settings: file fully enciphered communication<br />acces rights r:2 w:5 r/w:5&nbsp; c.a.r:1<br />file size 64<br />04 file type: standard data<br />comm.settings: file fully enciphered communication<br />acces rights r:2 w:4 r/w:4&nbsp; c.a.r:1<br />file size 48<br />05 file type: standard data<br />comm.settings: file fully enciphered communication<br />acces rights r:2 w:3 r/w:3&nbsp; c.a.r:1<br />file size 96<br />06 file type: standard data<br />comm.settings: file fully enciphered communication<br />acces rights r:2 w:3 r/w:3&nbsp; c.a.r:1<br />file size 160<br />07 file type: standard data<br />comm.settings: file fully enciphered communication<br />acces rights r:2 w:6 r/w:6&nbsp; c.a.r:1<br />file size 16</p><br /><p>i have another card from other transpot city of EU, but yet i´m not going to publish the information ( sorry)</p><p>we are working in a little proyect to break mifare desfire security <img src="http://www.libnfc.org/community/img/smilies/smile.png" width="15" height="15" alt="smile" /><br />ass soon as we get it we will publish it</p>]]></description>
			<author><![CDATA[dummy@example.com (thefkboss)]]></author>
			<pubDate>Tue, 16 Nov 2010 09:25:18 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/258/oyster-transport-card-from-london/new/posts/</guid>
		</item>
		<item>
			<title><![CDATA[DESfire authentication]]></title>
			<link>http://www.libnfc.org/community/topic/161/desfire-authentication/new/posts/</link>
			<description><![CDATA[<p>Hello,</p><p>Has anybody succeeded in authenticating to a DESfire card, then reading/writing data?</p><p>I don&#039;t know/understand the specifics of DES enough to implement it, from reading publicly available info (i.e <a href="http://ridrix.wordpress.com/2009/09/19/mifare-desfire-communication-example/">http://ridrix.wordpress.com/2009/09/19/ &#133; n-example/</a> ), my attempts to implement it using the OpenSSL libs haven&#039;t gotten far (get 0xAE response) Its probably due to the wrong DES mode or XORing the wrong data. </p><p>I don&#039;t want to sign an NDA with NXP to get hold of the potentially valuable DESfire Hints doc either. </p><p>If someone can post/contribute a working authentication function I&#039;d be willing to return the favour.. i.e write desfire functions for libfreefare <img src="http://www.libnfc.org/community/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (romain)]]></author>
			<pubDate>Tue, 13 Jul 2010 09:29:16 +0000</pubDate>
			<guid>http://www.libnfc.org/community/topic/161/desfire-authentication/new/posts/</guid>
		</item>
	</channel>
</rss>

