javax.smartcardio SCARD_SHARE_SHARED and SLEE4442 delay

自古美人都是妖i 提交于 2019-12-11 19:48:52

问题


With "javax.smartcardio.CardTerminal" I can't to connect smartcard with SCARD_SHARE_SHARED parameter...The method to connect has not that parameter...

public abstract Card connect(String protocol) throws CardException

Establishes a connection to the card. If a connection has previously established the specified protocol, this method returns the same Card object as the previous call. Parameters: protocol - the protocol to use ("T=0", "T=1", or "T=CL"), or "" to connect using any available protocol.*

Is there any way to perform that sharemode connecting smarcard with javax.smartcardio?

I have a delay problem connecting SLEE4442 smartcard (15-20 seconds after card is inserted) and I think that connecting with SHARED MODE may be the clue.


回答1:


With Java's SmartcardIO, connections to smartcards are opend with SCARD_SHARE_SHARED by default, so you should already be connected in shared mode.

You can then use Card.beginExclusive() to re-open that connection in exclusive mode (SCARD_SHARE_EXCLUSIVE).

Or you can open the connection in direct mode (SCARD_SHARE_DIRECT) using:

card = terminal.connect("direct");

But in that mode you would also need to manually set the communication protocol using IOCTL commands before you could send APDUs to the card.



来源:https://stackoverflow.com/questions/22334110/javax-smartcardio-scard-share-shared-and-slee4442-delay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!