NTAG424 Authentication

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

NTAG424 Authentication

1,633件の閲覧回数
tusharv
Contributor I

I'm having issues with authenticating an NTAG424 tag in iOS. I tried using the command 9071000002000000 as the NXP documentation suggests but I keep getting a (Sw1 - 145 and Sw2 - 126 ) 917E length error message. Can you help me fix this? I've included my iOS Swift code for you to check.

I tried to change expectedResponseLength is 0 so it'll gave
Invalid expectedResponseLength value; should be from 1 to 65536 or -1.
Then I change it to -1 so it will gave same (Sw1 - 145 and Sw2 - 126 ) 917E.
Can you please help me in that I have also included my code snippet:


func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {

        guard let firstTag = tags.first else { return }

        session.connect(to: firstTag) { (error) in

            if case let .iso7816(tag) = firstTag {

                let instructionClass: UInt8 = 0x90

                let instructionCode: UInt8 = 0x71

                let p1Parameter: UInt8 = 0x00

                let p2Parameter: UInt8 = 0x00

                let data: Data = Data([0x02, 0x00, 0x00])

                let expectedResponseLength = -1

                 let command = NFCISO7816APDU(instructionClass: instructionClass, instructionCode: instructionCode, p1Parameter: p1Parameter, p2Parameter: p2Parameter, data: data, expectedResponseLength: expectedResponseLength)

                tag.sendCommand(apdu: command) { (response, sw1, sw2, error) in

                    guard error == nil else {

                        print("Error sending command: \(error!)")

                        return

                    }

 

                    print("Response: \(response)")

                    print("SW1: \(sw1), SW2: \(sw2)")

                }

            }

        }

    }

 

タグ(4)
0 件の賞賛
返信
1 返信

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

Hello @tusharv 

Please refer to Chapter 6 of AN12196 to modify your debugging code.

https://www.nxp.com.cn/docs/en/application-note/AN12196.pdf

BR

kelly

0 件の賞賛
返信