<?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: How can i enable CMAC, UID, COUNTER and RAND in NTAG424 DNA? in TapLinx SDK, TagWriter and TagInfo</title>
    <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2087596#M144</link>
    <description>&lt;P&gt;Thanks for the help! You are right that my offset has the wrong values. This is what I have changed and now I can save settings.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;override fun onNewIntent(intent: Intent) {
    Log.i("NFC", "Intent action: ${intent.action}")
    super.onNewIntent(intent)

    Log.i("MainActivity", "NFC tag discovered")

    val cardType = libInstance.getCardType(intent)
    Log.i("MainActivity", "Detected card type: $cardType")
    if (cardType == CardType.NTAG424DNA) {
        val ntag424DNA: INTAG424DNA = DESFireFactory.getInstance().getNTAG424DNA(libInstance.customModules)
        val reader: IReader = ntag424DNA.reader

        try {

            if (!reader.isConnected) {
                reader.connect()
            }

            ntag424DNA.isoSelectApplicationByDFName(NTAG424DNA_APP_NAME)
            Log.i("NFC", "ISO selected app by DF Name &lt;LI-EMOJI id="lia_white-heavy-check-mark" title=":white_heavy_check_mark:"&gt;&lt;/LI-EMOJI&gt;")

            authenticateTag(0x00, ntag424DNA, KEY_AES128_DEFAULT)
            creatingNDEFmessage(ntag424DNA)
            authenticateTag(0x00, ntag424DNA, KEY_AES128_DEFAULT)
            changeFileSettings(ntag424DNA, 0x02)

            if (reader.isConnected) {
                reader.close()
            }
        } catch (e: Exception) {
            Log.e("MainActivity", e.localizedMessage ?: "No Error Message");
            e.printStackTrace()
        }

    }
}

private fun changeFileSettings(ntag424DNA: INTAG424DNA, fileNumber: Int) {
    // 3. Create NTAG 424 DNA file settings for E104
    val fileSettings = NTAG424DNAFileSettings(
        MFPCard.CommunicationMode.Plain,    // = 0x03 = Full ENC + CMAC (SUN)
        0x0E.toByte(),             // Read access = key slot 0x00 maybe 0x01
        0x0E.toByte(),             // Write access = always
        0x0E.toByte(),             // RW access = always
        0x00.toByte()              // Change access = always
    )

    fileSettings.isSDMEnabled = true
    fileSettings.isUIDMirroringEnabled = true
    fileSettings.isSDMReadCounterEnabled = true
    fileSettings.sdmAccessRights = byteArrayOf(0xfe.toByte(), 0xe1.toByte())

    fileSettings.uidOffset = byteArrayOf(0x1A, 0x00, 0x00)   
    fileSettings.sdmReadCounterOffset = byteArrayOf(0x2d, 0x00, 0x00) 
    fileSettings.sdmMacOffset = byteArrayOf(0x39, 0x00, 0x00) 
    fileSettings.sdmMacInputOffset = byteArrayOf(0x39, 0x00, 0x00)

    Log.i("MainActivity", "Prepare for saving changes in file $fileNumber")

    ntag424DNA.changeFileSettings(fileNumber, fileSettings)
    Log.i("MainActivity", "&lt;LI-EMOJI id="lia_locked-with-key" title=":locked_with_key:"&gt;&lt;/LI-EMOJI&gt; File settings updated $fileNumber")
}

