ECO 5000 CT-API and PC/SC Driver
for Linux and Windows 9x/ME/2000/NT
© 2001 CardContact Software & System Consulting
If you have any problems with this package feel free to contact us at info@cardcontact.de.
There is a fully functional version of this driver already
included in this package. You do not need to recompile it yourself
(but you can).
The linux version is called libcteco5000.so.
The Windows version is located in the /windows directory
of this package and is called cteco5000.dll.
Take a look at the following sections how to install this driver on your operating system.
Linux
Extract the source files using tar -xzf eco5000-0.9.6. Change your directory to eco5000-0.9.6 and type make. If the compiler completes, login as root and type make install. This will copy the libcteco5000.so file into /usr/local/lib and the ctapi.h file to /usr/local/include . Either copy the supplied reader.conf to your /etc directory or edit the existing /etc/reader.conf accordingly.
Windows
Extract the source files using WinZip or any other program that
can handle compressed tar-files. Change your directory to
eco5000-x.y.z/windows and copy the file cteco5000.dll
to your Windows/system32 directory.
Note that this
driver does not support PC/SC under Windows because it does not run
in kernel mode.
If you want to build the driver by yourself: There
is a project for the Watcom compiler already included in this
package. So there should be no problems porting this to another
compiler like Visual C.
A small test file has been included, which can be used to test the
driver. It is called test or test.exe (for
windows).
Connect the ECO 5000 reader to your PC, insert a card
and type test 0 if your reader is connected to /dev/ttyS0 or COM1
(change parameter 0 accordingly). The program will reset the card,
display the ATR and issue a SELECT MF command.
The ECO 5000 driver has been tested with M.U.S.C.L.E PC/SC Lite Version 0.9.1. and above. It supports
Most T=0 and T=1 cards we could get our hands on.
Cards using the 2 Wire Bus Protocol, notably cards with the Siemens SLE 4432/4442 or Phillips PCF 2032 / 3042
Cards using the 3 Wire Bus Protocol, whereby cards using the Siemens SLE 4418 / 4428 are the only ones we know
Card using the Serial Data Access Protocol (SDAP or I2C), with support for cards with more than 2048 bytes
Memory cards are not yet fully supported by PC/SC. I you plan to use the driver with memory cards, we suggest using the CT-API programming interface.
Cards using the SDAP / I2C Protocol should have a header according to ISO 7816. This header is stored in the first four byte of the card and serves as replacement for the synchronous ATR provided by 2 Wire Bus and 3 Wire Bus cards. Common used header in the first 4 byte of a memory card are
ATR |
Card / Configuration |
---|---|
82 13 10 00 |
Serial Data Access Protocol (256 Byte) |
82 1B 10 00 |
Serial Data Access Protocol (512 Byte) |
82 23 10 00 |
Serial Data Access Protocol (1024 Byte) |
82 2B 10 00 |
Serial Data Access Protocol (2048 Byte) |
82 33 10 00 |
Serial Data Access Protocol (4096 Byte) |
82 3B 10 00 |
Serial Data Access Protocol (8192 Byte) |
92 23 10 00 |
3 Wire Bus Protocol (1024 Byte) |
A2 13 10 00 |
2 Wire Bus Protocol (256 Byte) |
As an extension to the MKT specification, the application may provide an alternate ATR as part of the REQUEST ICC or RESET ICC command. If such an alternate ATR is provided, then the ATR read from the card is discarded and the alternate ATR used instead to determine the transmission protocol parameter. This is in particular useful, if a memory card does not contain a valid ATR that defines card type and memory size.
The ECO 5000 driver implements a special command interface for synchronously operated memory cards. This interface uses ISO 7816/4 APDU commands and a mapping that translates the memory areas of the memory card into separate files. Each card contains ate least a Master File (MF) which can be selected using the SELECT FILE command. Once the MF is selected, the application may issue the READ BINARY or UPDATE BINARY commands to read or write the main memory area of the card. If the card uses a Programmable Security Code (PSC) then the application must use the VERIFY command to verify the PSC. The PSC can be changed using the CHANGE VERIFICATION DATA.
The following files can be selected using the SELECT FILE command
The main memory of the card starting with the byte at offset 0 and extending to the last byte in memory.
The directory file contains a single application identifier or a list of application identifier. The start of the EF_DIR is indicated on B7 - B1 in the fourth byte of the ATR (H4), if B8 of the same byte is set to 1. The length of the directory file is determined by the TLV coding of the field. For example a card containing
92 23 10 88 46 02 81 15 4F 06 D2 80 00 00 01 01 61 ...
has a directory file starting at offset 8 with a length of 8 bytes.
The ATR file contains various informations about the card production process. The content of the file is TLV coded. The file starts directly after the ATR (usually 4) and stops right before the directory file. A card containing
92 23 10 88 46 02 81 15 4F 06 D2 80 00 00 01 01 61 ...
has an ATR file starting at offset 4 with a length of 4 bytes.
The Siemens SLE4418, SLE4428, SLE 4432, SLE 4442, Phillips PCB 2032 and 2ß42 have a write protection for individual bytes in the main memory. Write protection is implemented as a bit map. Once a bit is written to 0, the associated byte in the main memory is irreversably write protected.
The SLE 4432/4442 and PCB 2032/2042 contain a 32 bit protection memory that covers the first 32 byte of the main memory. The SLE 4418 / 4428 contain 1024 bit protection memory.
The mapping between the protection memory and the main memory is bit to byte: The least significant bit in the first byte of protection memory addresses the first byte in main memory. The second bit of the first byte of protection memory addresses the second byte in main memory.
The memory can be read only.
The following commands can be used to access memory cards.
Select the file or application for subsequent READ BINARY or UPDATE BINARY commands.
|
SELECT FILE |
---|---|
CLA |
'00' |
INS |
'A4' |
P1 |
'00' - C-Data contains 2 byte File Identifier (FID) '04' - C-Data contains the Application Identifier (AID) |
P2 |
'00' |
Lc |
'02' if P1 == '00' length of Application Identifier (AID) if P1 == '04' |
C-Data |
FID or AID |
Le |
Empty |
R-Data |
Empty |
Read from the currently selected file.
|
READ BINARY |
---|---|
CLA |
'00' |
INS |
'B0' |
P1 |
MSB of offset |
P2 |
LSB of offset |
Lc |
Empty |
C-Data |
Empty |
Le |
Number of bytes to be read or '00' to read all (256 byte maximum). To read more than 256 bytes at a time, the Le field shall be encoded as extended format '00 00 00' |
R-Data |
Empty |
Write to the currently selected file
|
UPDATE BINARY |
---|---|
CLA |
'00' |
INS |
'D6' |
P1 |
MSB of offset |
P2 |
LSB of offset |
Lc |
Number of bytes contained in C-Data. '00' = 256 byte. To write more than 256 bytes at a time, the extended format shall be used. |
C-Data |
Data |
Le |
Empty |
R-Data |
Empty |
Verify the Programmable Security Code (PSC) for the SLE 4428, SLE 4442 or PCB 2042. The SLE 4428 uses a 16 bit PSC, all other chips have a 24 bit PSC.
|
VERIFY |
---|---|
CLA |
'00' |
INS |
'20' |
P1 |
'00' |
P2 |
'00' |
Lc |
Lenght of PSC in C-Data ('02' or '03') |
C-Data |
PSC |
Le |
Empty |
R-Data |
Empty |
Change the Programmable Security Code (PSC) for the SLE 4428, SLE 4442 or PCB 2042. The SLE 4428 uses a 16 bit PSC, all other chips have a 24 bit PSC.
|
CHANGE VERIFICATION DATA |
---|---|
CLA |
'00' |
INS |
'24' |
P1 |
'00' |
P2 |
'00' |
Lc |
Lenght of old and new PSC in C-Data ('04' or '06') |
C-Data |
Old PSC followed by the new PSC |
Le |
Empty |
R-Data |
Empty |