<?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>TapLinx SDK, TagWriter and TagInfoのトピックRe: TapLinx DesfireEV2.format() fails with exception Length Error SW2 = 126</title>
    <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2027414#M91</link>
    <description>&lt;P&gt;Hello Eddy!&lt;/P&gt;
&lt;P&gt;Thanks for following the proposed steps! Indeed, there seems to be something wrong possibly inside TapLinx. I have reported this internally to our R&amp;amp;D and will come back as soon as i get some news!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for staying patient!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;Florian&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jan 2025 08:36:10 GMT</pubDate>
    <dc:creator>Florian_Mikulik</dc:creator>
    <dc:date>2025-01-14T08:36:10Z</dc:date>
    <item>
      <title>TapLinx DesfireEV2.format() fails with exception Length Error SW2 = 126</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2025268#M86</link>
      <description>&lt;P&gt;I'm trying to modify the TapLinx for Android sample app to add the facility to format an EV2 card,.&lt;BR /&gt;&lt;BR /&gt;My app is registered to use the TapLinx (3.1.0) library, built and the vanilla read/write functions of the sample app work as expected.&lt;BR /&gt;&lt;BR /&gt;I understand that prior to using desFireEV2.format() method that you must&amp;nbsp;&lt;SPAN&gt;authenticate with the PICC master key and selected application has to be 0.&lt;BR /&gt;&lt;BR /&gt;My EV2 cards have a non-default AES PICC master key, therefore my code is similar to this:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;// Select Application 0&lt;BR /&gt;desFireEV2.selectApplication(&lt;SPAN&gt;0&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Authenticate with the AES PICC MASTER KEY&lt;BR /&gt;&lt;/SPAN&gt;KeyData aesKeyData = &lt;SPAN&gt;new &lt;/SPAN&gt;KeyData();&lt;BR /&gt;Key keyDefault = &lt;SPAN&gt;new &lt;/SPAN&gt;SecretKeySpec(MY&lt;SPAN&gt;_AES128_KEY&lt;/SPAN&gt;, &lt;SPAN&gt;"AES"&lt;/SPAN&gt;);&lt;BR /&gt;aesKeyData.setKey(keyDefault);&lt;BR /&gt;desFireEV2.authenticateEV2First(&lt;SPAN&gt;0&lt;/SPAN&gt;, aesKeyData, &lt;SPAN&gt;null&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;// Format&lt;BR /&gt;desFireEV2.format();&lt;BR /&gt;&lt;BR /&gt;The selection of application 0 and AES authentication works, but the format method always fails with the Exception message "Length Error SW2 = 126".&lt;BR /&gt;&lt;BR /&gt;Please can someone enlighten me as to where I'm going wrong.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 00:54:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2025268#M86</guid>
      <dc:creator>eddy1231</dc:creator>
      <dc:date>2025-01-10T00:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: TapLinx DesfireEV2.format() fails with exception Length Error SW2 = 126</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2025901#M87</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;Thanks for reaching out! From what you describe, i can not see any issue, as this is how it should normally work. However, it is possible that the Format command is disabled for. Do you know or can influence the exact configuration of this card?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A length error however usually does point into the direction of a failing authentication. The Format command requires to be sent in MACed communication mode, and if the authentication is for some reason not successful, the MAC cant be calculated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a next step i would test the same code but with an intentional wrong key, to check if the Authentication would then properly fail. Another thing to try is to give instead of "null" as third parameter a proper byte array with six bytes of "00" ( 00 00 00 00 00 00 )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let us know the outcomes!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;Florian&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 15:10:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2025901#M87</guid>
      <dc:creator>Florian_Mikulik</dc:creator>
      <dc:date>2025-01-10T15:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: TapLinx DesfireEV2.format() fails with exception Length Error SW2 = 126</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2025966#M89</link>
      <description>&lt;P&gt;Hi Florian,&lt;BR /&gt;&lt;BR /&gt;Thank you for your suggestions.&lt;BR /&gt;&lt;BR /&gt;I know the exact configuration of the EV2 card and can influence it.&lt;BR /&gt;&lt;BR /&gt;TagInfo says:&lt;BR /&gt;Application ID 0x000000 (PICC)&lt;BR /&gt;Key configuration: (0x0B81)&lt;BR /&gt;AES Key&lt;BR /&gt;1 AES Key&lt;BR /&gt;Key type of active keyset: AES&lt;BR /&gt;Master key changeable&lt;BR /&gt;Master key required for&lt;BR /&gt;- directory list access: no&lt;BR /&gt;- create/delete files: yes&lt;BR /&gt;Configuration changeable&lt;BR /&gt;Master key version: 174&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I test the same code with an intentional wrong key (KEY_AES128-ZEROS), I instead get the exception "Authentication Failed".&lt;BR /&gt;&lt;BR /&gt;When I change the third authenticate parameter, it makes no difference, as format still fails with&amp;nbsp;exception Length Error SW2 = 126&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;byte&lt;/SPAN&gt;[] pCDcap2 = {(&lt;SPAN&gt;byte&lt;/SPAN&gt;) &lt;SPAN&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN&gt;byte&lt;/SPAN&gt;) &lt;SPAN&gt;0x00&lt;/SPAN&gt;,&lt;BR /&gt;        (&lt;SPAN&gt;byte&lt;/SPAN&gt;) &lt;SPAN&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN&gt;byte&lt;/SPAN&gt;) &lt;SPAN&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN&gt;byte&lt;/SPAN&gt;) &lt;SPAN&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN&gt;byte&lt;/SPAN&gt;) &lt;SPAN&gt;0x00&lt;/SPAN&gt;};&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;desFireEV2.authenticateEV2First(&lt;SPAN&gt;0&lt;/SPAN&gt;, aesKeyData, pCDcap2);&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;I'm also pretty sure that PICC authentication is successful, because when I replace the format method with the original WriteActivity code, this works correctly adding a new application (ID:120000) to the card.&lt;BR /&gt;&lt;BR /&gt;Any other suggestions?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 16:56:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2025966#M89</guid>
      <dc:creator>eddy1231</dc:creator>
      <dc:date>2025-01-10T16:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: TapLinx DesfireEV2.format() fails with exception Length Error SW2 = 126</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2027414#M91</link>
      <description>&lt;P&gt;Hello Eddy!&lt;/P&gt;