private fun creatingNDEFmessage(ntag424DNA: INTAG424DNA) {
    // 1. Creating URI NDEF message
    val payload = byteArrayOf(0x04) + "noexample.xxxx?uid=00000000000000&amp;amp;ctr=000000&amp;amp;cmac=0000000000000000".toByteArray()

    val msg = NdefMessageWrapper(
        NdefRecordWrapper(
            NdefRecordWrapper.TNF_WELL_KNOWN,
            "U".toByteArray(StandardCharsets.US_ASCII),
            ByteArray(0),
            payload
        )
    )

    ntag424DNA.writeNDEF(msg);
    Log.i("MainActivity", "URI NDEF message written successful &lt;LI-EMOJI id="lia_white-heavy-check-mark" title=":white_heavy_check_mark:"&gt;&lt;/LI-EMOJI&gt;")

    val ndefRead = ntag424DNA.readNDEF()
    Log.i("MainActivity", "Read URI NDEF message ${CustomModules.getUtility().dumpBytes(ndefRead.toByteArray())}")

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 26 Apr 2025 16:00:02 GMT</pubDate>
    <dc:creator>rocky2</dc:creator>
    <dc:date>2025-04-26T16:00:02Z</dc:date>
    <item>
      <title>How can i enable CMAC, UID, COUNTER and RAND in NTAG424 DNA?</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2082672#M140</link>
      <description>&lt;P&gt;I'm trying to use the newest Android SDK library to set my dynamic URL based on AES key, but I'm unable to do it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;nxpnfcandroidlib-release-protected.aar&lt;/LI-CODE&gt;&lt;P&gt;This is my code&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;override fun onNewIntent(intent: Intent) {
	Log.i("NFC", "Intent action: ${intent.action}")
	super.onNewIntent(intent)

	Log.i("MainActivity", "NFC tag discovered")

	val cardType = libInstance.getCardType(intent)
	Log.i("MainActivity", "Detected card type: $cardType")
	if (cardType == CardType.NTAG424DNA) {
	    val ntag424DNA: INTAG424DNA = DESFireFactory.getInstance().getNTAG424DNA(libInstance.customModules)
	    val reader: IReader = ntag424DNA.reader

	    try {

	        if (!reader.isConnected) {
	            reader.connect()
	        }

	        ntag424DNA.isoSelectApplicationByDFName(NTAG424DNA_APP_NAME)
	        Log.i("NFC", "ISO selected app by DF Name &lt;LI-EMOJI id="lia_white-heavy-check-mark" title=":white_heavy_check_mark:"&gt;&lt;/LI-EMOJI&gt;")

	        authenticateTag(ntag424DNA, KEY_AES128_DEFAULT)
		    creatingNDEFmessage(ntag424DNA)
            authenticateTag(ntag424DNA, KEY_AES128_DEFAULT)
		    changeFileSettings(ntag424DNA, 0x01)

            authenticateTag(ntag424DNA, KEY_AES128_DEFAULT)
	        ntag424DNA.setPICCConfiguration(true)
	        Log.i("MainActivity", "&lt;LI-EMOJI id="lia_white-heavy-check-mark" title=":white_heavy_check_mark:"&gt;&lt;/LI-EMOJI&gt; PICC Configuration updated to enable SDM globally.")

	        authenticateTag(ntag424DNA, KEY_AES128_DEFAULT)
	        changeSDMFileSettings(ntag424DNA, 0x01)

	        if (reader.isConnected) {
	            reader.close()
	        }
	    } catch (e: Exception) {
	        e.printStackTrace()
	    }

	}
}

private fun creatingNDEFmessage(ntag424DNA: INTAG424DNA) {
    // 1. Creating URI NDEF message
    val msg = NdefMessageWrapper(
        NdefRecordWrapper(
            NdefRecordWrapper.TNF_ABSOLUTE_URI,
            "https://domain.com?uid=04BB38D2AA1191&amp;amp;ctr=0001&amp;amp;cmac=3ab665b76b795cb9bf76a17956cc9fb3&amp;amp;rand=422def08-8a1c-49c9-9138-434cde858faa".toByteArray(
                Charset.forName("US-ASCII")
            ), ByteArray(0), ByteArray(0)
        )
    )

    ntag424DNA.writeNDEF(msg);
    Log.i("MainActivity", "URI NDEF message written successful &lt;LI-EMOJI id="lia_white-heavy-check-mark" title=":white_heavy_check_mark:"&gt;&lt;/LI-EMOJI&gt;")

    val ndefRead = ntag424DNA.readNDEF()
    Log.i("MainActivity", "Read URI NDEF message ${CustomModules.getUtility().dumpBytes(ndefRead.toByteArray())}")

}

private fun changeFileSettings(ntag424DNA: INTAG424DNA, fileNumber: Int) {
    // 3. Create NTAG 424 DNA file settings for E104
    val fileSettings = NTAG424DNAFileSettings(
        MFPCard.CommunicationMode.Encrypted,    // = 0x03 = Full ENC + CMAC (SUN)
        0x0E.toByte(),             // Read access = key slot 0x00 maybe 0x01
        0x0E.toByte(),             // Write access = always
        0x0E.toByte(),             // RW access = always
        0x0E.toByte()              // Change access = always
    )

    Log.i("MainActivity", "Prepare for saving changes in file $fileNumber")
    ntag424DNA.changeFileSettings(fileNumber, fileSettings)
    Log.i("NFC", "&lt;LI-EMOJI id="lia_locked-with-key" title=":locked_with_key:"&gt;&lt;/LI-EMOJI&gt; File settings updated $fileNumber")
}


private fun changeSDMFileSettings(ntag424DNA: INTAG424DNA, fileNumber: Int) {
    val fileSettings = ntag424DNA.getFileSettings(fileNumber);

    fileSettings.isSDMEnabled = true;
    fileSettings.isUIDMirroringEnabled = true;

    fileSettings.piccDataOffset = intTo2ByteArray(51)
    fileSettings.sdmMacOffset = intTo2ByteArray(51)
    fileSettings.sdmMacInputOffset = intTo2ByteArray(51)
    fileSettings.sdmReadCounterOffset = intTo2ByteArray(51)
    fileSettings.uidOffset = intTo2ByteArray(51)
    fileSettings.sdmAccessRights = byteArrayOf(0x00, 0x00)

    Log.i("MainActivity", "Prepare for saving SDM changes in file $fileNumber")
    ntag424DNA.changeFileSettings(fileNumber, fileSettings)
    Log.i("NFC", "&lt;LI-EMOJI id="lia_locked-with-key" title=":locked_with_key:"&gt;&lt;/LI-EMOJI&gt; File settings updated: SUN CMAC enabled on $fileNumber")
}

private fun intTo2ByteArray(value: Int): ByteArray {
    return byteArrayOf(
        ((value shr &lt;LI-EMOJI id="lia_smiling-face-with-sunglasses" title=":smiling_face_with_sunglasses:"&gt;&lt;/LI-EMOJI&gt; and 0xFF).toByte(),
        (value and 0xFF).toByte()
    )
}&lt;/LI-CODE&gt;&lt;P&gt;I know that the offset number doesn't match the position in the URL but whatever I'm changing, I'm still getting this error. It looks like, for some reason, these settings can not be saved by this method.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;ntag424DNA.changeFileSettings(fileNumber, fileSettings)&lt;/LI-CODE&gt;&lt;P&gt;This is the error message&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;com.nxp.nfclib.exceptions.UsageException: Invalid Parameters! {Invalid Value for PICC Offset}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 17 Apr 2025 15:22:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2082672#M140</guid>
      <dc:creator>rocky2</dc:creator>
      <dc:date>2025-04-17T15:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can i enable CMAC, UID, COUNTER and RAND in NTAG424 DNA?</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2085141#M142</link>
      <description>&lt;P&gt;This document could be useful for you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.nxp.com/docs/en/application-note/AN12196.pdf" target="_blank"&gt;NTAG 424 DNA and NTAG 424 DNA TagTamper features and hints&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 06:28:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2085141#M142</guid>
      <dc:creator>jimmychan</dc:creator>
      <dc:date>2025-04-23T06:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can i enable CMAC, UID, COUNTER and RAND in NTAG424 DNA?</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2085290#M143</link>
      <description>&lt;P&gt;Dear Rocky2,&lt;/P&gt;
&lt;P&gt;Please check document refered by jimmyvhan and datasheet.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your offsets are overlapping, which is not permitted as per datasheet. &lt;/P&gt;
&lt;P&gt;Considering your desired URL. You have too less space for NFCCounter, which is 3 bytes. So below settings are suiting corrected URL.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://domain.com?uid=04BB38D2AA1191&amp;amp;ctr=000001&amp;amp;cmac=3ab665b76b795cb9bf76a17956cc9fb3&amp;amp;rand=422def08-8a1c-49c9-9138-434cde858faa" target="_blank"&gt;https://domain.com?uid=04BB38D2AA1191&amp;amp;ctr=000001&amp;amp;cmac=3ab665b76b795cb9bf76a17956cc9fb3&amp;amp;rand=422def08-8a1c-49c9-9138-434cde858faa&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;You shall use these parameters for SDM Configuration. You decide on Input data for CMAC calculation as well. We used UIDOffset as starting point for this example.&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;fileSettings.sdmMacOffset = intTo2ByteArray(53)
fileSettings.sdmMacInputOffset = intTo2ByteArray(22)
fileSettings.sdmReadCounterOffset = intTo2ByteArray(41)
fileSettings.uidOffset = intTo2ByteArray(22)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;Best regards,&lt;/P&gt;
&lt;P&gt;TapLinx team&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 08:50:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2085290#M143</guid>
      <dc:creator>ukcas</dc:creator>
      <dc:date>2025-04-23T08:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can i enable CMAC, UID, COUNTER and RAND in NTAG424 DNA?</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2087596#M144</link>
      <description>&lt;P&gt;Thanks for the help! You are right that my offset has the wrong values. This is what I have changed and now I can save settings.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;override fun onNewIntent(intent: Intent) {
    Log.i("NFC", "Intent action: ${intent.action}")
    super.onNewIntent(intent)

    Log.i("MainActivity", "NFC tag discovered")

    val cardType = libInstance.getCardType(intent)
    Log.i("MainActivity", "Detected card type: $cardType")
    if (cardType == CardType.NTAG424DNA) {
        val ntag424DNA: INTAG424DNA = DESFireFactory.getInstance().getNTAG424DNA(libInstance.customModules)
        val reader: IReader = ntag424DNA.reader

        try {

            if (!reader.isConnected) {
                reader.connect()
            }

            ntag424DNA.isoSelectApplicationByDFName(NTAG424DNA_APP_NAME)
            Log.i("NFC", "ISO selected app by DF Name &lt;LI-EMOJI id="lia_white-heavy-check-mark" title=":white_heavy_check_mark:"&gt;&lt;/LI-EMOJI&gt;")

            authenticateTag(0x00, ntag424DNA, KEY_AES128_DEFAULT)
            creatingNDEFmessage(ntag424DNA)
            authenticateTag(0x00, ntag424DNA, KEY_AES128_DEFAULT)
            changeFileSettings(ntag424DNA, 0x02)

            if (reader.isConnected) {
                reader.close()
            }
        } catch (e: Exception) {
            Log.e("MainActivity", e.localizedMessage ?: "No Error Message");
            e.printStackTrace()
        }

    }
}

private fun changeFileSettings(ntag424DNA: INTAG424DNA, fileNumber: Int) {
    // 3. Create NTAG 424 DNA file settings for E104
    val fileSettings = NTAG424DNAFileSettings(
        MFPCard.CommunicationMode.Plain,    // = 0x03 = Full ENC + CMAC (SUN)
        0x0E.toByte(),             // Read access = key slot 0x00 maybe 0x01
        0x0E.toByte(),             // Write access = always
        0x0E.toByte(),             // RW access = always
        0x00.toByte()              // Change access = always
    )

    fileSettings.isSDMEnabled = true
    fileSettings.isUIDMirroringEnabled = true
    fileSettings.isSDMReadCounterEnabled = true
    fileSettings.sdmAccessRights = byteArrayOf(0xfe.toByte(), 0xe1.toByte())

    fileSettings.uidOffset = byteArrayOf(0x1A, 0x00, 0x00)   
    fileSettings.sdmReadCounterOffset = byteArrayOf(0x2d, 0x00, 0x00) 
    fileSettings.sdmMacOffset = byteArrayOf(0x39, 0x00, 0x00) 
    fileSettings.sdmMacInputOffset = byteArrayOf(0x39, 0x00, 0x00)

    Log.i("MainActivity", "Prepare for saving changes in file $fileNumber")

    ntag424DNA.changeFileSettings(fileNumber, fileSettings)
    Log.i("MainActivity", "&lt;LI-EMOJI id="lia_locked-with-key" title=":locked_with_key:"&gt;&lt;/LI-EMOJI&gt; File settings updated $fileNumber")
}

private fun creatingNDEFmessage(ntag424DNA: INTAG424DNA) {
    // 1. Creating URI NDEF message
    val payload = byteArrayOf(0x04) + "noexample.xxxx?uid=00000000000000&amp;amp;ctr=000000&amp;amp;cmac=0000000000000000".toByteArray()

    val msg = NdefMessageWrapper(
        NdefRecordWrapper(
            NdefRecordWrapper.TNF_WELL_KNOWN,
            "U".toByteArray(StandardCharsets.US_ASCII),
            ByteArray(0),
            payload
        )
    )

    ntag424DNA.writeNDEF(msg);
    Log.i("MainActivity", "URI NDEF message written successful &lt;LI-EMOJI id="lia_white-heavy-check-mark" title=":white_heavy_check_mark:"&gt;&lt;/LI-EMOJI&gt;")

    val ndefRead = ntag424DNA.readNDEF()
    Log.i("MainActivity", "Read URI NDEF message ${CustomModules.getUtility().dumpBytes(ndefRead.toByteArray())}")

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Apr 2025 16:00:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2087596#M144</guid>
      <dc:creator>rocky2</dc:creator>
      <dc:date>2025-04-26T16:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can i enable CMAC, UID, COUNTER and RAND in NTAG424 DNA?</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2171596#M208</link>
      <description>&lt;P&gt;hey there,&lt;BR /&gt;&lt;BR /&gt;I am following this thread to set up JSON data, but it is not working for me. This is my first time working with hardware, which is making things much more challenging. I am using the NXP Android library and the sample Android application from here: &lt;A href="https://www.nxp.com/design/design-center/software/rfid-developer-resources/taplinx-software-development-kit-sdk:TAPLINX" target="_new" rel="noopener"&gt;https://www.nxp.com/design/design-center/software/rfid-developer-resources/taplinx-software-development-kit-sdk:TAPLINX&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Below is my code inside Sample_Application_Android/src/main/java/com/nxp/sampletaplinx/WriteActivity.java&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;public&lt;/SPAN&gt; &lt;SPAN class=""&gt;static&lt;/SPAN&gt; &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] intTo2ByteArray(&lt;SPAN class=""&gt;int&lt;/SPAN&gt; value) {
    &lt;SPAN class=""&gt;return&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] {
            (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) (value &amp;amp; &lt;SPAN class=""&gt;0xFF&lt;/SPAN&gt;),        &lt;SPAN class=""&gt;// LSB&lt;/SPAN&gt;
            (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) ((value &amp;gt;&amp;gt; &lt;SPAN class=""&gt;8&lt;/SPAN&gt;) &amp;amp; &lt;SPAN class=""&gt;0xFF&lt;/SPAN&gt;), &lt;SPAN class=""&gt;// middle byte&lt;/SPAN&gt;
            (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) ((value &amp;gt;&amp;gt; &lt;SPAN class=""&gt;16&lt;/SPAN&gt;) &amp;amp; &lt;SPAN class=""&gt;0xFF&lt;/SPAN&gt;) &lt;SPAN class=""&gt;// MSB&lt;/SPAN&gt;
    };
}

&lt;SPAN class=""&gt;private&lt;/SPAN&gt; &lt;SPAN class=""&gt;void&lt;/SPAN&gt; &lt;SPAN class=""&gt;tag424DNACardLogic&lt;/SPAN&gt;&lt;SPAN class=""&gt;(INTAG424DNA ntag424DNA)&lt;/SPAN&gt; {
    &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] KEY_AES128_DEFAULT = &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] {
            (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;,
            (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;,
            (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;,
            (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;,
    };
    &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] NTAG424DNA_APP_NAME =
            {(&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) &lt;SPAN class=""&gt;0xD2&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) &lt;SPAN class=""&gt;0x76&lt;/SPAN&gt;, &lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, &lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) &lt;SPAN class=""&gt;0x85&lt;/SPAN&gt;, &lt;SPAN class=""&gt;0x01&lt;/SPAN&gt;, &lt;SPAN class=""&gt;0x01&lt;/SPAN&gt;};
    &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] data ={ &lt;SPAN class=""&gt;0x73&lt;/SPAN&gt;, &lt;SPAN class=""&gt;0x75&lt;/SPAN&gt;, &lt;SPAN class=""&gt;0x73&lt;/SPAN&gt;, &lt;SPAN class=""&gt;0x68&lt;/SPAN&gt;, &lt;SPAN class=""&gt;0x69&lt;/SPAN&gt;, &lt;SPAN class=""&gt;0x6C&lt;/SPAN&gt; };

    mStringBuilder.append(&lt;SPAN class=""&gt;"\n\n"&lt;/SPAN&gt;);
    &lt;SPAN class=""&gt;int&lt;/SPAN&gt; &lt;SPAN class=""&gt;timeOut&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;2000&lt;/SPAN&gt;;
    &lt;SPAN class=""&gt;try&lt;/SPAN&gt; {
        ntag424DNA.isoSelectApplicationByDFName(NTAG424DNA_APP_NAME);
        &lt;SPAN class=""&gt;KeyData&lt;/SPAN&gt; &lt;SPAN class=""&gt;aesKeyData&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;KeyData&lt;/SPAN&gt;();
        &lt;SPAN class=""&gt;Key&lt;/SPAN&gt; &lt;SPAN class=""&gt;keyDefault&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;SecretKeySpec&lt;/SPAN&gt;(KEY_AES128_DEFAULT, &lt;SPAN class=""&gt;"AES"&lt;/SPAN&gt;);
        aesKeyData.setKey(keyDefault);
       ntag424DNA.authenticateEV2First(&lt;SPAN class=""&gt;0&lt;/SPAN&gt;, aesKeyData, &lt;SPAN class=""&gt;null&lt;/SPAN&gt;);

        mStringBuilder.append(getString(R.string.Authentication_status_true));
        mStringBuilder.append(&lt;SPAN class=""&gt;"\n\n"&lt;/SPAN&gt;);

        ntag424DNA.setPICCConfiguration(&lt;SPAN class=""&gt;true&lt;/SPAN&gt;);

        &lt;SPAN class=""&gt;String&lt;/SPAN&gt; &lt;SPAN class=""&gt;jsonTemplate&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;"{\"uuid\":\"00000000000000\",\"counter\":\"000000\",\"cmac\":\"0000000000000000\",\"domain1\":"&lt;/SPAN&gt; + &lt;SPAN class=""&gt;1&lt;/SPAN&gt; + &lt;SPAN class=""&gt;",\"domain2\":"&lt;/SPAN&gt; + &lt;SPAN class=""&gt;1&lt;/SPAN&gt; + &lt;SPAN class=""&gt;"}"&lt;/SPAN&gt;;
        &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] jsonBytes = jsonTemplate.getBytes(&lt;SPAN class=""&gt;"UTF-8"&lt;/SPAN&gt;);

        &lt;SPAN class=""&gt;NTAG424DNAFileSettings&lt;/SPAN&gt; &lt;SPAN class=""&gt;fs&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;NTAG424DNAFileSettings&lt;/SPAN&gt;(
                CommunicationMode.Plain,  &lt;SPAN class=""&gt;// or MAC/ENC depending on your security&lt;/SPAN&gt;
                (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) &lt;SPAN class=""&gt;0x0E&lt;/SPAN&gt;, &lt;SPAN class=""&gt;// Read access: Key 0&lt;/SPAN&gt;
                (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) &lt;SPAN class=""&gt;0x0E&lt;/SPAN&gt;, &lt;SPAN class=""&gt;// Write access: Key 0&lt;/SPAN&gt;
                (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) &lt;SPAN class=""&gt;0x0E&lt;/SPAN&gt;, &lt;SPAN class=""&gt;// Read/Write: Key 0&lt;/SPAN&gt;
                (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;) &lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;  &lt;SPAN class=""&gt;// Change access: Free&lt;/SPAN&gt;
        );

        &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] type = &lt;SPAN class=""&gt;"U"&lt;/SPAN&gt;.getBytes(&lt;SPAN class=""&gt;"US-ASCII"&lt;/SPAN&gt;);
        fs.setSDMEnabled(&lt;SPAN class=""&gt;true&lt;/SPAN&gt;);
        fs.setUIDMirroringEnabled(&lt;SPAN class=""&gt;true&lt;/SPAN&gt;);
        fs.setSDMReadCounterEnabled(&lt;SPAN class=""&gt;true&lt;/SPAN&gt;);

        &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] bytes = &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] { (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0xE0&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt;, (&lt;SPAN class=""&gt;byte&lt;/SPAN&gt;)&lt;SPAN class=""&gt;0x00&lt;/SPAN&gt; };
        fs.setSdmAccessRights(bytes);

        &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] uuidOffset = intTo2ByteArray(&lt;SPAN class=""&gt;8&lt;/SPAN&gt;);

        fs.setUidOffset(uuidOffset);

        &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] readCounterOffset = intTo2ByteArray(&lt;SPAN class=""&gt;35&lt;/SPAN&gt;);
        fs.setSdmReadCounterOffset(readCounterOffset);

        &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[] macOffset = intTo2ByteArray(&lt;SPAN class=""&gt;51&lt;/SPAN&gt;);

        fs.setSdmMacInputOffset(uuidOffset);
        fs.setSdmMacOffset(macOffset);

        ntag424DNA.changeFileSettings(FILE_NUMBER, fs);

        &lt;SPAN class=""&gt;// Create NDEF record&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;NdefRecordWrapper&lt;/SPAN&gt; &lt;SPAN class=""&gt;record&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;NdefRecordWrapper&lt;/SPAN&gt;(
                NdefRecordWrapper.TNF_WELL_KNOWN,
                type,
                &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;byte&lt;/SPAN&gt;[&lt;SPAN class=""&gt;0&lt;/SPAN&gt;],  &lt;SPAN class=""&gt;// empty ID&lt;/SPAN&gt;
                jsonBytes     &lt;SPAN class=""&gt;// payload (your JSON)&lt;/SPAN&gt;
        );

        &lt;SPAN class=""&gt;// Wrap record into NDEF message&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;NdefMessageWrapper&lt;/SPAN&gt; &lt;SPAN class=""&gt;msg&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;new&lt;/SPAN&gt; &lt;SPAN class=""&gt;NdefMessageWrapper&lt;/SPAN&gt;(record);

        ntag424DNA.writeNDEF(msg);

        NxpLogUtils.save();
    } &lt;SPAN class=""&gt;catch&lt;/SPAN&gt; (Exception e) {
        writeFailedMessage();
        mStringBuilder.append(e.getMessage());

        Log.i(&lt;SPAN class=""&gt;"MainActivity"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"URI NDEF message written successful $msg "&lt;/SPAN&gt; + e.getMessage()  );
        showMessage(mStringBuilder.toString(), PRINT);
        NxpLogUtils.save();
    }

}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;would be great help if someone can assist me with this&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2025 03:56:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2171596#M208</guid>
      <dc:creator>sushil_adhikari</dc:creator>
      <dc:date>2025-09-18T03:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can i enable CMAC, UID, COUNTER and RAND in NTAG424 DNA?</title>
      <link>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2172171#M209</link>
      <description>&lt;P&gt;The issue was due to the wrong offset value. It seems ntag reserved 21 default index. Now we are trying to change factory 128 aes key and changekey() function didnt work for us&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/169705"&gt;@ukcas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2025 17:10:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/TapLinx-SDK-TagWriter-and/How-can-i-enable-CMAC-UID-COUNTER-and-RAND-in-NTAG424-DNA/m-p/2172171#M209</guid>
      <dc:creator>sushil_adhikari</dc:creator>
      <dc:date>2025-09-18T17:10:59Z</dc:date>
    </item>
  </channel>
</rss>

