OpenSC is a set of open source tools and libraries for smart cards which provides management of smart card (creation of PKCS#15 file structure and accessing smart cards using PKCS#11 API) . Smart Card or HSM (hardware security module) used for multiple purposes such as storage of cryptographic keys for web browser (Firefox) and email client (Thunder bird).
According to OpenSC web site, It supports following family of smart cards in the openSC package.
- OpenPGP Card
Smart Card Readers
Smart card reader used to access the data store in the file structure of smart card. Driver program for the CCID (Chip/Smart Card interface devices) smart card readers required to access the smart cards. Open source software's PCSC-Lite and OpenCT are providing drivers for smart card reader devices. However, PCSC-Lite is recommended for CCID readers. OpenCT supports non-standard smart cards on linux platform.
Installation of PCSC-Lite
PCSC package required libudev library, so install it by following command which is shown in the below figure.
# apt-get install libudev-dev
Download PCSC-lite package from alioth.debian.org website and extract it using following command. Downloading and extraction step is shown in the following figures.
# wget https://alioth.debian.org/frs/download.php/file/4126/pcsc-lite-1.8.13.tar.bz2
#tar -xf pcsc-lite-1.8.13.tar.bz2
Run following commands to install the PCSC lite package. These commands are used to install software's from source code on linux platform.
Installation of CCID drivers
CCID package is dependent on usb development library, install it using following command before CCID compilation from source.
# aptitude install libusb-1.0-0-dev
For the installation of CCID driver for usb readers, download CCID package from alioth.debian.org website and extract it using following command. Downloading and extraction is shown in the following figure.
# wget https://alioth.debian.org/frs/download.php/file/4111/ccid-1.4.18.tar.bz2
#tar -xf ccid-1.4.18.tar.bz2
Run configure, make and make install commands for the installation of package.
Installation of OpenCT Reader driver
OpenCT installation is also dependent on libltdl library, so following error appears during ./configure command.
Libltdl library is required for the successful compilation of openCT package. Installation process of library is shown in following figure.
Download OpenCT package from ftp.de.debian.org website and extract it using following command which is also shown in following figures.
# wget http://ftp.de.debian.org/debian/pool/main/o/openct/openct_0.6.20.orig.tar.gz
#tar -xf openct_0.6.20.orig.tar.gz
Run following commands for successful compilation of openCT package.
Installation of OpenSC
Now we will install open source tool for smart cards on linux distribution . OpenSC library supports smart cards of many vendors and can be installed on both linux and windows platforms.
OpenSC uses Openssl for certain cryptographic operation on Smart Cards, so that if Openssl development library does not installed then ./configure script of OpenSC package shows that Openssl is not supported. It is highlighted in the following figure.
# apt-get install libssl-dev
Download OpenSC package from cznic.dl.sourceforge.net website using wget utility.
#tar -xf opensc-0.14.0.tar.gz
After the successful installation of OpenSC software, now run opensc-tool command in the terminal. Following error will appear in the terminal about the loading issue of libopensc.so.3 library. Error shows that required library does not exist on desirable path for opensc-tool command.
We can use PC/SC and OpenCT supported smart card readers and OpenSC supported smart cards on Ubuntu system. As we have used sources of all required packages, so same steps will be used for other distributions
In this article, we focused on the usage of smart cards in Linux environment. We explained the installation of open source packages for smart cards readers and libraries for smart cards access. OpenSC is well-known open source project which provides the libraries for smart card access using PKCS#11. It is also used to perform cryptographic operation on smart cards using OpenSSL library.