&lt;P&gt;Thanks for following the proposed steps! Indeed, there seems to be something wrong possibly inside TapLinx. I have reported this internally to our R&amp;amp;D and will come back as soon as i get some news!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for staying patient!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;Florian&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 08:36:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2027414#M91</guid>
      <dc:creator>Florian_Mikulik</dc:creator>
      <dc:date>2025-01-14T08:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: TapLinx DesfireEV2.format() fails with exception Length Error SW2 = 126</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2037638#M104</link>
      <description>&lt;P&gt;Hello Eddy,&lt;/P&gt;
&lt;P&gt;we have checked your issue, but are unable to reproduce on a fresh card. What we did:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;mIDESFireEV2.selectApplication(0);&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;mIDESFireEV2.authenticateEV2First(0, DESFireKeys.&lt;STRONG&gt;aesKeyDataDefault&lt;/STRONG&gt;, null);&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;mIDESFireEV2.format();&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;basically, this is using a fresh card and runs the format command, no issue can be observed.&lt;/P&gt;
&lt;P&gt;As the error reported is 126, this indicates a length error, it seems that the phone is transmitting the command wrongly. Do you have the possibility to provide an APDU log, meaning what data is sent between the card and the phone via NFC?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And: Do you have a possibility to verify with a fresh card without any settings made? It is possible to deactivate the format command on MIFARE DESFire EV2, in which case the card would reply with only one byte error code, and not with the expected 1 byte success code + 8 byte CMAC. So pleas verify that Format is allowed on the card you are using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Br,&lt;/P&gt;
&lt;P&gt;Florian&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 10:25:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/TapLinx-DesfireEV2-format-fails-with-exception-Length-Error-SW2/m-p/2037638#M104</guid>
      <dc:creator>Florian_Mikulik</dc:creator>
      <dc:date>2025-02-04T10:25:44Z</dc:date>
    </item>
  </channel>
</rss>

