Transmission protocol of IC Card (2)-Block Transfer Protocol T=1 "turn"

Source: Internet
Author: User

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

(3) Fault-tolerant operation

Let's take a look at the rule definition for fault tolerance.

* After the reset response, the first data block is sent from the terminal to the IC card, and can only be an I block or S block.

* If the terminal does not wish to use the IFSD initial value of 32Byte length, then an S block (IFS request) should be sent to the IC card, and the S block (IFS request) PCB should have a value CI to indicate a request to change the IFSD. The INF field contains a byte whose value represents the number of bytes required in the IFSD, and the value is 0x20-0xfe. The IC card should return an S block (IFS response) to the terminal, confirming that the terminal changes the size of the IFSD, where S block (
IFS response) The PCB should have the same value as the 0xe1,inf domain should have the same INF domain as the request to change the S block.

* If the IC card wishes to change the size of the IFSC set after the reset response, a s block (IFS request) should be sent to the terminal, and the S block (IFS request) PCB should have a value CI to indicate a request to change the IFSD. The INF field contains a byte whose value represents the number of bytes required in the IFSD, and the value is 0x10-0xfe. The terminal should return an S block (IFS response) to the IC card, confirming that the terminal changes the size of the IFSD, where S block (
IFS response) The PCB should have the same value as the 0xe1,inf domain should have the same INF domain as the request to change the S block.

* To change the node address, the first sad and dad issued by the terminal will be set to the value to be used during the entire card operation. If the node address is not used, it is set to zero.

* In the process of card operation, only the blocks that meet the above definitions can transfer to each other. The half-duplex block Transfer Protocol includes the transmission between the terminal and the IC card. When the sender has finished transmitting a complete block of data, it should switch to the receive state.

* When the receiver receives the same number of characters as the Len and EDC values, the receiver obtains the right to send.

* If the receiving party needs to confirm the block I sent by the sender, it should be indicated in the I block serial number that is sent back to the sending party. If a link is used, it is indicated in the serial number of the R Block (except for the last chunk of the link).

* If the I block serial number received in the response is different from the previous received I block serial number, the sender can assume that I has been confirmed. If I block is not previously received, the I block sequence number in the response should be 0.

* In the case of link, when the sequence number of the R Block received in the response is not the same as the confirmed I block serial number, the sender can assume that block I has been confirmed.

* If the IC card takes longer than BWT to process the received I block, a wait time extension request S block (WTX request) should be sent, one of which contains a 1Byte binary integer with a value of multiples of the requested BWT value. The terminal should send a wait-time expansion request with the same value in an INF block (WTX response) to indicate acknowledgment of the delay request. The time obtained starts from the rising edge of the last character of the S block (WTX response).

* s block is always paired, and a s request always corresponds to an s response block.

If the above definition is not met, the terminal and IC card will detect an error.

(4) Links

When the sender needs to transmit more data than the number of characters defined by IFSC and IFSD, it is divided into several contiguous blocks of I. Use the link function when transferring multiple I block data.

The link to block I is defined by the B6 bit encoding of the PCB.
B6=0 means the last piece of the chain.
B6=1 indicates that there are subsequent blocks of data behind

As a b6=1, any of the I blocks need to be confirmed by an R block.

If received correctly, the last data block on the chain corresponding to B6=0 will be confirmed by an I block. Otherwise, it will be confirmed by an R block.

* Link Rules

Both IC cards and TTL support links, and links can only be carried out in one direction, with the following rules.

A. When the terminal is the receiver, the terminal should be able to receive a set of linked blocks of blocks as long as each block from the IC card is less than ifsd bytes in length.

B. When the terminal is the receiver, if the IC card sends the length of block I is greater than IFSD, the terminal should send an R block to express the rejection, R block of the PCB b1~b4 bit value of 2.

C. When the IC card is the receiver, the IC card should be able to receive a set of linked I blocks as long as each block from the terminal is not longer than ifsd bytes.

D. When the IC card is the receiver, if the terminal sends a block length greater than Ifsd,ic card should be sent by sending an R block to indicate the rejection, R block of the PCB b1~b4 bit value of 2.

E. When the IC card is the sender, the IC card should be able to send each block length of less than ifsd bytes of link I block.

F. When the terminal is the sender, the terminal should be able to send a block of link I with a block length of less than ifsd bytes.

* Construction of link blocks

The C-APDU is contained in the INF domain of block I and is transferred from the TTL to the IC card. If a C-APDU is too long to fit in a block of data, it can be routed with several link blocks in the following way.

Block (1)
CLA INS P1 P2 LC Data data
Block (2)-Block (n-1)
Data data data
Block (N)
Data Data Data LC

If the data and status code sent back by the IC card are too long to fit in a block, it can be handled by several I blocks as described below.

Block (1)-Block (n-1)
Data data data
Block (N)
Data data Data SW1 SW2

The example only shows the INF domain of the link block for the command in one case. Each block also has a header field and a tail field. If the IC card is the sender, all link blocks should contain an INF domain with a length range of 1 to ifsd bytes. If the terminal is a sender, it contains an INF domain with a length range of 1 to IFSC bytes.

2.5 t= "1 protocol error detection and correction"

The TTL should be able to detect the following error:

* Transmission errors (illegal parity and EDC errors) or BWT timeouts;
* Synchronization offset (the number of characters in excess or insufficient);
* protocol error;
* Terminates the link block request.

Perform error recovery as follows:

Methods 1:ttl are corrected in the following order according to the technical methods described below.

* The re-hair of the block;
* The IC card contacts are in a stationary state.

Methods 2:ic cards are corrected in the following order according to the technical methods described below.

* The re-hair of the block;
* In an unresponsive state.

Error handling and corrections are to meet the following rules. In either case, when sending an R block, the low half byte must be given an appropriate value by definition.

A. When the first block received by the IC card after the reset answer is invalid, a r block should be sent back to TTL, b5=0 and Nad=0.

B. If any block sent by TTL does not receive an IC card response within BWT time, the TTL will end the card operation process by keeping the IC card's contacts in a stationary state.

C. If the invalid block of the response I block is received, the sender should send an R block, where the B5 bit is set to the number of the expected I block.

D. If the invalid block of the response R Block is received, the sender should resend the R block.

E. If the S (XX response) block of the response s block (XX request) is not received, the sender should resend an S (XX request) block.

F. If an invalid block is received in response to an S (xx response) block, the sender should emit an R block, which is set to the number of the next expected I block (B5 bit).

G. If the TTL sends a block three times in a row, or if the IC card sends a block twice in a row without a valid response, the TTL ends the card operation by keeping the IC card's contacts in a stationary state. If synchronization is required for some terminals, it can be synchronized by sending an S block (re-sync request) from the IC card to a valid response S block (and then request a response) before closing the card operation process.

H. Before transmission, if the receiver detects that the transmission is insufficient or exceeded, it should wait for a period of time (the maximum value of CWT and BWT is taken).

I. The IC card sends an S (IFS request) block for up to three consecutive times to obtain a valid S (IFS response) block from the TTL. After three unsuccessful attempts, the IC card enters the receiving state.

J. TTL generally actively sends an S (discard request) block. If the TTL receives an S (discard request) block from the IC card, the TTL ends the card operation by keeping the IC card's contacts in a stationary state.

It is important to note that in specific applications, terminals and IC cards are not necessarily required to support the trading stop function. If the terminal or IC card requires a trade stop, you can send a s block (discard the request), at this time, if the receiver does not support the transaction abort function, you may receive an invalid response, but the terminal will still end the operation of the card process.

Transmission protocol of IC Card (2)-Block Transfer Protocol T=1 "turn"

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.