| 1 |
USB CCID IFD Handler
|
| 2 |
====================
|
| 3 |
|
| 4 |
This package provides the source code for a generic USB CCID
|
| 5 |
(Chip/Smart Card Interface Devices) driver. See [1] for the USB CCID
|
| 6 |
specifications from the USB working group.
|
| 7 |
|
| 8 |
|
| 9 |
Authors:
|
| 10 |
========
|
| 11 |
|
| 12 |
- Ludovic Rousseau <ludovic.rousseau@free.fr>
|
| 13 |
- Carlos Prados for the PPS and ATR parsing code (taken from his
|
| 14 |
towitoto driver) in towitoko/ directory.
|
| 15 |
- Olaf Kirch for the T=1 TPDU code (from the OpenCT package) in openct/
|
| 16 |
directory. I (Ludovic Rousseau) greatly improved this code.
|
| 17 |
|
| 18 |
|
| 19 |
Supported CCID readers:
|
| 20 |
=======================
|
| 21 |
|
| 22 |
(in alphabetical order)
|
| 23 |
- Advanced Card Systems ACR 38 [16]
|
| 24 |
old versions of this reader have a bug: the reader do timeout when a
|
| 25 |
special USB frame is sent from the reader. If the frame size if a
|
| 26 |
multiple of wMaxPacketSize the communication is stopped.
|
| 27 |
- Cherry XX33 keyboard [?]
|
| 28 |
- Dell keyboard SK-3106 [?]
|
| 29 |
- Dell smart card reader keyboard [?]
|
| 30 |
- Gemplus GemPC 433 SL [2]
|
| 31 |
- Gemplus GemPC Key [3]
|
| 32 |
- Gemplus GemPC Twin [4]
|
| 33 |
- Kobil KAAN Base [19]
|
| 34 |
- Kobil KAAN Advanced [20]
|
| 35 |
- OmniKey CardMan 3121 [5]
|
| 36 |
- SCM Micro SCR 331 [6]
|
| 37 |
You shall upgrade the firmware [17] using version 5.18 or later.
|
| 38 |
- SCM Micro SCR 331-DI [11]
|
| 39 |
You shall upgrade the firmware [17] using version 6.22 or later.
|
| 40 |
- SCM Micro SCR 335 [7]
|
| 41 |
The firmware of this reader can't be upgraded so be sure to buy a
|
| 42 |
recent model with firmware 5.14 or later
|
| 43 |
- SCM Micro SCR 3310
|
| 44 |
- SCM Micro SPR 532 [9]
|
| 45 |
You shall contact Torsten Maykranz <tmaykranz@scmmicro.de> to get a
|
| 46 |
firmware upgrade.
|
| 47 |
|
| 48 |
|
| 49 |
Should work but untested by me:
|
| 50 |
===============================
|
| 51 |
|
| 52 |
I would like to get these readers to perform test and validation and
|
| 53 |
move them in the supported list above. If you are one of the
|
| 54 |
manufacturers, please, contact me.
|
| 55 |
|
| 56 |
- Cherry XX44 keyboard (SmartBoard G83-6744) [18]
|
| 57 |
- ActivCard USB reader 2.0 [10]
|
| 58 |
- C3PO LTC32 [13]
|
| 59 |
- SCM Micro SCR 333 [15]
|
| 60 |
- Silitek SK-3105 keyboard [12] or C3PO TLTC2USB [14]
|
| 61 |
|
| 62 |
|
| 63 |
Unsupported or partly supported CCID readers:
|
| 64 |
=============================================
|
| 65 |
|
| 66 |
- C3PO LTC31 [8]
|
| 67 |
The reader works fine with Linux kernel 2.4 but does not with Linux
|
| 68 |
kernel 2.6. The ioctl() syscall returns EINVAL (Invalid argument)
|
| 69 |
|
| 70 |
|
| 71 |
Supported operating systems:
|
| 72 |
============================
|
| 73 |
|
| 74 |
- GNU/Linux (libusb 0.1.7)
|
| 75 |
- MacOS X/Darwin (libusb 0.1.8beta, CVS snapshot. See "Known problems")
|
| 76 |
to libusb)
|
| 77 |
|
| 78 |
|
| 79 |
Debug informations:
|
| 80 |
===================
|
| 81 |
|
| 82 |
The driver uses the debug function provided by pcscd. So if pcscd sends
|
| 83 |
its debug to stdout (pcscd --foreground) then the CCID will also send
|
| 84 |
its debug to stdout. If pcscd sends its debug to syslog (by default)
|
| 85 |
then the CCID will also send its debug to syslog.
|
| 86 |
|
| 87 |
You can change the debug level using the Info.plist configuraion file.
|
| 88 |
The Info.plist is installed, by default, in
|
| 89 |
/usr/local/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist
|
| 90 |
|
| 91 |
The debug level is set in the ifdLogLevel field. It is a binary OR
|
| 92 |
combinaison of 4 different levels.
|
| 93 |
- 1: critical: important error messages
|
| 94 |
- 2: info: informative messages like what reader was detected
|
| 95 |
- 4: periodic: periodic info when pcscd test if a card is present (every
|
| 96 |
1/10 of a second)
|
| 97 |
- 8: comm: a dump of all the bytes exchanged between the host and the
|
| 98 |
reader
|
| 99 |
|
| 100 |
By default the debug level is set to 3 (1 + 2) and correspond to the
|
| 101 |
critical and info levels.
|
| 102 |
|
| 103 |
You have to restart the driver so it read the configuration file again
|
| 104 |
and use the new debug level value. To restart the driver you just need
|
| 105 |
to unplug all your CCID readers so the the driver is unloaded and then
|
| 106 |
replug your readers. You can also restart pcscd.
|
| 107 |
|
| 108 |
|
| 109 |
Known problems:
|
| 110 |
===============
|
| 111 |
|
| 112 |
MacOSX libusb
|
| 113 |
"""""""""""""
|
| 114 |
There is a bug in libusb that crash the libusb library when you
|
| 115 |
unplug a reader and replug it in another USB socket. So if you
|
| 116 |
unplug a reader replug it in the same USB socket.
|
| 117 |
|
| 118 |
see http://sourceforge.net/tracker/index.php?func=detail&aid=886778&group_id=1674&atid=101674
|
| 119 |
|
| 120 |
|
| 121 |
Licence:
|
| 122 |
========
|
| 123 |
|
| 124 |
This program is free software; you can redistribute it and/or modify
|
| 125 |
it under the terms of the GNU General Public License as published by the
|
| 126 |
Free Software Foundation; either version 2 of the License, or (at your
|
| 127 |
option) any later version.
|
| 128 |
|
| 129 |
This program is distributed in the hope that it will be useful, but
|
| 130 |
WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 131 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 132 |
General Public License for more details.
|
| 133 |
|
| 134 |
You should have received a copy of the GNU General Public License
|
| 135 |
along with this program; if not, write to the Free Software Foundation,
|
| 136 |
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 137 |
|
| 138 |
|
| 139 |
History:
|
| 140 |
========
|
| 141 |
|
| 142 |
0.9.2 - 15 August 2004, Ludovic Rousseau
|
| 143 |
- T=1 TPDU code:
|
| 144 |
. the work on T=1 TPDU code was possible thanks to Gemplus
|
| 145 |
validation team who helped me test, debug and bring the code to
|
| 146 |
an EMV validation level. Thanks to Jérôme, Jean-Yves, Xavier and
|
| 147 |
the Gemplus readers department
|
| 148 |
. error code was not checked correctly
|
| 149 |
. avoid a (nearly) infinite loop when resynch are needed.
|
| 150 |
. correctly initialise an internal value to allow more than one
|
| 151 |
reader to work
|
| 152 |
- multi-slots readers
|
| 153 |
. add support for multi-slots readers. The only one I have is a
|
| 154 |
SCM Micro SCR 331-DI with a contact and a contactless interface.
|
| 155 |
The contactless interface may or may not work for you since the
|
| 156 |
reader uses proprietary (undocumented) commands.
|
| 157 |
- GemPC Twin serial reader
|
| 158 |
. perform a command (get the reader firmware) to be sure a GemPC
|
| 159 |
Twin (serial or pcmcia) reader is connected
|
| 160 |
. use a dynamic timeout when reading the serial port.
|
| 161 |
The first timeout used when detecting the reader is 2 seconds to
|
| 162 |
not wait too long if no reader is connected. Later timeouts are
|
| 163 |
set to 1 minute to allow long time APDU.
|
| 164 |
- use `pkg-config libpcsclite --cflags` to locate the pcsc-lite
|
| 165 |
header files
|
| 166 |
- use `pkg-config --print-errors --atleast-version=1.2.9-beta5 libpcsclite`
|
| 167 |
to test the pcsc-lite version
|
| 168 |
- code improvements thanks to the splint tool (http://www.splint.org/)
|
| 169 |
|
| 170 |
0.9.1 - 1 July 2004, Ludovic Rousseau
|
| 171 |
- I forgot to define IFD_PARITY_ERROR in a .h file
|
| 172 |
|
| 173 |
0.9.0 - 1 July 2004, Ludovic Rousseau
|
| 174 |
- The T=1 TPDU automata from Carlos Prados' Towitoko driver is very
|
| 175 |
limited and do not support error management mechanisms.
|
| 176 |
I then used the T=1 TPDU automata from OpenCT (OpenSC project).
|
| 177 |
This automata is much more powerful but still lacks a lot of error
|
| 178 |
management code.
|
| 179 |
I then added all the needed code to reach the quality level
|
| 180 |
requested by the EMV standard.
|
| 181 |
- add support for new readers:
|
| 182 |
. Advanced Card Systems ACR 38
|
| 183 |
. Cherry XX33
|
| 184 |
. Dell keyboard SK-3106
|
| 185 |
. Dell smart card reader keyboard
|
| 186 |
. SCR 333
|
| 187 |
- add support of multi procotol cards (T=0 and T=1)
|
| 188 |
- the debug level is now dynamic and set in the Info.plist file (no
|
| 189 |
need to recompile the driver any more)
|
| 190 |
- add support for the libusb naming scheme: usb:%04x/%04x:libusb:%s
|
| 191 |
- INSTALL: add a "configuring the driver for the serial reader
|
| 192 |
(GemPC Twin)" part
|
| 193 |
- use `pkg-config libpcsclite --variable=usbdropdir` so you do not
|
| 194 |
have to use --enable-usbdropdir=DIR or --enable-ccidtwindir=DIR
|
| 195 |
even if pcscd does not use the default /usr/local/pcsc/drivers
|
| 196 |
- add support of IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE and
|
| 197 |
IOCTL_SMARTCARD_VENDOR_VERIFY_PIN in IFDHControl()
|
| 198 |
- read ifdDriverOptions from Info.plist to limit the use of
|
| 199 |
IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE (idea from Peter Williams)
|
| 200 |
- provide an example of use of SCardControl()
|
| 201 |
IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE and
|
| 202 |
IOCTL_SMARTCARD_VENDOR_VERIFY_PIN in example/
|
| 203 |
- add a --enable-pcsclite option (default to yes) so that the driver
|
| 204 |
can be compiled for a different framework (one needing
|
| 205 |
tokenparser.l like Solaris)
|
| 206 |
- Reset action is power off and power on, not just power on
|
| 207 |
- use the include files from pcsc-lite
|
| 208 |
- add a mechanism to allow power on at 1.8V, 3V and then 5V as
|
| 209 |
specified by ISO 7816. We still use 5V for now to avoid problems
|
| 210 |
with non ISO compliant cards
|
| 211 |
|
| 212 |
0.4.1 - 14 February 2004, Ludovic Rousseau
|
| 213 |
- distribute missing files readers/supported_readers.txt and
|
| 214 |
src/create_Info_plist.pl
|
| 215 |
'make install' failed because of this.
|
| 216 |
|
| 217 |
0.4.0 - 13 February 2004, Ludovic Rousseau
|
| 218 |
- support of T=1 with TPDU readers. A lot of the T=1 code comes from
|
| 219 |
Carlos Prados towitoko driver.
|
| 220 |
My code is GNU GPL, his code is GNU LGPL so the global driver is
|
| 221 |
GNU GPL
|
| 222 |
- PPS negotiation if the reader does not do it automatically
|
| 223 |
- add support for the Silitek SK-3105 keyboard. It's a USB device
|
| 224 |
with multiple interfaces
|
| 225 |
- use the create_Info_plist.pl script to generate the installed
|
| 226 |
Info.plist from an Info.plist template and a list of supported
|
| 227 |
readers. The Info.plist was too "complex" to maintain by hand
|
| 228 |
since it now contains 11 entries
|
| 229 |
- add support of IFDHCreateChannelByName to avoid wrong reader
|
| 230 |
enumeration. This is not complete if you have multiple _identical_
|
| 231 |
readers. You need to use a > 1.2.0 pcsc-lite version (not yet
|
| 232 |
released at that time)
|
| 233 |
- build but do not install the serial ccidtwin driver by default
|
| 234 |
since it is useless on computers without a serial port or without
|
| 235 |
this reader for example.
|
| 236 |
- read and write timeouts are not symmetric. write timout can be
|
| 237 |
shorter since the reader and card is not supposed to do anything
|
| 238 |
before receiving (write) a command
|
| 239 |
- do not try to find usb.h and other libusb files if
|
| 240 |
--disable-libusb is used. Needed if you only want to build the
|
| 241 |
serial driver. Thanks to Niki Waibel for the patch
|
| 242 |
- add a --enable-ccidtwindir argument to ./configure to specify the
|
| 243 |
serial GemPC Twin installation directory
|
| 244 |
- debug and code improvements and simplifications
|
| 245 |
|
| 246 |
0.3.2 - 4 November 2003, Ludovic Rousseau
|
| 247 |
- src/commands.c: correct a stupid bug that occurs with an APDU with
|
| 248 |
2 bytes response.
|
| 249 |
- Info.plist: add SPR 532 in list of supported readers
|
| 250 |
- parse.c: do not exit if the InterfaceClass is 0xFF (proprietary).
|
| 251 |
It is the case with old readers manufactured before the final
|
| 252 |
release of the CCID specs.
|
| 253 |
- move LTC31 reader from unsupported to supported reader list. It
|
| 254 |
was my f ault since in used odd INS byte in my test applet and odd
|
| 255 |
INS bytes are forbidden by ISO 7816-4 ch. 5.4.2 Instruction byte.
|
| 256 |
Thanks to Josep Moné s Teixidor for pointing the problem.
|
| 257 |
- src/commands.c: comment out the automatic GET RESPONSE part. I
|
| 258 |
don't think it should be in the driver. Maybe in pcscd instead?
|
| 259 |
|
| 260 |
0.3.1 - 23 September 2003, Ludovic Rouseau
|
| 261 |
- add --enable-multi-thread (enabled by default) for thread safe
|
| 262 |
support an APDU multiplexing. You will need pcsc-lite-1.2.0-rc3 or
|
| 263 |
above to use this feature.
|
| 264 |
- add --enable-libusb=PATH option is your libusb is not installed in
|
| 265 |
/usr or /usr/local
|
| 266 |
- honor DESTDIR in install rules (closes [ #300110 ]). Thanks to
|
| 267 |
Ville Skyttä for the patch.
|
| 268 |
- src/ccid.c: do not switch the GemPC Key and GemPC Twin in APDU
|
| 269 |
mode since it also swicth in EMV mode and may not work with non
|
| 270 |
EMV cards
|
| 271 |
- src/ccid_serial.c: complete reimplementation of the Twin serial
|
| 272 |
protocol using a finite state automata (code much simpler)
|
| 273 |
|
| 274 |
0.3.0 - 10 September 2003, Ludovic Rousseau
|
| 275 |
- support of GemPC Twin connected to a serial port. Thanks to Niki
|
| 276 |
W. Waibel for a working prototype.
|
| 277 |
- support of auto voltage at power up if the reader support it
|
| 278 |
instead of forcing a 5V in all cases.
|
| 279 |
- support of APDU mode instead of just TPDU if the reader support
|
| 280 |
it. Thanks to Jean-Luc Giraud for the idea and inspiration I got
|
| 281 |
from his "concurrent" driver.
|
| 282 |
- support of "time request" from the card.
|
| 283 |
- parse: new indentation for more readability of supported features.
|
| 284 |
- switch the GemPC Key and GemPC Twin in APDU mode since they
|
| 285 |
support it but do not announce it in the dwFeatures.
|
| 286 |
- new build process using autoconf/automake.
|
| 287 |
|
| 288 |
0.2.0 - 26 August 2003, Ludovic Rousseau
|
| 289 |
- Works under MacOS X
|
| 290 |
- Info.plist: use an <array></array> for the alias enumeration
|
| 291 |
- Makefile rework for *BSD and MacOS X
|
| 292 |
|
| 293 |
0.1.0 - 13 August 2003, Ludovic Rousseau
|
| 294 |
- First public release
|
| 295 |
|
| 296 |
|
| 297 |
Bibliography:
|
| 298 |
=============
|
| 299 |
|
| 300 |
[1] http://www.usb.org/developers/devclass_docs/ccid_classspec_1_00a.pdf
|
| 301 |
[2] http://www.gemplus.com/products/gempc433/
|
| 302 |
[3] http://www.gemplus.com/products/gempckey/
|
| 303 |
[4] http://www.gemplus.com/products/gempctwin/
|
| 304 |
[5] http://www.omnikey.com/en/produkt_details.php3?produkt=1&variante=47
|
| 305 |
[6] http://www.scmmicro.com/security/SCR331.html
|
| 306 |
[7] http://www.scmmicro.com/security/SCR335.html
|
| 307 |
[8] http://www.c3po.es/ltc31.html
|
| 308 |
[9] http://www.scmmicro.com/security/SPR532.html
|
| 309 |
[10] http://www.activcard.com/products/usb_reader.html
|
| 310 |
[11] http://www.scmmicro.com/security/SCR331-DI.html
|
| 311 |
[12] http://www.silitek.com/prod/getProduct.do?xml_id=4_2&menu_id=4_2_8&cid=1_8_5
|
| 312 |
[13] http://www.c3po.es/ltc32.html
|
| 313 |
[14] http://www.c3po.es/tltc2usb.html
|
| 314 |
[15] http://www.scmmicro.com/security/SCR333.html
|
| 315 |
[16] http://www.acs.com.hk/Product_Readers.asp?productID=59&PCate=Products_PC_Linked_SmartCard_Readers
|
| 316 |
[17] http://www.scmmicro.com/support/pcs_product_drivers.html
|
| 317 |
[18] http://www.cherrycorp.com/english/advanced-line/advanced-line_smartboard_g83-6744.htm
|
| 318 |
[19] http://www.kobil.com/e/products/smartcard/kaan-base.php
|
| 319 |
[20] http://www.kobil.com/e/products/smartcard/kaan-advanced.php
|
| 320 |
|
| 321 |
$Id$
|
| 322 |
|
| 323 |
vim:ts=20
|