-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
8u45, 9
-
x86_64
-
linux
A DESCRIPTION OF THE REQUEST :
Hi,
The current behavior of JRE is to look for the libpcsclite.so library in hardcoded locations:
"/usr/$LIBISA and /usr/local/$LIBISA, where $LIBISA is expanded to lib on 32-bit platforms, lib/64 on 64-bit Solaris platforms, and lib64 on 64-bit Linux platforms. " according to http://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html#SunPCSCProvider
The path to the library can also be provided by setting the sun.security.smartcardio.library property while starting the jre.
While this may look acceptable for standalone applications, it's not very convenient for java applets, because the end-user will typically not be able to set that property in the webpage calling the applet.
JUSTIFICATION :
I don't know for other linux distributions, but in Ubuntu, which is a widely used distribution, the libpcsclite.so library gets installed in /lib/x86_64-linux-gnu/ for 64 bit installations and in /lib/i386-linux-gnu/ for 32 bit installations.
This means that Ubuntu users will have difficulties to use java apps and applets using the Java Smart Card I/O API.
A better approach for the JRE would be to look for the dynamic library directories in /etc/ld.so.conf
That's where the dynamic linker looks too.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The JRE should look for the libpcsclite.so library in the usual directories (/usr/lib, /usr/local/lib, ...64) but also in the directories provided in /etc/ld.so.conf and in the environment variable LD_LIBRARY_PATH.
ACTUAL -
The JRE only looks in the usual directories (/usr/lib, /usr/local/lib, ...64).
---------- BEGIN SOURCE ----------
import javax.smartcardio.*;
public class Test {
public static void main(String[] args) {
try {
// show the list of available terminals
TerminalFactory factory = TerminalFactory.getDefault();
List<CardTerminal> terminals = factory.terminals().list();
System.out.println("Terminals: " + terminals);
// get the first terminal
CardTerminal terminal = terminals.get(0);
// establish a connection with the card
Card card = terminal.connect("T=0");
System.out.println("card: " + card);
CardChannel channel = card.getBasicChannel();
ResponseAPDU r = channel.transmit(new CommandAPDU(c1));
System.out.println("response: " + toString(r.getBytes()));
// disconnect
card.disconnect(false);
} catch(Exception e) {
System.out.println("Ouch: " + e.toString());
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Set the JRE property sun.security.smartcardio.library
or make symbolic links from the location where the JRE expects to find the files
Hi,
The current behavior of JRE is to look for the libpcsclite.so library in hardcoded locations:
"/usr/$LIBISA and /usr/local/$LIBISA, where $LIBISA is expanded to lib on 32-bit platforms, lib/64 on 64-bit Solaris platforms, and lib64 on 64-bit Linux platforms. " according to http://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html#SunPCSCProvider
The path to the library can also be provided by setting the sun.security.smartcardio.library property while starting the jre.
While this may look acceptable for standalone applications, it's not very convenient for java applets, because the end-user will typically not be able to set that property in the webpage calling the applet.
JUSTIFICATION :
I don't know for other linux distributions, but in Ubuntu, which is a widely used distribution, the libpcsclite.so library gets installed in /lib/x86_64-linux-gnu/ for 64 bit installations and in /lib/i386-linux-gnu/ for 32 bit installations.
This means that Ubuntu users will have difficulties to use java apps and applets using the Java Smart Card I/O API.
A better approach for the JRE would be to look for the dynamic library directories in /etc/ld.so.conf
That's where the dynamic linker looks too.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The JRE should look for the libpcsclite.so library in the usual directories (/usr/lib, /usr/local/lib, ...64) but also in the directories provided in /etc/ld.so.conf and in the environment variable LD_LIBRARY_PATH.
ACTUAL -
The JRE only looks in the usual directories (/usr/lib, /usr/local/lib, ...64).
---------- BEGIN SOURCE ----------
import javax.smartcardio.*;
public class Test {
public static void main(String[] args) {
try {
// show the list of available terminals
TerminalFactory factory = TerminalFactory.getDefault();
List<CardTerminal> terminals = factory.terminals().list();
System.out.println("Terminals: " + terminals);
// get the first terminal
CardTerminal terminal = terminals.get(0);
// establish a connection with the card
Card card = terminal.connect("T=0");
System.out.println("card: " + card);
CardChannel channel = card.getBasicChannel();
ResponseAPDU r = channel.transmit(new CommandAPDU(c1));
System.out.println("response: " + toString(r.getBytes()));
// disconnect
card.disconnect(false);
} catch(Exception e) {
System.out.println("Ouch: " + e.toString());
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Set the JRE property sun.security.smartcardio.library
or make symbolic links from the location where the JRE expects to find the files