NFC NTAG424 DNA

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

NFC NTAG424 DNA

1,162件の閲覧回数
Shubham9494
Contributor I

Hi Everyone , I need to make a function which can communicate with NTAG 424 and can authenticate it also. I tried the but got length error 917E. Please take a look and help me on it where I did mistake.

Code is in android kotlin 

fun selectApdu(): ByteArray {
val cmd = "9071000002000000"
val selectaId = "D2760000850101"

val selectAID = byteArrayOf(
0xD2.toByte(), 0x76.toByte(), 0x00.toByte(), 0x00.toByte(),
0x85.toByte(), 0x01.toByte(), 0x01.toByte()
)
Log.i(TAG, "selectApdu: ${selectAID.size}")
try {
val commandApdu = ByteArray(11 + selectAID.size)
commandApdu[0] = 0x90.toByte() // CLA
commandApdu[1] = 0x71.toByte() // INS
commandApdu[2] = 0x00.toByte() // P1
commandApdu[3] = 0x00.toByte() // P2
commandApdu[4] = 0x02.toByte() // Lc (fixed at 2 bytes for the AID length)
selectAID.copyInto(commandApdu, 7)

// Replace the last three bytes
commandApdu[commandApdu.size - 3] = 0x00.toByte()
commandApdu[commandApdu.size - 2] = 0x00.toByte()
commandApdu[commandApdu.size - 1] = 0x00.toByte()
Log.e(TAG, "selectApdu: ${getByteArrayToString(commandApdu)}" )
return commandApdu
} catch (e: Exception) {
e.printStackTrace()
Log.e(TAG, "selectApdu: ${e.message}" )
return byteArrayOf()
}
}

Thanks in advance.

0 件の賞賛
返信
1 返信

1,114件の閲覧回数
KaiLi
NXP TechSupport
NXP TechSupport

Hello @Shubham9494 

Please refer to chapter 6 of AN12196 (https://www.nxp.com.cn/docs/en/application-note/AN12196.pdf) to implement your application.

BR

kelly