To install openct, please do as user,
$ wget http://www.opensc.org/files/openct-0.6.4.tar.gz $ tar xfvz openct-0.6.4.tar.gz $ cd openct-0.6.4 $ ./configure --prefix=/usr --sysconfdir=/etc
This will install openct in /usr, but put the config file into /etc. The configure out put is quite long, with many tests for software, versions and so on. At the end a summary is printed, it should look like this:
OpenCT has been configured with the following options
User binaries: ${exec_prefix}/bin Configuration files: /etc Host: i686-pc-linux-gnu Compiler: gcc Compiler flags: -Wall -g -O2 Preprocessor flags: -I${top_builddir}/src/include -I${top_srcdir}/src/include Linker flags: Libraries: -lpthread PC/SC support: yes Libusb used: yes
To use usb tokens and readers, libusb support is highly recommended. PC/SC support is only useful, if you want to use openct drivers with applications other than opensc, using the pcsc-lite middleware. This author does only use openct with opensc and thus would not need PC/SC support.
$ make $ su root
and as root
# make install
will install all the files. In addition openct will need a directory of it's own, where it can save internal files and sockets. To create this directory, please do:
# mkdir /var/run/openct
At system boot, openct needs to create a status file and start a process for every permanent connected reader. For this you need to install the init script into /etc/init.d/ and create startup and shutdown symlinks.
# cp etc/init-script /etc/init.d/openct # ln -s ../init.d/openct /etc/rc0.d/K50openct # ln -s ../init.d/openct /etc/rc1.d/S50openct # ln -s ../init.d/openct /etc/rc2.d/S50openct # ln -s ../init.d/openct /etc/rc3.d/S50openct # ln -s ../init.d/openct /etc/rc4.d/S50openct # ln -s ../init.d/openct /etc/rc5.d/S50openct # ln -s ../init.d/openct /etc/rc6.d/K20openct
Openct also supports hotplugging. This however requires your linux kernel to support hot plugging too (CONFIG_HOTPLUG) and to have the linux hotplug utils installed. Both should be normal on any recent linux distributions. You need to install a "usermap" file, so the hotplug systems knows of all the readers openct supports. And you need to install a script, the hotplug system will execute this script, whenever a reader listed in the usermap is added or removed.
# cp etc/hotplug.openct /etc/hotplug/usb/openct # cp etc/openct.usermap /etc/hotplug/usb/openct.usermap
Finaly, openct needs a config file to work correctly.
# cp etc/openct.conf /etc/openct.conf
if you have serial readers (or anything else, not hotplugged), edit /etc/openct.conf and configure your reader. Here is an example for a Towitoko reader connected to the first serial port:
reader towitoko { driver = towitoko; device = serial:/dev/ttyS0; };
Now attach all those serial readers and start openct. Hotplug readers already attached will be found as well, but you can as well attach them later.
# /etc/init.d/openct start
now you can test it as user:
$ openct-tool list 0 Towitoko Chipdrive Micro 1 Schlumberger E-Gate
As you can see I have a normal, serial reader (Towitoko Chipdrive Micro) and one usb token. If I remove the usb token, it will no longer be listed. If I add a new token, the new one will show up:
$ openct-tool list 0 Towitoko Chipdrive Micro 1 Aladdin eToken PRO
I tested this on systems with several usb ports, too. But this "screen shot" is from a system with only one usb port, my old laptop.
If you have a card in the reader, you can get the answer to reset ("ATR"), which is a byte string containing some parameters, but can be used very well to identify a card. Default is reader 0, add "-r 1" to use reader 1.
$ openct-tool -r 1 atr Detected Aladdin eToken PRO Card present, status changed ATR: 3b e2 00 ff c1 10 31 fe 55 c8 02 9c
and similar commands. openct is ready.