1

I'm trying to simulate a mastercard contactless transaction using a Raspberry Pi with PN532 Chip and a smartwatch. The response from the SFI2 R2 contains the following CDOL1 data:

9F02069F03069F1A0295055F2A029A039C019F37049F35019F45029F4C089F34039F1D089F15029F4E14

which translates to:

TAG  LENGTH
9F02 06 
9F03 06
9F1A 02 
95   05 
5F2A 02 
9A   03 
9C   01 
9F37 04
9F35 01 
9F45 02 
9F4C 08
9F34 03 
9F1D 08 
9F15 02 
9F4E 14

I created the Get Application Cryptogram command following these specifications:

  byte_t get_app_crypto[] = {
    0x80, 0xAE, // CLA INS
    0x80, 0x00, // P1 P2
    0x43, // length
    0x00, 0x00, 0x00, 0x00, 0x01, 0x00, // amount
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // other amount
    0x06, 0x42, // terminal country 
    0x00, 0x00, 0x00, 0x00, 0x00, // tvr terminal
    0x09, 0x46, // currency code
    0x20, 0x08, 0x23, // transaction date
    0x00, // transaction type
    0x11, 0x22, 0x33, 0x44, // UN
    0x22, // terminal type
    0x00, 0x00,// data auth code
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // icc dynamic
    0x00, 0x00, 0x00, // cvm results
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // 8
    0x54, 0x11, // 2 merchant category
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 14 merchant name or location
    0x00, // LE
    };

but the response from the watch is always "6700" (wrong length).

Any help would be appreciated.

1 Answers1

0

AFAIR, your question looks like a problem that already had a resolution on SO. Generally, it's good to search.

Back to your issue, you interpreted 9F4E length as 14 decimal, but it simply is 0x14. You are six bytes short.

Michal Gluchowski
  • 1,197
  • 8
  • 16
  • I looked for the problem, but somehow I missed the fact that I misinterpreted the length. Thank you so much for the answer, everything works now. – Madalina Streche Aug 24 '20 at 13:25