【问题标题】:OSX CryptoTokenKit SmartCard returned error 6d00OSX CryptoTokenKit SmartCard 返回错误 6d00
【发布时间】:2015-07-04 12:46:26
【问题描述】:

我正在尝试使用 CryptoTokenKit 在 OSX 上读取智能卡的主文件,但我总是得到 statusword 6d00 作为响应。我还尝试通过一些修改运行trivial example,但得到相同的错误。我的阅读器是金雅拓 PC Twin Reader。

如果您有任何修复它的建议,请告诉我。

我正在使用以下代码:

    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);
             }
         }];
    }];

【问题讨论】:

  • Karim,您添加了一个新标签 cryptotokenkit。如果您认为它对社区有价值,请为其添加“关于”信息。否则,您可以将这个问题上的标签替换为有用的与密码学相关的标签,这可能会得到应有的关注。

标签: macos smartcard pcsc


【解决方案1】:

这很愚蠢,但是在没有成功代码90 00 的情况下没有响应数据的apdu 中,le 应该是nil

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

【讨论】:

    【解决方案2】:

    状态字 6D00 是“指令代码不支持或无效” http://www.cardwerk.com/smartcards/smartcard_standard_ISO7816-4_5_basic_organizations.aspx

    并非所有卡都允许选择主文件 (0x3F00)。

    【讨论】:

      猜你喜欢
      • 2013-11-30
      • 2016-06-05
      • 1970-01-01
      • 2014-09-24
      • 2016-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多