Operating System - Linux
1752772 Members
5203 Online
108789 Solutions
New Discussion

Re: Communicating with Smart card on Linux machine(Fedora 8)

 
Amar HR
New Member

Communicating with Smart card on Linux machine(Fedora 8)

I have a problem in communicating with Smart card on Linux machine,
the card im using is SLE-4428 and ACR38 is my card reader. In specific I have a problem with protocol which I am using for establishing connection with card. Is there a way to specify the
card type to the driver? Any help would be appriciated.

Code Snippet that I am executing is:

TerminalFactory factory = TerminalFactory.getDefault();
List terminals = factory.terminals().list();
terminal = (CardTerminal) terminals.get(0);
card = terminal.connect("T=0");

terminal.connect("T=0") statement is throwing an exception, details are as specified below:

javax.smartcardio.CardException: connect() failed

Caused by: sun.security.smartcardio.PCSCException: SCARD_E_PROTO_MISMATCH
at sun.security.smartcardio.PCSC.SCardConnect(Native Method)
at sun.security.smartcardio.CardImpl.(CardImpl.java:83)
at sun.security.smartcardio.TerminalImpl.connect(TerminalImpl.java:79)
... 22 more

The same code is working fine in Windows XP.
1 REPLY 1
Matti_Kurkela
Honored Contributor

Re: Communicating with Smart card on Linux machine(Fedora 8)

By a quick Googling, the "SCARD_E_PROTO_MISMATCH" seems to indicate the protocol you're using is not supported by the card.

The datasheet I found for the SLE-4428 card did not seem to mention the protocol(s) supported by the card.

Have you tried allowing the system to autodetect the card protocol? I.e.:

card = terminal.connect("*");

If this works, and your original code works _with the same card_ in Windows XP, it may be the Windows XP driver is ignoring the protocol specification from your program and using whatever protocol seems to be workable.

This might happen e.g. because the interface between Java and the native smartcard API of Windows might not allow (or implement) forcing a particular protocol. In Linux, the Java is using the PC/SC smart card interface; in Windows, the interface might be SCard COM.

Disclaimer: I don't know too much about smart card programming details; just Googling and browsing the docs...

MK
MK