CT-BCS
Cardterminal basic command set for integrated circuit card applications.
- Provided by: libtowitoko-dev (Version: 2.0.7-9build1)
- Source: towitoko
- Report a bug
Cardterminal basic command set for integrated circuit card applications.
This manpage describes the subset of the Cardterminal Basic Command Set (CT-BCS) used to control cardterminals with one or more integrated circuit card slots, without key pad and display. This manpage is not a complete specification of the CT-BCS, but a general overview of the most common functionalities.
The CT-BCS commands are constructed in compliance with ISO/IEC 7816-4 interindustry commands and are used to control cardterminal utilizing the CT-API function CT_data().
A CT-BCS command is an array of bytes that is sent to the cardterminal to perform an administrative action. The CT-BCS response is an array of bytes returned by the cardterminal that informs of the completion status of the action requested.
The following diagram shows the general structure of a CT-BCS command:
|<------------------------------------------>| | Header (4 Bytes) and body | | (mandatory) (optional) | |<----------------->|<---------------------->| |___________________|________________________| |CLA |INS |P1 |P2 |Lc |Data |Le | |____|____|____|____|____|______________|____|
The following diagram shows the general structure of a CT-BCS response:
|<------------------------------>|<--------->| | Body Trailer | | (optional) (2 Bytes) | | (mandatory)| |________________________________|___________| |Data |SW1-SW2 | |________________________________|___________|
The fields within a CT-BCS command and response are equivalent to those defined by ISO/IEC 7816-4:
The address value 0x01 (CT) shall be used as destination address (dad) given to CT_data() when sending CT-BCS commands (See CT_data (3)).
The following commands are present in every CT-BCS implementation:
Basic CT commands
| Cardterminal Command | INS Code |
| RESET CT | 0x11 |
| REQUEST ICC | 0x12 |
| GET STATUS | 0x13 |
| EJECT ICC | 0x15 |
The following general return codes SW1-SW2 may occur:
General return codes
| SW1-SW2 | Description |
| 0x6700 | Wrong length |
| 0x6900 | Command not allowed |
| 0x6A00 | Wrong parameters P1, P2 |
| 0x6D00 | Wrong instruction |
| 0x6E00 | Class not supported |
Functional units are entities that can be addressed as target of CT-BCS commands. In some CT-BCS commands a target functional unit needs to be specified.
Functional units
| Functional Unit | Coding |
| CT kernel | 0x00 |
| CT/ICC slot 1 | 0x01 |
| CT/ICC slot 2 | 0x02 |
| CT/ICC slot 14 | 0x0E |
Support for slots 2-14 depends on the cardterminal. Functional units for keypad and display are defined for some cardterminals but are not described here.
The RESET CT command asks the cardterminal to perform a reset of the specified functional unit. If the functional unit is the CT kernel, a software reset is carried out, meaning that all status information (f.i. information of inserted cards) is cleared and gathered again. For ICC functional units, an card reset is performed.
Optionally the answer to reset of the functional unit is returned in the response data.
A RESET CT command can be issued after initialization of the cardterminal or after the occurrence of a communication error.
The command structure is as follows:
The response structure is as follows:
When functional unit is CT (0x00) the following status bytes can be returned:
When functional unit is a ICC slot (0x01 - 0x0E) the following status bytes can be returned:
The REQUEST ICC command asks the cardterminal to wait for the presence of an ICC on the specified cardterminal slot during a specified time limit. The command synchronously blocks the caller application unless time limit 0 is specified. When an ICC is presented it is automatically activated and reset.
The command structure is as follows:
The parameter P2 carries the request handling instructions for the CT. The value of P2 is constructed of two 4-bits subfields:
The response structure is as follows:
The following status bytes can be returned:
The GET STATUS command is used to gather cardterminal manufacturer information and ICC status information from the cardterminal. The information is represented by TLV (tag, length, value) encoded data objects. The tag of the data object to be retrieved is specified in the command and the value is returned in the response.
The command structure is as follows:
The response structure is as follows:
The following data objects are defined. Note that only value field is returned in the response:
The following status bytes can be returned:
The EJECT ICC command asks the cardterminal to deactivate the ICC. It must be used at the end of the communication with the card or when a irreparable communication error occur.
The command structure is as follows:
The response structure is as follows:
The following status bytes can be returned
ctapi (3).
The MKT (Multifunktionale KartenTerminals) specifications, available for download from Teletrust web site http://www.teletrust.de (link to URL http://www.teletrust.de) . In special the documents:
ISO/IEC 7816: Identification cards - Integrated circuit(s) cards with contacts:
This manual page was written by Carlos Prados <cprados@yahoo.com>.