After typing several months of bank statements into Gnucash once again, I decided it was time for HBCI homebanking. The first step was to find an affordable smartcard reader that was supported by linux.
The Cherry ST2000U was available at Amazon for 40 Euro (approx. 50$) and was on the list of supported devices of the ccid driver.
Anyway the installation was not straight-foward and I did not find an existing howto for this so I want to give a short overview of what I did to get the reader running.

Prerequisites

First I checked if I had all the correct USE flags set on my system. For HBCI homebanking the flag “hbci” is required. To use a crypto smartcard for gnupg the flag “smartcard” is also required.

I wanted to use the newest versions of all packages which are at the time of writing:

  • app-crypt/ccid-1.3.0
  • sys-apps/pcsc-lite-1.4.2
  • sys-libs/libchipcard-3.0.2
  • sys-libs/gwenhywfar-2.5.4

All of those packages are masked for x86, so the following lines have to be added to /etc/portage/package.keywords:

=app-crypt/ccid-1.3.0 ~x86
=sys-apps/pcsc-lite-1.4.2 ~x86
=sys-libs/libchipcard-3.0.2 ~x86
=sys-libs/gwenhywfar-2.5.4 ~x86

Now start the emerge by doing

emerge ccid libchipcard

Configuration

First of all we need to copy the default configs to the correct places. For usb readers not special configuration is needed:

cp /etc/chipcard3/server/chipcardd3.conf.example /etc/chipcard3/server/chipcardd3.conf
cp /etc/chipcard3/client/chipcardc3.conf.example /etc/chipcard3/client/chipcard3c.conf

The next step is to copy the ccid_ifd driver to the drivers directory of libchipcard:

cp /usr/lib/readers/usb/ifd-ccid.bundle/Contents/Linux/libccid.so.1.3.0 /usr/lib/chipcard3/server/lowlevel

Now check if the driver is found. Running chipcardd3 addreader –dtype list should list a lot of drivers. Most of them will be marked with [not installed] but the very first “ccid_ifd” should not have this label.

If the driver was found we can start the chipcard server for the first time - without attaching the card reader!
chipcardd3 –pidfile /var/run/chipcardd3.pid -f –loglevel debug –logtype console
After starting the daemon you may now attach the card reader. After a few moments chipcardd3 will print some debug lines while it detects the new hardware. The last line should look like this:

Device UsbRaw/046a/003e is not a known reader

Unfortunately the ccid driver lists the Cherry ST-2000U as a supported device but does not have it included in the config file. To change this open /usr/share/chipcard3/server/drivers/ccid_ifd.xml in an editor and look for the entry of the “Cherry ST-1044u”. The setup of the ST1044U and the ST2000U is identical, so we can simply copy that part and change the names and usb ids. Add the following lines right behind the ST-1044u entry:

<reader name=”ccid_cherry_st2000u” busType=”UsbRaw” addressType=”devicePath” devicePathTmpl=”usb:$(vendorId:04x)/$(productId:04x):libusb:$(busName):$(deviceName)” vendor=”0×046a” product=”0×003e” >
<short>Cherry ST-2000U</short>
<!–
<flags>
<flag>keypad</flag>
–>
</reader>

After saving, remove the card reader, restart the chipcard-daemon, attach the reader again and the output will show that the reader is detected and configured. As a last check you can run chipcard3-tool list. The output should look like this:

Server: 46583ef0
  Readers:
  - auto1-ccid_cherry_st2000u (ccid_cherry_st2000u, port 0)

That’s it, the reader works now. First thing I did was inserting my Geldkarte and running geldkarte3 loaded to see if the amount was correct ;-)