智能卡读卡器的奇怪行为

时间:2015-07-26 08:27:36

标签: nfc smartcard smartcard-reader contactless-smartcard

我有一个CRT-603-CZ1智能卡读卡器,我想阅读经典的1k Mifare非接触式卡的16字节块4。验证密钥是defualt值(即0xFFFFFFFFFFFF)。所以我必须向读者发送3个命令,如下所示:

  1. 加载密钥APDU命令
  2. 验证APDU命令
  3. 读取数据块
  4. 上述手册中提到了相应的APDU命令。

    为了发送上述APDU命令,我使用了OpenSCTool,您可以看到以下结果:

    OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
    0410
    Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
    Failed to connect to card: Card is invalid or cannot be handled
    
    OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
    0410
    Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
    Sending: FF 82 00 00 06 FF FF FF FF FF FF
    Received (SW1=0x90, SW2=0x00)
    Sending: FF 86 00 00 05 01 00 04 60 00
    Received (SW1=0x90, SW2=0x00)
    Sending: FF B0 00 04 10
    Received (SW1=0x90, SW2=0x00):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    
    OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
    0410
    Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
    Failed to connect to card: Card is invalid or cannot be handled
    
    OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
    0410
    Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
    Sending: FF 82 00 00 06 FF FF FF FF FF FF
    Received (SW1=0x90, SW2=0x00)
    Sending: FF 86 00 00 05 01 00 04 60 00
    Received (SW1=0x90, SW2=0x00)
    Sending: FF B0 00 04 10
    Received (SW1=0x90, SW2=0x00):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    
    OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
    0410
    Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
    Failed to connect to card: Card is invalid or cannot be handled
    
    OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
    0410
    Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
    Sending: FF 82 00 00 06 FF FF FF FF FF FF
    Received (SW1=0x90, SW2=0x00)
    Sending: FF 86 00 00 05 01 00 04 60 00
    Received (SW1=0x69, SW2=0x83)
    Sending: FF B0 00 04 10
    Received (SW1=0x69, SW2=0x82)
    
    OpenSCTool:>
    

    如上所述,我尝试过这些命令不止一次。但我没有得到同样的答复。

    • 有时我收到错误" 无法连接到卡:卡无效或无法处理"
    • 有时,所有三个命令都会返回0x90000x90000x9000作为状态字。
    • 有时我会收到0x90000x69830x6982作为APDU回复状态字。

    请注意,在重复上述命令期间,我不会更改有关读卡器或卡的任何信息。一切都是固定的。

    出了什么问题?

    更新

    请注意,此阅读器具有适用于相同APDU命令的工具。看:

    enter image description here

    这些是日志部分的内容:

    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 
    
    SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00
    
    SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00
    

    如您所见,不同尝试的所有响应都是相同的。

    所以

    1. 我能否得出结论"读者没有问题,OpenSCTool"
    2. 存在问题
    3. 我该如何解决这个问题?
    4. 更新2:

      我使用PySCard库编写了一个Python程序,连续发送上述三个命令5次。并且所有五个系列都有成功的相等结果(即0x9000所有5 * 3 = 15个命令)。所以似乎OpenSCTool存在问题。但我不知道问题是什么以及为什么会这样回应。

0 个答案:

没有答案