简体   繁体   English

pcscd协议更改,但atr不更改

[英]pcscd protocol changes but atr does not

I've been working on hid omnikey 5325 cl and trying to get the ATR value. 我一直在研究隐藏的多功能键5325 cl,并试图获取ATR值。 I'm using pcscd and pyscard library on Ubuntu. 我在Ubuntu上使用pcscd和pyscard库。 System automatically gets the ATR using T0 protocol but I need RAW return. 系统使用T0协议自动获取ATR,但我需要RAW返回。 On windows using helloprox or omnikey's official software I can get what I need, but on ubuntu even though I've change the protocol but ATR does not change. 在使用helloprox或omnikey的官方软件的Windows上,我可以获得所需的信息,但是在ubuntu上,即使我已更改协议,但ATR不会更改。

here is the code I use: 这是我使用的代码:

class PrintObserver(CardObserver):

"""A simple card observer that is notified
when cards are inserted/removed from the system and
prints the list of cards
"""

def update(self, observable, actions):
    (addedcards, removedcards) = actions
    for card in addedcards:
       card.connection=card.createConnection()
       card.connection.connect(protocol=CardConnection.RAW_protocol)

    binary_atr=bin(int(toHexString(card.connection.getATR()).replace(" ",""), 16))

       binary_atr=binary_atr[len(binary_atr)-24:len(binary_atr)-1]
       print int(binary_atr,2)

    for card in removedcards:
        print "-Removed: ", toHexString(card.atr)


if __name__ == '__main__':
    cardmonitor = CardMonitor()
    cardobserver = PrintObserver()
    cardmonitor.addObserver(cardobserver)

#Get Ports
config=ConfigParser.ConfigParser()
config.read('../config.ini')
Read_Port=int(config.get('CardReaderSocketPorts','Read',0))
Write_Port=int(config.get('CardReaderSocketPorts','Write',0))

# Initialise socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_address = ('localhost', Read_Port)
return_address = ('localhost', Write_Port)
sock.bind(server_address)

while 1:
  message, address = sock.recvfrom(4096)
  if message:
    parsed_json=json.loads(message)

    #Single Line
    if parsed_json['set'].upper()=="Stop":
        sock.sendto('{"success":"True"}',return_address)        
        break


# don't forget to remove observer, or the
# monitor will poll forever...
cardmonitor.deleteObserver(cardobserver)

Some considerations, which may be helpful, even if they don't add to a full answer: 一些注意事项可能会有所帮助,即使它们并不能完全解决问题:

  • You are working with contactless cards or tags 您正在使用非接触式卡或标签
  • These tags have no ATR, but depending on the protocol something like ATQB or ATS, which is completely differently structured. 这些标签没有 ATR,但是取决于协议,例如ATQB或ATS,它们的结构完全不同。
  • PCSC is a dated software concept, which strictly requires an ATR PCSC是一种过时的软件概念,严格要求 ATR
  • So contactless reader manufacturers have to invent an ATR, based on the information they get from the card 因此,非接触式读卡器制造商必须根据从卡中获得的信息发明一种ATR
  • What your software receives as "ATR" is the result of this invention. 您的软件收到的“ ATR”是本发明的结果。
  • Omnikey apparently uses the Windows registry to control the invention process, which is obviously a non-portable approach. Omnikey显然使用Windows注册表来控制发明过程,这显然是一种不可移植的方法。

So my advice would be, to contact the Omnikey support, how to proceed from Linux. 因此,我的建议是,与Omnikey支持人员联系,如何从Linux开始。 According to my experience they are cooperative. 根据我的经验,他们是合作的。

After contacting the Omnikey support, the problem is solved. 联系Omnikey支持人员后,问题已解决。 As in developer guide I was looking for the config file "/etc/cmrfid.ini" to change the prox format. 开发人员指南中所述,我一直在寻找配置文件“ /etc/cmrfid.ini”来更改代理格式。 The file name was changed into "/etc/Omnikey.ini" 文件名已更改为“ /etc/Omnikey.ini”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM