Transfer Protocol for IC Card (1)-Character Transfer Protocol t=0 "Go"

Source: Internet
Author: User

Transferred from: Http://bbs.ednchina.com/BLOG_ARTICLE_172022.HTM

In the asynchronous half-duplex transmission protocol, the main definition of the terminal for the implementation of Transmission control and special needs issued by the command and the processing of these commands.

Two protocols are defined in the transport protocol: the character Transfer Protocol (t=0) and The Block Transport Protocol (t=1). IC card can choose to support the T=0 protocol or T=1 protocol, the terminal generally supports both protocols. The TD1 in ATR specifies the transport protocol (t=0 or t=1) used in subsequent transmissions, assuming t=0 if the TD1 does not exist in the ATR. If the PTS process is not negotiated between the card and the terminal after the ATR (detailed details can refer to the ISO7816 related section), the protocol specified by the IC card will be adopted immediately after the reset response.

The transport protocol is defined according to the following model.

* Physical Layer
A bit exchange is defined, which is the public part of two kinds of protocols.

* Data Link Layer
This includes the following definitions:
Character frame, which defines the exchange of characters, is the public part of the two kinds of protocols;
Character Exchange at t=0
Error correction for t=0
Block Exchange at T=1
Error correction for T=1

* Transport Layer
The application-oriented message transmission for each protocol is defined.

* Application Layer
The content of the message exchange is defined according to the same application protocol.

1. Physical Layer

Both the physical layer and the word frame are used in the t=0 and t=1 protocols.

2. Data Link Layer

2.1 Characters Frame

See http://www.iccos.cn/scoscn/html/dev/2007-10-25dev44.html for all the message exchanges between the IC card and the terminal.

2.2 Character Protocol T=0

(1) Specific options--time allocation for t=0

In the reset response, the TC1 value in the ATR determines the minimum time interval between the starting bit of the two consecutive characters that the terminal sends to the IC card and between the 12~266 ETU.

The minimum time interval between two consecutive character start bits of an IC card sent to the terminal is 12etu.

The maximum time interval between the rising edge of the starting bit of any character sent by the IC card and the rising edge of the starting bit of the previous character sent by the IC card or terminal (the working Wait time) will be no more than 960xdxwi=9600 ETU (the set bit rate conversion factor D is the default and WI is the default value of 10).

The minimum time interval between the rising edge of the starting bit of two consecutive characters sent in the opposite direction is not less than 16etu.

It is important to note that the minimum time interval between the rising edge of the starting bit of two consecutive characters sent by the terminal to the IC card is controlled by the TC1 value, which can be less than the minimum allowable time interval (16 ETU) between the two consecutive characters sent.

(2) Command header

The command is issued by the Terminal application layer (Terminal application layer, or Tal) and includes a command header made up of 5Byte. Each command header consists of 5 contiguous bytes of CLA, INS, P1, P2, and P3.

* CLA (class Byte of the command Message) represents the class of commands.
* INS (instruction Byte of the command Message) represents the instruction code.
* P1 (Parameter 1) and P2 (Parameter 2) represent two additional parameters of the command.
* According to different ins,p3 (Parameter 3) indicate the byte length of the command sent to the IC card or expect the maximum data length of the IC card echo response.

For t=0, these bytes, together with the data sent by the command, form the command Transfer Protocol data unit (the command Transport Protocol data unit, referred to as C-TPDU), which commands the Application Protocol Data unit (order application Protocol Data Unit, referred to as C-APDU) to C-TPDU will be learned in subsequent articles.

The terminal Transport Layer (Terminal Transport layer, or TTL) transmits the command header to the IC card that sends 5Byte and waits for a process byte.

(3) Process byte

After the IC card receives the command header, a process byte is echoed back to the TTL. The process byte indicates to the TTL what to do next, and the corresponding relationship between its encoding and the TTL behavior is as follows:

Terminal response to process byte:

procedure byte value step
1 Same as INS byte value all remaining data will be transmitted by TTL or ready to receive all data from the IC card.
2 the same complement to the INS byte value the next data byte will be sent by TTL or ready to receive the next byte of data from the IC card.
3 0x60 TTL is provided based on additional work waiting time.
4 0x6x or 0x9x (except 0x60) TTL will wait for the next process byte or status code SW2.

In conditions 1, 2, 3, the TTL waits for another process byte after the operation completes.

In Scenario 4, after the second procedure byte or status code SW2 has been received, the TTL will do the following things.

* If the process byte is 0x61,ttl will send to the IC card a maximum length of 0xXX of the Get response command header, XX is the SW2 value.
* If the procedure byte is 0x6c,ttl will immediately re-send the command header of a command to the IC card, whose length is xx,xx is the value of SW2.
* If the process byte is 0x6x (except 0x60, 0x61, 0x6c) or 0x9x (that is, the state), the TTL will return the status code to TAL in response APDU and wait for the next C-APDU.

When exchanging commands and data between TTL and IC Card, TTL and IC card must know clearly the driver of data flow and I/O, that is, whether the terminal sends data to the IC card or the IC card sends the data to the terminal.

(4) Transmission of C-APDU

When the T=0 protocol is used, only the command data sent to the IC card or the C-APDU containing the IC card response data can be mapped directly to the C-TPDU. C-APDU that do not include data that does not echo, and C-APDU that require the IC card to receive data and send it to the IC card data, will be transmitted through the relevant transport rules.

2.3 t= "0 o'clock Error detection and correction"

If the character is not properly received or received correctly but the checksum is incorrect, the receiver shall send a low level signal to the I/O port for a duration of one or two ETU after the rising edge pulse of the starting bit of the character (10.5±0.2) ETU, indicating that an error occurred in the previous transmission.

Accordingly, the sender should detect the level state of the I/O port within the (11±0.2) ETU after the character start bit rises along the pulse, indicating that the character has been properly received if the I/O port is high state.

If the sender detects an error, it should delay at least 2 ETU after the error is detected, and send a repeat of the character with the wrong suspect, up to 3 times.

Transfer Protocol for IC Card (1)-Character Transfer Protocol t=0 "Go"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.