PCSC-Lite

From Gentoo Wiki
Jump to:navigation Jump to:search
Resources

PCSC-Lite implements the PC/SC international standard for PC to smartcard reader communication.

Installation

Kernel

The kernel configuration depends on how the card reader is connected:

  • For USB card reader see the USB article.
  • For PC-Card card reader see the PC-Card article.
  • For serial card reader enable serial support.

USE flags

Some packages are aware of the pcsc-lite USE flag.

USE flags for sys-apps/pcsc-lite PC/SC Architecture smartcard middleware library

+udev Use virtual/libudev rules to handle devices' permissions and hotplug support. Unless you know what you're doing do not disable this flag on Linux kernels. This is provided as an option for completeness.
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
embedded limit RAM and CPU ressources by disabling features
libusb Use dev-libs/libusb detection to hotplug new smartcard readers. This flag should only be enabled if you're running a non-Linux kernel or you don't want to use udev.
policykit Uses sys-auth/polkit to restrict access to smartcard readers or smartcards to given users.
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking

Emerge

Update the system so the changes can take effect:

root #emerge --ask --changed-use --deep @world

Install PCSC-Lite:

root #emerge --ask --noreplace sys-apps/pcsc-lite

Additional software

Install one or more of the following driver packages:

Configuration

USB card readers are detected automatically and work out of the box. For PC-Card and serial card readers, /etc/reader.conf.d/reader.conf will need to be adjusted. See man reader.conf for more information.

Service

OpenRC

With hotplug enabled, pcscd will start on plugging the card reader. It wil also start at boot time with the card reader already plugged.

* Hotplug support is provided by udev rules.
* When using OpenRC you additionally need to tell it to hotplug
* pcscd by setting this variable in /etc/rc.conf:
* 
*     rc_hotplug="pcscd"

With hotplug not enabled, pcscd needs to be started manually:

root #rc-service pcscd start

To start PCSC-Lite at boot time but without hotplug support, add it to the default runlevel:

root #rc-update add pcscd default
Note
The PCSC-Lite daemon blocks all detected card readers for every other software.

Testing

Start the daemon in debug mode manually:

root #/etc/init.d/pcscd stop
root #pcscd -a -d -f

The daemon will now output all detected card readers. If a card reader is not detected, the correct driver may not have been installed. If there is a detected card reader, insert a smartcard. The daemon should inform about this event and among other things output the ATR, e.g.:

CODE ATR
00000028 Card ATR: 3B 75 94 00 00 62 02 02 03 01

If everything works the daemon can be killed with Ctrl+C.

See also

  • OpenCT — a German standard for PC to smartcard reader communication, which is implemented by OpenCT.