Asad Khalid
Asad Khalid

Reputation: 1

ARDUINO: PN532 NFC reader for Google Wallet Passes

I am developing an app on arduino UNO using PN532 to read Google wallet passes via APDU commands. As a reference I am using Google-smart-tap

On the first command (SELECT VAS APPLET), I get a response like below:

Current APDU Response: 6F818450A416E64726F6964506179C0201C18CC00808080808080808080808080808080808080808080808080808080808080800C220008080808080808080808080808080808080808080808080808080808080808004901FF1000000110808080808080808080808080808080808080808080808080808080808080

Response Length: 137

, which is not accurate since there is no readable status word e.g., 9000 to indicate whether the request was successful or not. I was also expecting a Device Nonce in the response data but it's all covered by 8080. In the beginning of the response however I am still getting 'AndroidPay' (A416E64726F6964506179)

I am currently using the following command:

uint8_t SELECT_APDU[] = {
  0x00, // CLA: Class of instruction (ISO)
  0xA4, // INS: Instruction code for SELECT
  0x04, // P1: Select by name
  0x00, // P2: First or only occurrence
  0x0A, // Lc: Length of the AID (10 bytes)
  0x4F, 0x53, 0x45, 0x2E, 0x56, 0x41, 0x53, 0x2E, 0x30, 0x31, // AID for Universal VAS: 'OSE.VAS.01'
  0x00
};


void select_vas_applet(){
  
  uint8_t response[255];
  uint8_t responseLength = sizeof(response);
  bool success = nfc.inDataExchange(SELECT_APDU, sizeof(SELECT_APDU), response, &responseLength);
  if (success) {
    Serial.print("APDU Response: ");
    for (uint8_t i = 0; i < responseLength; i++) {
      Serial.print(response[i], HEX);
    }
    Serial.println();
    Serial.print("Response Length: ");
    Serial.println(responseLength);
    
    // Parse the response
    parseApduResponse(response, responseLength);
    //nfc.PrintHexChar(response, responseLength);
  } else {
    Serial.println("Not sent");
  }

}

An example response: 6F8184500A416E64726F6964506179C0020001C108CC00000000008080C220A3E37670D370E611C4B0E78352DE6762EF499B637DB652571576FAD8F8B548FAC3210289C8621B0AD2049D1D85EC61F8661CC4812900B2CD9197556D3836FE5AAAE95FA523BF0C20611E4F09A000000476D0000111870101730EDF6D020000DF4D020001DF6201039000

Upvotes: 0

Views: 24

Answers (0)

Related Questions