问题
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