Skip to main content

OpenSC installation under GNU|Linux

In this section, we are installing OpenSC with pcsc+libccid backend under a Debian / Ubuntu station.
You can adapt this tutorial to any GNU/Linux distribution.

You will need the following software:

  • pcsc and libccid = communication with smartcard reader.
  • OpenSC = smartcard drivers and PKCS#11 library.

Installing pcsc-lite + libccid

It is recommended to use the lastest libccid version available, here is why:

The Feitian R-301 reader and the Feitian ePass PKI token are recognized by libccid v 1.3.11. The ePass 2003 is recognized by libccid v1.4.4. The most recent version of libccid is version 1.4.6 at the time of writing.

It is recommended to use libccid >= 1.4.5.

You may install libccid binaries if you are running one of these recent distributions:

  • Debian sid / wheezy
  • Ubuntu lucid

If this is the case, run:

$ apt-get install pcscd pcsc-tools libccid libpcsclite1

Make sure to add your own user to the pcscd group:

$ adduser foo pcscd

Installing OpenSC

OpenSC official trunk is no longer actively maintained. Therefore we recommend to switch to OpenSC Secure Messaging branch, which includes most fixes. When OpenSC main branch becomes officially debrecated, the SM branch will probably become the main branch. This transition should take a few months.

Until then, GOOZE provides binaries from a build farm.

Feitian PKI and ePass PKI
You will need OpenSC >= 0.12.2.

If your system includes a recent version of OpenSC, simply install from binaries:

$ apt-get install opensc

If your system does not include a recent version of OpenSC, visit the collaborative build farm:
http://www.opensc-project.org/downloads/nightly/sm/linux/

If you need to compile from sources, read the section below.

Feitian ePass 2003
The driver for the ePass 2003 is being submitted back to OpenSC community for inclusion. It is part of OpenSC secure-messenging branch.

Binaries are available from:
http://www.opensc-project.org/downloads/nightly/sm/linux/

If you would like to compile OpenSC from sources, you need to have installed pkg-config, openssl (runtime and development), pcsc-lite (runtime and development), libltdl (runtime and development) packages.

Under Debian or Ubuntu, install in one command all libraries and tools needed to compile OpenSC:

$ apt-get build-dep opensc

If you are using an old version of Debian, this may result in an error. Type:

$ apt-get install debhelper libltdl-dev libssl-dev libreadline-dev libassuan-dev libxt-dev flex pkg-config

Fetch latest OpenSC source code:

$ git clone git://github.com/viktorTarasov/OpenSC-SM.git
$ cd OpenSC-SM
$ git checkout --track origin/secure-messaging
$ ./bootstrap

Make sure OpenCT and OpenSC binary packages are not installed:

$ apt-get remove openct libopenct1 opensc
$ dpkg --purge openct

Enter the directory of OpenSC and type as root:

$ mkdir /etc/opensc
$ ./configure --prefix=/usr --sysconfdir=/etc/opensc --enable-openssl --enable-sm
$ make
$ make install

Restart pcscd daemon for changes to take effect:

$ /etc/init.d/pcscd restart

Re: Installing from sources

That's a great manual.
It works fine, but I have found one misstake:

Installing opensc from sources the settings in the file opensc.conf have no effect, because the right path is /usr/etc/opensc.conf (OS: Ubuntu 9.10, clean system)

Installing opensc from binaries the path is correct. (OS: Ubuntu 10.04, clean system)

Greets Josef

Re: Installing from sources

Dear Josef. Thanks for your remarks. I added --sysconfdir=/etc to the configuration option. Kind regards. Jean-Michel

Re: Installing from sources using SVN

Hi all,
I ran into some trouble trying to install opensc from source (svn):

$ ./configure --prefix=/usr --sysconfdir=/etc --enable-openssl --disable-openct --enable-pcsc --with-
pcsc-provider=/usr/lib/libpcsclite.so

is giving me this error:

checking xsl-stylesheets... no
checking XSLTPROC requirement... ok
configure: error: xsl-stylesheets are required for svn build with man

I could not find any information about this xsl stuff..could somebody help me out?
My system : Ubuntu lucid 64bit

many thanks.

Re: Installing from sources using SVN

$ apt-get install build-essential pkg-config autoconf automake docbook-xsl

If you are using Lucid, you probably use libccid binaries.
So we can safely run: sudo apt-get build-dep opensc

This will install all depedencies needed to compile OpenSC, including libccid.

Re: OpenSC installation under GNU|Linux

I would not run these as root:

./bootstrap
./configure
make

You would normally only need to run make install as root.

Re: OpenSC installation under GNU|Linux

To install correct dependencies under Debian/Ubuntu:
apt-get build-dep opensc

Then
./configure --prefix=/usr --sysconfig-dir=/etc/opensc
make

Documentation updated for ePass2003!
Enjoy.

Kind regards, Jean-Michel

Re: OpenSC installation under GNU|Linux

I just downloaded Ubuntu 11.10 (oneiric) and installed it in a VM. Following the above instructions I get an error at the point where pkcs11-tool is linked. After a bit of searching, I found that the notes here helped:

https://github.com/viktorTarasov/OpenSC/commit/a467fc956ccf3601b19d30cc0...

At line 27 in src/tools/Makefile.am, put libpkcs11.a first in the list, like this:

pkcs11_tool_LDADD = $(top_builddir)/src/common/libpkcs11.la \
$(OPTIONAL_OPENSSL_LIBS) $(LTLIB_LIBS)

The build now completes and installs.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.