1

我有一個OmniKey 5321智能卡讀卡器和一臺裝有Debian的PC。下面的Python代碼讀取卡:在Python中讀取RFID卡中的唯一ID

from smartcard.CardMonitoring import CardMonitor, CardObserver 
from smartcard.util import * 
import sys 

class printobserver(CardObserver): 
    def update(self, observable, (addedcards, removedcards)): 
     for card in addedcards: 
      print "+Inserted: ", toHexString(card.atr) 
     for card in removedcards: 
      print "-Removed: ", toHexString(card.atr) 

try: 
    print "Insert or remove a smartcard in the system." 
    print "" 
    cardmonitor = CardMonitor() 
    cardobserver = printobserver() 
    cardmonitor.addObserver(cardobserver) 
    raw_input('Press Enter to exit\n') 
except: 
    print "Unexpected error: ", sys.exc_info()[0] 

的Python代碼運行正常,但給我回了很多卡是相同的ATR標籤。給定的ATR是:

3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6A

我怎麼能讀的東西從卡潮頭?我知道我必須發送一些命令,並且回覆將包含UID,但是如何找到命令?我將如何發送它們?

謝謝!

回答

3

一旦你連接到存儲卡(或實際讀者),你可以從閱讀器獲取卡的UID發送PC/SC規範的命令:

FF CA 00 00 00