iOS:使用Grabba读取非接触式VISA智能卡数据

Olc*_*taş 5 credit-card apdu emv ios contactless-smartcard

我有一个Grabba智能卡读卡器.我试图通过APDU命令获取卡信息.我已经阅读了很多关于EMV标准和相关的ISO 7816-4标准,但是我无法成功执行简单的select命令.这是一些细节:

我已成功为我的VISA卡供电并获得其属性:

NSError *error = nil;
GRGrabbaSmartcardSession *session = [GRGrabba.sharedGrabba.smartcard startSession:&error];
NSLog(@"EMV : smartCardInsertedEvent : Attribute : %@", [session getATR]);
Run Code Online (Sandbox Code Playgroud)

结果: 3b690000 8072a445 6400ff00 10

当我在这里解析这个属性时,我得到了我的卡的这些信息:

属性解析器结果

我的非接触式卡是来自土耳其的Akbank的信用卡,但在此列表中列为土耳其的Denizbank卡.

现在我想在卡上运行一个select命令,如下所示:

NSError *error = nil;
GRGrabbaSmartcardSession *session = [GRGrabba.sharedGrabba.smartcard startSession:&error];
NSLog(@"EMV : smartCardInsertedEvent : Attribute : %@", [session getATR]);
session.protocol = 1;
uint8_t aid[] = {'2', 'P', 'A', 'Y', '.', 'S', 'Y', 'S', '.', 'D', 'D', 'F', '0', '1'};
NSData *data = [NSData dataWithBytes:aid length:sizeof(aid)];
NSError *err = nil;
GRGrabbaCommandAPDU *apduCMD =
        [[GRGrabbaCommandAPDU alloc]
                initWithCLA:0x00
                        INS:0xA4
                         P1:0x04
                         P2:0x00
                       Data:data
                         Le:0x00
                      Error:&err];

GRGrabbaResponseAPDU *response = [[GRGrabbaResponseAPDU alloc] initWithData:nil SW1:0 SW2:0];
BOOL success = [session exchangeAPDUCommand:apduCMD withResponse:response error:&error];

if (!success) {
    NSLog(@"EMV : smartCardInsertedEvent : ERROR: Could not read ADF");
    return;
}
Run Code Online (Sandbox Code Playgroud)

但它失败了无法读取ADF错误.谁能告诉我我做错了什么?

更新:

我尝试了以下组合,但仍然无法成功运行select命令:

PROTOCOL DATA           CLA     LE   STATUS
0        1PAY.SYS.DDF01 0x00    -    unrecognised SW in response: SW1 = 61, SW2 = 52
0        1PAY.SYS.DDF01 0x00    0x00 Smartcard protocol error.
0        2PAY.SYS.DDF01 0x00    -    unrecognised SW in response: SW1 = 61, SW2 = 66
0        2PAY.SYS.DDF01 0x00    0x00 Smartcard protocol error.
0        1PAY.SYS.DDF01 0x80    -    card returned Incorrect application CLA - SW1 = 6E, SW2 = 00
0        1PAY.SYS.DDF01 0x80    0x00 card returned Incorrect application CLA - SW1 = 6E, SW2 = 00
0        2PAY.SYS.DDF01 0x80    -    card returned Incorrect application CLA - SW1 = 6E, SW2 = 00
0        2PAY.SYS.DDF01 0x80    0x00 card returned Incorrect application CLA - SW1 = 6E, SW2 = 00
1        1PAY.SYS.DDF01 0x00    -    unrecognised SW in response: SW1 = 00, SW2 = 00
1        1PAY.SYS.DDF01 0x00    0x00 unrecognised SW in response: SW1 = 00, SW2 = 00
1        2PAY.SYS.DDF01 0x00    -    unrecognised SW in response: SW1 = 00, SW2 = 00
1        2PAY.SYS.DDF01 0x00    0x00 unrecognised SW in response: SW1 = 00, SW2 = 00
1        1PAY.SYS.DDF01 0x80    -    unrecognised SW in response: SW1 = 00, SW2 = 00 
1        1PAY.SYS.DDF01 0x80    0x00 unrecognised SW in response: SW1 = 00, SW2 = 00
1        2PAY.SYS.DDF01 0x80    -    unrecognised SW in response: SW1 = 00, SW2 = 00
1        2PAY.SYS.DDF01 0x80    0x00 unrecognised SW in response: SW1 = 00, SW2 = 00
Run Code Online (Sandbox Code Playgroud)

小智 1

我没有使用过 Grabba,并且不确定您是否以接触式或非接触式方式使用它,但由于您正在处理 T=0 卡,您可以尝试在不使用 Le 的情况下发出命令。