<?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 NFC Mifare Desfire EV3 - CMAC calculation issue in NFC</title>
    <link>https://community.nxp.com/t5/NFC/NFC-Mifare-Desfire-EV3-CMAC-calculation-issue/m-p/2178240#M13663</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I am using NFC Mifare Desfire EV3 cards and I am able to get the authentication sequence correct, and after that when we send the read command, I getting the response in which data part is correct but the CMAC is not matching with we calculated.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Reader is PN532 NFC HAT + Raspberry pi&amp;nbsp;&lt;BR /&gt;prog language used - Python&lt;BR /&gt;&lt;BR /&gt;Please find the detailed steps below :&lt;BR /&gt;1. Application is created with id 0xA1A2A3. (one time process)&lt;BR /&gt;2. File creation - file id = 0, type = plaintext&lt;BR /&gt;3. Authentication sequence is followed and received expected responses. Session key is generated.&lt;BR /&gt;4. Read command sent to read from file 0, location 0, no of bytes - 6&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Session key -&amp;nbsp;0B C6 7C 01 B1 3F 82 2D C0 B7 59 1F 77 17 26 AF&lt;BR /&gt;&lt;BR /&gt;read Request -&amp;nbsp;&lt;BR /&gt;APDU CMD: BD 00 00 00 00 06 00 00&lt;BR /&gt;APDU RESP: 00 31 32 33 34 35 36 85 64 57 2D B0 B0 5C C7&lt;BR /&gt;&lt;BR /&gt;CMAC calculations -&amp;nbsp;&lt;BR /&gt;Subkey1: f3b468b1db783e3b5c0e0f24503a54cc&lt;BR /&gt;Subkey2: e768d163b6f07c76b81c1e48a074a91f&lt;BR /&gt;Status: 00&lt;BR /&gt;Data: 313233343536&lt;BR /&gt;CMAC from card: 8564572db0b05cc7&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;CMAC input data: 31323334353600&lt;BR /&gt;CMAC encryption key: 0bc67c01b13f822dc0b7591f771726af&lt;BR /&gt;Padded data: 31323334353600800000000000000000&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Padding was added, XOR last block with subkey2&lt;BR /&gt;XOR output (last block after XOR): d65ae25783c67cf6b81c1e48a074a91f&lt;BR /&gt;CMAC encrypted: c8e5e3dda222026be99ab3ce4a5ff1b6&lt;BR /&gt;CMAC: c8e5e3dda222026b&lt;BR /&gt;&lt;BR /&gt;Doubts-&lt;BR /&gt;1. After authentication, we are sending this first command, hence the iv being used should be 00000000000000000000000000000000, right ?&lt;BR /&gt;2. Can we get more details about the CMAC calculation.&lt;BR /&gt;&lt;BR /&gt;note - the card was written from one of the third party Android app. Data written on card "123456"&lt;/P&gt;</description>
    <pubDate>Tue, 30 Sep 2025 13:52:44 GMT</pubDate>
    <dc:creator>tanmay_chauk</dc:creator>
    <dc:date>2025-09-30T13:52:44Z</dc:date>
    <item>
      <title>NFC Mifare Desfire EV3 - CMAC calculation issue</title>
      <link>https://community.nxp.com/t5/NFC/NFC-Mifare-Desfire-EV3-CMAC-calculation-issue/m-p/2178240#M13663</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I am using NFC Mifare Desfire EV3 cards and I am able to get the authentication sequence correct, and after that when we send the read command, I getting the response in which data part is correct but the CMAC is not matching with we calculated.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Reader is PN532 NFC HAT + Raspberry pi&amp;nbsp;&lt;BR /&gt;prog language used - Python&lt;BR /&gt;&lt;BR /&gt;Please find the detailed steps below :&lt;BR /&gt;1. Application is created with id 0xA1A2A3. (one time process)&lt;BR /&gt;2. File creation - file id = 0, type = plaintext&lt;BR /&gt;3. Authentication sequence is followed and received expected responses. Session key is generated.&lt;BR /&gt;4. Read command sent to read from file 0, location 0, no of bytes - 6&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Session key -&amp;nbsp;0B C6 7C 01 B1 3F 82 2D C0 B7 59 1F 77 17 26 AF&lt;BR /&gt;&lt;BR /&gt;read Request -&amp;nbsp;&lt;BR /&gt;APDU CMD: BD 00 00 00 00 06 00 00&lt;BR /&gt;APDU RESP: 00 31 32 33 34 35 36 85 64 57 2D B0 B0 5C C7&lt;BR /&gt;&lt;BR /&gt;CMAC calculations -&amp;nbsp;&lt;BR /&gt;Subkey1: f3b468b1db783e3b5c0e0f24503a54cc&lt;BR /&gt;Subkey2: e768d163b6f07c76b81c1e48a074a91f&lt;BR /&gt;Status: 00&lt;BR /&gt;Data: 313233343536&lt;BR /&gt;CMAC from card: 8564572db0b05cc7&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;CMAC input data: 31323334353600&lt;BR /&gt;CMAC encryption key: 0bc67c01b13f822dc0b7591f771726af&lt;BR /&gt;Padded data: 31323334353600800000000000000000&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Padding was added, XOR last block with subkey2&lt;BR /&gt;XOR output (last block after XOR): d65ae25783c67cf6b81c1e48a074a91f&lt;BR /&gt;CMAC encrypted: c8e5e3dda222026be99ab3ce4a5ff1b6&lt;BR /&gt;CMAC: c8e5e3dda222026b&lt;BR /&gt;&lt;BR /&gt;Doubts-&lt;BR /&gt;1. After authentication, we are sending this first command, hence the iv being used should be 00000000000000000000000000000000, right ?&lt;BR /&gt;2. Can we get more details about the CMAC calculation.&lt;BR /&gt;&lt;BR /&gt;note - the card was written from one of the third party Android app. Data written on card "123456"&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2025 13:52:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/NFC-Mifare-Desfire-EV3-CMAC-calculation-issue/m-p/2178240#M13663</guid>
      <dc:creator>tanmay_chauk</dc:creator>
      <dc:date>2025-09-30T13:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: NFC Mifare Desfire EV3 - CMAC calculation issue</title>
      <link>https://community.nxp.com/t5/NFC/NFC-Mifare-Desfire-EV3-CMAC-calculation-issue/m-p/2178280#M13664</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you might know, there are some of the documents and libraries which are under NDA (Non-Disclosure Agreement) the information it's not public&lt;/P&gt;
&lt;P&gt;For the specific questions you have we have some documents available; still in order to access them you will have to request higher access.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer to the following guide&amp;nbsp; &amp;nbsp;&lt;A href="https://www.nxp.com/support/support/secure-access-rights:SEC-ACCESS" target="_blank"&gt;Secure Access Rights | NXP Semiconductors&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Sep 2025 14:58:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/NFC-Mifare-Desfire-EV3-CMAC-calculation-issue/m-p/2178280#M13664</guid>
      <dc:creator>stephanie_m</dc:creator>
      <dc:date>2025-09-30T14:58:56Z</dc:date>
    </item>
  </channel>
</rss>

