Using CardSession the NFC reader recieve 6A 81 when SELECT AID command is sent

Hello, I'm trying to use the CardSession sample code in an iPhone app I have received the HCE entitlement, the select identifier array contains only one AID of 8 bytes: FAEBDA5003020000, that is a custom AID that we use on ou custom access control system.

We have the complete control of the NFC reader, when we detect a MiFare card, the reader application send the SELECT AID command and the card number is return and checked We want to do the same with an iPhone instead of the MiFare card, so we use the CardSesion sample in our app, here is the log of the reader application when we present the iPhone on it:

TX: 0x04 0xfc 0xd4 0x4a 0x01 0x00 0xe1 0x00

RX: 0x00 0x00 0xff 0x00 0xff 0x00 ACK

RX: 0x00 0x00 0xff 0x11 0xef 0xd5 0x4b 0x01 0x01 0x00 0x04 0x20 0x04 0x08 0x10 0x53 0x17 0x05 0x78 0x80 0x71 0x00 0xc6 0x00

// SMARTPHONE NFC type 1

pn532InSelect

TX: 0x03 0xfd 0xd4 0x54 0x01 0xd7 0x00

RX: 0x00 0x00 0xff 0x00 0xff 0x00 ACK

RX: 0x00 0x00 0xff 0x03 0xfd 0xd5 0x55 0x00 0xd6 0x00 pn532InDataExchange

TX: 0x12 0xee 0xd4 0x40 0x01 0x00 0xa4 0x04 0x00 0x08 0xfa 0xeb 0xda 0x50 0x03 0x02 0x00 0x00 0x00 0x00 0x27 0x00

RX: 0x00 0x00 0xff 0x00 0xff 0x00 ACK

RX: 0x00 0x00 0xff 0x05 0xfb 0xd5 0x41 0x00 0x6a 0x81 0xff 0x00

we use the select application command and give our 8 bytes AID number: 0xfa 0xeb 0xda 0x50 0x03 0x02 0x00 0x00 the reader receives 6A 81 which means according to our apdu documentation: "Function not supported"

How can we make it work ?

Answered by jpderyck in 826485022

Hello, thank you for the advices The problem is now solved, it was an error in the select command, after the AID number (8 bytes in our case) the reader was adding two zero for the CRC, on Android device this was working but iOS requires that we compute a correct LRC. With the correct LRC value, the command is accepted by iOS device and we can exchange data. As the corrected command is also accepted by Android device, we have a solution that works for both

We typically see these problems due to timing problems when communicating with POS devices, where they send an APDU before they send a select command. iOS requires that the SELECT should arrive before any APDUs.

We also see that some readers select additional AIDs by default, and could be causing issues if yours does that. Also, the AID you have declared must be selected exactly as it stands. Shortened prefixes are not supported.

If you check these and can't find an issue, we will need to look at some proper logs from the iOS side.

First, please go to https://developer.apple.com/bug-reporting/profiles-and-logs/ and follow the instructions for Wallet for iOS to install a logging profile on your device.

Once that is installed, then reproduce the issue. Once reproduced, then follow the instructions at the above link to create a sysdiagnose

Then use the Feedback Assistant. to create a report and include a detailed description of the issue, details of the reader you are using, and the sysdiagnose from the above step.

Also include the following info:

  • What is the setup on the device. Including apple wallet settings
  • Please provide sample app if you have one, or can create one
  • the Bundle ID of the app you have tested this with
  • the exact time for a failed read

Then please post the FB number here for my reference, and @ tag me for visibility.

If you have any questions about filing a bug report, take a look at Bug Reporting: How and Why?


Argun Tekant /  DTS Engineer / Core Technologies

Accepted Answer

Hello, thank you for the advices The problem is now solved, it was an error in the select command, after the AID number (8 bytes in our case) the reader was adding two zero for the CRC, on Android device this was working but iOS requires that we compute a correct LRC. With the correct LRC value, the command is accepted by iOS device and we can exchange data. As the corrected command is also accepted by Android device, we have a solution that works for both

Using CardSession the NFC reader recieve 6A 81 when SELECT AID command is sent
 
 
Q