OSX CryptoTokenKit SmartCard返回错误6d00 [英] OSX CryptoTokenKit SmartCard returned error 6d00

查看:258
本文介绍了OSX CryptoTokenKit SmartCard返回错误6d00的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CryptoTokenKit在OSX上读取智能卡的主文件,但是我总是收到状态字6d00作为响应.我还尝试通过一些修改来运行简单示例,但会遇到相同的错误.我的阅读器是金雅拓PC Twin阅读器.

I'm trying to read the master file of a smartcard on OSX using CryptoTokenKit but I always get statusword 6d00 as response. I also tried to run the trivial example with some modifications but get the same error. My reader is Gemalto PC Twin Reader.

如果您有任何解决建议,请告诉我.

Please let me know if you have any suggestion to fix it.

我正在使用以下代码:

    TKSmartCardSlot *slot = [self.smartCardManager slotWithName:slotName];
    TKSmartCard *card = [slot makeSmartCard];
    card.sensitive = YES;
    [card beginSessionWithReply:^(BOOL success, NSError *error)  {
        NSLog(@"%@", error);
        NSLog(@"Proto: %ld", card.currentProtocol);
        NSData *data = [CommonUtil dataFromHexString:@"3F00"]; //<3f00>
        NSLog(@"%@", data);
        [card sendIns:0xA4 p1:0x00 p2:0x00 data:data le:@0
                reply:^(NSData *replyData, UInt16 sw, NSError *error)
         {
             NSLog(@"Response: %@", replyData);
             if (error) {
                 if (error.code == TKErrorCodeCommunicationError) {
                     // set response error code.
                 }
                 NSLog(@"%@", error);
             }
         }];
    }];

推荐答案

这很愚蠢,但是在apdu中,如果没有成功代码90 00,则没有响应数据,le应该是nil.

It is silly, but in the apdu where no response data is expected without the success code 90 00, le should be nil.

[card sendIns:0xA4 p1:0x00 p2:0x00 data:nil le:nil
                reply:^(NSData *replyData, UInt16 sw, NSError *error)
         {
         }

这篇关于OSX CryptoTokenKit SmartCard返回错误6d00的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