<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: MiFare DESFire Light Session key generation and CMAC algorithm in NFC</title>
    <link>https://community.nxp.com/t5/NFC/MiFare-DESFire-Light-Session-key-generation-and-CMAC-algorithm/m-p/929656#M5727</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm currently working on generating the session keys for MIFARE DESFire Light. Is there a library you used to generate the CMAC algorithm? I've tried multiple solutions but I'm unable to generate the proper values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Nov 2019 16:46:31 GMT</pubDate>
    <dc:creator>wilmer_suarez</dc:creator>
    <dc:date>2019-11-20T16:46:31Z</dc:date>
    <item>
      <title>MiFare DESFire Light Session key generation and CMAC algorithm</title>
      <link>https://community.nxp.com/t5/NFC/MiFare-DESFire-Light-Session-key-generation-and-CMAC-algorithm/m-p/929653#M5724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp;#&lt;STRONG&gt;MIFARE DESFire Light&lt;/STRONG&gt;&amp;nbsp;for one of my customer. I can successfully authenticate the card using DESFireEV2First algorithm. After that I'm trying to get the session keys (SesAuthENCKey/&lt;SPAN&gt;SesAuthMACKey&lt;/SPAN&gt;) as explained in example of&amp;nbsp;&lt;SPAN&gt;AN12343, Chapter 7.1.3.1/7.1.4, but I can not get the expected output for the session keys.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So,&amp;nbsp;my concern is, &lt;STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;Can I use same CMAC algorithm in DESFire Light which was worked in DESFire EV1?&lt;/SPAN&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If YES, output of CMAC algorithm used in DESFire EV1 = 8 bytes (MAC)&lt;/P&gt;&lt;P&gt;And we want output of CMAC algorithm in DESFire Light = 16 bytes Session keys (SesAuthENCKey/SesAuthMACKey).&lt;/P&gt;&lt;P&gt;it looks confusing for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any guideline regards this will be highly appreciable!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2019 06:04:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/MiFare-DESFire-Light-Session-key-generation-and-CMAC-algorithm/m-p/929653#M5724</guid>
      <dc:creator>dev-support</dc:creator>
      <dc:date>2019-10-17T06:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: MiFare DESFire Light Session key generation and CMAC algorithm</title>
      <link>https://community.nxp.com/t5/NFC/MiFare-DESFire-Light-Session-key-generation-and-CMAC-algorithm/m-p/929654#M5725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A reply was already made to the case, the keys generated are incorrect, please follow &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;AN12343 minutely.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;BR,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Ivan.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Oct 2019 17:50:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/MiFare-DESFire-Light-Session-key-generation-and-CMAC-algorithm/m-p/929654#M5725</guid>
      <dc:creator>IvanRuiz</dc:creator>
      <dc:date>2019-10-21T17:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: MiFare DESFire Light Session key generation and CMAC algorithm</title>
      <link>https://community.nxp.com/t5/NFC/MiFare-DESFire-Light-Session-key-generation-and-CMAC-algorithm/m-p/929655#M5726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Hi Ivan,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Thanks for the response. The issue was with the XOR calculation. Now, I can get the correct&amp;nbsp;Session&amp;nbsp;keys from the&amp;nbsp;active DESFireEV2 first authentication of DESFire Light.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;I’m facing issue in write data and read data after this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 11.5pt;"&gt;&lt;STRONG&gt;1)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt; &lt;STRONG&gt;When I try to WriteData in 00EF or 04EF, it gives me error&amp;nbsp;&lt;SPAN style="text-decoration: underline;"&gt;0x7E (LENGTH_ERROR)&lt;/SPAN&gt;&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;I can successfully write data "22222222222222222222222222222222222222222222222222" in encrypted mode same as example of AN12343 (section 8.1.3).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;But if I try to write my data which is 16 bytes or less i.e. "3132333435", it gives me 0x7E error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #3d3d3d; text-decoration: underline; font-size: 11.5pt;"&gt;&lt;STRONG&gt;&amp;gt;&amp;gt; Write Procedure I followed:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;IV_Input =&amp;nbsp;A55AFBCF7BCF00000000000000000000 (lable + TI + CmdCounter + Padding followed by 00)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;SesAuthENCKey =&amp;nbsp;1D8C929597A19990295306DEFC57755A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;IV =&amp;nbsp;00000000000000000000000000000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;IV_For Command Data =&amp;nbsp;6034C0FA74F032CBFFED3B6F3E9C584A&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Data with Padding =&amp;nbsp;31323334358000000000000000000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Encrypted Data =&amp;nbsp;77A2FD1B2BC19EC917B26D17694B6844&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Command Header =&amp;nbsp;00000000050000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;MAC_Input =&amp;nbsp;8D0000FBCF7BCF0000000005000077A2FD1B2BC19EC917B26D17694B6844&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;IV =&amp;nbsp;00000000000000000000000000000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;SesAuthMACKey = 2D9377F5CAAA1D53935454806B170723&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Calculated MAC =&amp;nbsp;CD3177470834C634&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;APDU to Card =&amp;nbsp;908D00001F0000000005000077A2FD1B2BC19EC917B26D17694B6844CD3177470834C63400&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Response from Card = 917E (LENGTH_ERROR)&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Can you guide me which one is the wrong step I'm followed.?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 11.5pt;"&gt;&lt;STRONG&gt;2) Also, I have followed below steps to read data 22222222222222222222222222222222222222222222222222”, &lt;BR /&gt; but it gives me &lt;SPAN style="text-decoration: underline;"&gt;0x1E (INTEGRITY_ERROR)&lt;/SPAN&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="; color: #3d3d3d; text-decoration: underline; font-size: 11.5pt;"&gt;&lt;STRONG&gt;&amp;gt;&amp;gt; Read Procedure I followed:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;IV =&amp;nbsp;00000000000000000000000000000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Command Header = 00000000190000 (FileID = 00, offset = 000000, DataSizeToRead = 19 bytes)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;MAC_Input&amp;nbsp; = AD0100B39DB01400000000190000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;MACKey = C3D79B25473D4DC735F856F6DA8F7C22&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Calculated MAC = E2B5F6406CF1FA8C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;APDU to Card =&amp;nbsp;90AD00000F00000000190000E2B5F6406CF1FA8C00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Response from Card = 911E (INTEGRITY_ERROR)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Can you guide me which one is the wrong step in read data I'm followed.?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;&amp;nbsp;&lt;A href="https://community.nxp.com/space/11488"&gt;NFC&lt;/A&gt;‌&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2019 10:40:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/MiFare-DESFire-Light-Session-key-generation-and-CMAC-algorithm/m-p/929655#M5726</guid>
      <dc:creator>dev-support</dc:creator>
      <dc:date>2019-10-23T10:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: MiFare DESFire Light Session key generation and CMAC algorithm</title>
      <link>https://community.nxp.com/t5/NFC/MiFare-DESFire-Light-Session-key-generation-and-CMAC-algorithm/m-p/929656#M5727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm currently working on generating the session keys for MIFARE DESFire Light. Is there a library you used to generate the CMAC algorithm? I've tried multiple solutions but I'm unable to generate the proper values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:46:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/MiFare-DESFire-Light-Session-key-generation-and-CMAC-algorithm/m-p/929656#M5727</guid>
      <dc:creator>wilmer_suarez</dc:creator>
      <dc:date>2019-11-20T16:46:31Z</dc:date>
    </item>
  </channel>
</rss>

