Seting Up Smart Card Support

You will need Java 6+ for this lab, either Sun Java or OpenJDK is just fine. Some other Java might work as well, but none except those two mentioned above is tested.

PC/SC driver and middleware should be installed by default on most Linux distros.

OpenSUSE

Make sure pcsc-lite and libpcsclite1 packages are installed (should be by default), re-install if needed.

Debian/Ubuntu

Make sure libpcsclite1 package is installed (should be by default), re-install if needed.

You will need a PC/SC Daemon to access the smart card:

  sudo apt-get install pcscd

You will also need to create a symlink to PC/SC library (find out why).

For Debian, run:

  sudo ln -s /usr/lib/libpcsclite.so.1 /usr/lib/libpcsclite.so

For Ubuntu, run:

  sudo ln -s /lib/libpcsclite.so.1 /usr/lib/libpcsclite.so

Testing

Option 1: compile and run this tool:

  javac CardReaderTest.java && java CardReaderTest

Option 2: install OpenSC and list available card readers:

  sudo apt-get install opensc
  opensc-tool --list-readers

In either of the cases you should get a list of readers available.

All done. Your Java program can now access smart cards.

Sidebar
Page edit