IC card reader and its communication processing method

JP7900265B2Active Publication Date: 2026-08-04NIDEC INSTR CORP
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
NIDEC INSTR CORP
Filing Date
2022-11-18
Publication Date
2026-08-04

AI Technical Summary

Benefits of technology

【0016】 本発明によれば、RST端子での接触異常などが発生してリカバリ処理を行った結果、プロトコルレイヤでは通信がリカバリしたがアプリケーションレイヤでの異常データとなるときに、その異常を検出して異常データが上位装置に送られないようにすることができる。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007900265000001
    Figure 0007900265000001
  • Figure 0007900265000002
    Figure 0007900265000002
  • Figure 0007900265000003
    Figure 0007900265000003
Patent Text Reader

Abstract

To provide an IC card reader which is connected to a host device and which, when communication is recovered at a protocol layer and data is abnormal at an application layer at the time of occurrence of abnormal contact at an RST terminal of an IC card, prevents the abnormal data from being transmitted to the host device.SOLUTION: A communication processing method of an IC card reader includes: determination of whether a block received from an IC card during communication with the IC card is ATR indicating that the IC card recovers from reset on the basis of a command from a host device (step 105); execution of such processing that the IC card is deactivated when the received block is ATR (step 106); and termination of reception processing as abnormal termination (step 107).SELECTED DRAWING: Figure 3
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an IC card reader that communicates with a contact-type IC card and reads data from the IC card, and a communication processing method therefor.

Background Art

[0002] An IC card (also called a smart card), which is a card-shaped medium incorporating an integrated circuit or the like, can be either a contact type or a non-contact type. At a predetermined position on the surface of a contact-type IC card, a plurality of external contact terminals for communicating with the outside are provided. The external contact terminals include a VCC (power supply) terminal, a GND (ground) terminal, a CLK (clock) terminal, an I / O (data input / output) terminal, and in addition, a RST (reset) terminal. An IC card reader that communicates with a contact-type IC card and reads data from the IC card is provided with an IC contact block having contact pins that can be electrically contacted with the external contact terminals on the IC card side. When an IC card is inserted into the IC card reader, the contact pins of the IC contact block are electrically contacted with the external contact terminals of the IC card, enabling communication between the IC card reader and the IC card. The shape, dimensions, etc. of the IC card are defined by the ISO / IEC 7816 standard. In particular, the communication protocol between the IC card reader and the IC card is defined by the ISO / IEC 7816-3 standard or the EMV Level 1 standard.

[0003] When an IC card reader communicates with a contact-type IC card, the contact pins of the IC card reader and the external contact terminals of the IC card must maintain contact. However, repeated insertion and removal of the IC card from the reader can wear down the surface of the external contact terminals of the IC card, causing a contact abnormality between the contact pins of the IC card reader and the external contact terminals of the IC card, resulting in a communication error between the IC card reader and the IC card. Communication errors can also occur if foreign matter such as dust adheres to the contact pins or external contact terminals. In particular, the RST terminal needs to maintain a high voltage during communication, and if the voltage of the RST terminal changes to a low level, the IC card will be unintentionally reset, resulting in data abnormalities as described later. As a technique to avoid problems caused by contact abnormalities at the RST terminal, there is a technique to reliably reset the IC card at the start of power supply voltage to the IC card. Patent Document 1 discloses a technique that releases the reset state inside the IC card when a transition from a low level to a high level of voltage at the reset terminal is detected after the power supply voltage exceeds a predetermined value. [Prior art documents] [Patent Documents]

[0004] [Patent Document 1] Japanese Patent Application Publication No. 4-165513 [Overview of the project] [Problems that the invention aims to solve]

[0005] According to the EMV Level 1 standard (hereinafter referred to as the EMV standard), if a communication error occurs when an IC card reader and an IC card are communicating using the T=1 protocol communication method defined in the standard, a recovery process is supposed to be performed to restore communication. However, if a communication error occurs due to a contact abnormality at the RST terminal, and a recovery process is subsequently performed, the protocol layer may appear to have restored communication, but the application layer of higher-level devices such as the host device to which the IC card reader is connected may show abnormal data such as data loss.

[0006] The object of the present invention is to provide an IC card reader and a communication processing method that can detect when a contact abnormality occurs at the RST terminal and, as a result of recovery processing, communication is recovered at the protocol layer but abnormal data is generated at the application layer, and prevent that abnormal data from being sent to a higher-level device. [Means for solving the problem]

[0007] A card reader according to one aspect of the present invention is an IC card reader connected to a host device for reading data from a contact-type IC card, comprising: contact pins electrically connected to the external contact terminals of the IC card; and control means that, when communicating with the IC card via the contact pins based on a command from a host device, determines whether a block received from the IC card is an Answer To Reset (ATR) block indicating that the IC card has recovered from a reset, and terminates the reception process as an abnormality when it is determined to be an ATR block.

[0008] In one embodiment of the card reader, the reception process is terminated as an error when the block received from the IC card is an ATR block, thereby preventing the transmission of error data to the higher-level device due to an unintended reset of the IC card.

[0009] In one embodiment, the IC card reader preferably operates in accordance with the T=1 protocol communication method specified in the EMV standard. In this case, the control means preferably determines that a block is an ATR block when the first byte of the block received from the IC card is 3BH or 3FH. In the T=1 protocol communication method, the first byte of a normal received block is usually 00H, while the first byte of an ATR block is 3BH or 3FH. Therefore, by determining whether a block is an ATR block based only on the first byte of the received block, it becomes unnecessary to read the entire ATR block and perform processing for determination.

[0010] In one embodiment of the IC card reader, it is preferable that the control means execute a process to deactivate the IC card when the reception process is terminated as an abnormality handling process. By performing the deactivation process, damage to the IC card can be prevented.

[0011] A communication processing method according to one aspect of the present invention is a communication processing method for an IC card reader connected to a host device to read data from a contact-type IC card, comprising: a transmission step of transmitting a block to the IC card based on a command from the host device; a reception step of receiving a block that is a response to the block transmitted in the transmission step; an ATR determination step of determining whether the block received in the reception step is an ATR block indicating that the IC card has recovered from a reset; and a termination step of terminating the reception process as an abnormality process when it is determined in the ATR determination step that the block is an ATR block.

[0012] In one embodiment of the communication processing method, the reception process is terminated as an error when the block received from the IC card is an ATR block, thereby preventing the transmission of error data to the higher-level device due to an unintended reset of the IC card.

[0013] In one embodiment of the communication processing method, transmission and reception are performed based on the T=1 protocol communication method defined in the EMV standard, and in the ATR determination step, it is preferable to determine that a block is an ATR block when the first byte of the block received in the reception step is 3BH or 3FH. In the T=1 protocol communication method, the first byte of a normal received block is usually 00H, while the first byte of an ATR block is 3BH or 3FH. Therefore, by determining whether a block is an ATR block based only on the first byte of the received block, it becomes unnecessary to read the entire ATR block and perform the ATR determination step.

[0014] In one embodiment of the communication processing method, it is preferable to perform a process to deactivate the IC card in the final step. By performing the deactivation process, damage to the IC card can be prevented.

[0015] In one embodiment of the communication processing method, it is preferable to further provide a reception determination step after the reception step to determine whether reception was successful, and to perform an ATR determination step when the reception determination step determines that reception is abnormal. By performing the ATR determination step when reception is abnormal, the processing time when reception is successful can be shortened. In this case, it is also preferable to send a retry block to the IC card when the ATR determination step determines that it is not an ATR block. By sending a retry block when it is determined that it is not an ATR block, it becomes possible to perform recovery processing when reception abnormalities occur due to factors other than unintended reset of the IC card. [Effects of the Invention]

[0016] According to the present invention, when a contact abnormality occurs at the RST terminal and recovery processing is performed, resulting in communication recovery at the protocol layer but abnormal data at the application layer, it is possible to detect the abnormality and prevent the abnormal data from being sent to a higher-level device. [Brief explanation of the drawing]

[0017] [Figure 1] (a) is a block diagram showing an IC card reader according to one embodiment of the present invention, and (b) is a plan view of an IC card. [Figure 2] This is a sequence diagram illustrating the communication between the host device, the IC card reader, and the IC card. [Figure 3] This is a flowchart showing the operation of an IC card reader. [Modes for carrying out the invention]

[0018] Next, embodiments for carrying out the present invention will be described with reference to the drawings. Figure 1(a) shows an IC card reader 10 according to one embodiment of the present invention, and Figure 1(b) shows an IC card 20 that is the target of data reading by the IC card reader 10.

[0019] The IC card reader 10 is connected to a host device 30, which is a higher-level device, and mediates data exchange between the host device 30 and the IC card 20 by performing protocol layer processing when an application program running on the host device 30 requires access to the IC card 20. The IC card reader 10 includes a processor 11 that controls the overall operation of the IC card reader 10, an interface unit 12 that constitutes a signal interface to the IC card 20, and an IC contact block 13 that has contact pins that can be electrically connected to the external contact terminals C1 to C8 of the IC card 20, which will be described later. The processor 11 corresponds to the control means and consists of, for example, a microprocessor unit (MPU), a microcomputer, or a CPU (central processing unit), and is connected to the IC contact block 13 via the interface unit 12. The processor 11 receives commands from the host device 30, performs protocol conversion of those commands and sends them to the IC card 20, receives response data from the IC card 20, performs protocol conversion of that data and sends it to the host device 30. By inserting the IC card 20 into the IC card reader 10 and bringing the IC contact block 13 into contact with the IC card 20, the contact pins of the IC card reader 10 and the external contact terminals C1 to C8 of the IC card 20 make electrical contact, enabling communication between the IC card reader 10 and the IC card 20. In this embodiment, the IC card reader 10 communicates with the IC card 20 using the T=1 protocol communication method of the EMV Level 1 standard. In the T=1 protocol communication method, communication is performed using an asynchronous half-duplex block transfer protocol.

[0020] The IC card 20 has its dimensions and other aspects defined by the ISO / IEC 7816 standard. On its surface, eight external contact terminals C1 to C8 are provided to form an external contact terminal group 21 at the positions defined by the standard. Among the eight external contact terminals C1 to C8, C1 is the VCC (power supply) terminal, C2 is the RST (reset) terminal, C3 is the CLK (clock) terminal, C5 is the GND (ground) terminal, and C7 is the I / O (data input / output) terminal. Usually, these five external contact terminals C1, C2, C3, C5, and C7 are used for communication between the IC card reader 10 and the IC card 20.

[0021] Before explaining the operation of the IC card reader 10 in this embodiment, it will be explained in detail that when the IC card 20 is reset during communication due to an abnormal contact of the RST terminal or the like, although the protocol layer recovers the communication, the application layer may receive abnormal data.

[0022] Figure 2 shows the data exchanged when communication is carried out between the host device 30, the IC card reader 10, and the IC card 20 using the T=1 protocol communication method of the EMV standard. in time series. The T=1 protocol communication method is a half-duplex serial communication method that uses block transfer. In the figure, the content of the data transferred by each block is shown within a square frame. The character string within the square frame shows the values of each byte constituting the block in hexadecimal notation. "★" indicates the check digit. "[J]" to "[N]" indicate byte sequences of appropriate lengths. In this specification, when expressing 1-byte data or values, hexadecimal notation is used, and to indicate that it is hexadecimal notation, "H" is added as a subscript. In Figure 2, I(x,y), R(0), and R(1) represent the transferred blocks according to the notation defined in the EMV standard for the T=1 protocol communication method. In particular, in the notation of I(x,y), x is the sequence number, and y is the presence or absence of chaining (1 = present, 0 = absent). The sequence number x changes as 0→1→0→1→…. Also, in any block represented by I(x,y), R(0), or R(1), the first byte is always 00H. In the transfer blocks represented by I(x,y), R(0), and R(1), the second byte indicates what type of block it is, and the third byte indicates the byte length of the subsequent data (excluding the check digit). P1 to P18 in the figure indicate the order in a series of sequences.

[0023] The APDU (Application Protocol Data Unit) protocol is used for data transfer between the host device 30 and the IC card reader 10, and the TPDU (Transport Protocol Data Unit) protocol is used for data transfer between the IC card reader 10 and the IC card 20. Therefore, the processor 11 of the IC card reader 10 performs protocol conversion between APDU and TPDU.

[0024] First, at P1, the host device 30 sends a command to the IC card reader 10 that is represented as "CI9" in the IC communication command of the IC card reader. The IC card reader 10 converts from APDU to TPDU and, at P2, transfers it to the IC card 20 as a block represented as I(0,0). In the I(0,0) block transferred to the IC card 20 at P2, the command sent at P1 is embedded as is from the fourth byte onwards. The third byte of the I(0,0) block is 0CH, which is 12 in decimal. This indicates that the total of 00H, A4H, 04H and [J] from the fourth byte onwards is 12 bytes, and the byte sequence [J] is 9 bytes long. The command consisting of 00H, A4H, 04H and [J] from the fourth byte onwards represents an APDU protocol command, and the second byte of the APDU protocol (A4H) indicates that it is a SELECT command according to the standard. Upon receiving such an I(0,0) block, IC card 20 sends a response in P3, for example, an I(1,0) block containing 6AH 82H, to IC card reader 10. In response, IC card reader 10 sends 6AH 82H to host device 30 in P4 as a normal response, which is displayed as "PI402" on the IC card reader. This completes the series of processes related to the SELECT command successfully. In Figure 2, P5 to P8 show the process when the parameters in the SELECT command are different, and in this case as well, the series of processes related to the SELECT command are completed successfully, similar to P1 to P4.

[0025] At P9, the host device 30 sends a SELECT command to the IC card reader 10, indicating that the data length of the response block from the IC card 20 is expected to be longer than the above-mentioned value. The IC card reader 10 converts this into TPDU protocol data and, at P10, transfers it to the IC card 20 as an I(0,0) block. At this time, suppose the RST terminal (external contact terminal C2) of the IC card 20 temporarily goes low due to a contact abnormality or the like, and the IC card 20 is reset. When the IC card 20 recovers from the reset, at P11, it first sends an ATR block as a response signal to the IC card reader 10. The first byte of the ATR is either 3BH or 3FH. Upon receiving the ATR, the IC card reader 10 starts processing to recover communication and, at P12, returns R(1) indicating "other abnormality" to the IC card 20. At P13, the IC card 20 responds to the R(1) received immediately after the ATR with R(0). This behavior is defined in the EMV standard. Upon receiving R(0), the IC card reader 10 resends the previous command, I(0,0), which was sent in P10, to the IC card 20 at P14.

[0026] IC card 20 responds to the command transmitted on P14 by sending I(0,1) to IC card reader 10 on P15. In this I(0,1), the sequence number is 0 and chaining is enabled (1), but considering that 0 and 1 are used alternately in sequence numbers, the sequence number must be 1, and the block that should have been transmitted is I(1,1) shown on P20. Upon receiving I(0,1) transmitted on P15, IC card reader 10 detects an anomaly in the sequence number and sends R(1) to IC card 20 on P16 to notify IC card 20 of this. R(1) transmitted on P16 means "other anomaly" to IC card reader 10, but according to the EMV standard, IC card 20 interprets it as "request for subsequent block". Therefore, on P17, IC card 20 transmits a block following the block already transmitted on P15 to IC card reader 10 by I(1,0). The IC card reader 10 treats the I(1,0) block received at P17 as a single block with the correct sequence number, converts only this block into an APDU, and transmits it to the host device 18 as a normal response at P18.

[0027] The process shown in Figure 2 is based on the ISO / IEC 7816-3 and EMV standards. The data obtained by concatenating the block sent at P15 and the block sent at P17, which is represented as "6F [M] 1A [N]" in Figure 2, is the data that should have been sent from the IC card 20 to the host device 30. However, in reality, "1A [N]" is sent to the host device 30 at P18, and the first part of the data that should have been sent, i.e., the "6F [M]" part, is missing. In this example, although communication recovery occurred at the protocol layer, a data anomaly occurred at the application layer. The reason for this discrepancy is thought to be that the IC card reader 10 is unaware that an unintended reset has occurred on the IC card 20.

[0028] To prevent the occurrence of data anomalies in the application layer as described above, the IC card reader 10 of this embodiment determines that an anomaly has occurred and terminates abnormally when it receives an ATR from the IC card 20 during communication with the IC card 20, thereby preventing abnormal data, including data loss, from being transmitted to the host device 30. Figure 3 is a flowchart showing the operation of the IC card reader 10 of this embodiment, illustrating the process of sending and receiving block data to and from the IC card 20.

[0029] The EMV standard's T=1 protocol communication method is half-duplex, so the IC card reader 10 and the IC card 20 communicate by exchanging blocks alternately. In this case, the IC card reader 10 has the initial transmission right, so in step 101, the IC card reader 10 sends a block to the IC card 20 based on the command received from the host device 30, and then in step 102, it receives a block from the IC card 20. After receiving the block, in step 103, the IC card reader 10 checks the type of the received block, whether there are any parity errors, whether the block length is appropriate, and whether the check character (check digit) is correct, and determines whether the reception was successful. In checking the type of block, if the block sent to the IC card 20 is I(x,y), it is also checked whether the block received from the IC card 20 is also a block that conforms to the EMV standard. If an I(x,y) block is sent to the IC card 20 but a block other than the EMV standard (for example, the ATR block described below) is returned, it is determined that there was an abnormality in the reception. If reception is successful, in step 104, the IC card reader 10 performs a determination process to check whether the contents of the block are correct. If the contents are correct, it converts the block into an APDU and sends it to the host device 30, thus ending the series of processes.

[0030] If a reception error occurs due to factors such as noise or poor contact, a retry process is performed according to the ISO / IEC 7816-3 and EMV standards. However, in this embodiment, before performing the retry process, it is determined whether the received block is an Answer To Reset, i.e., an ATR block, indicating that the IC card 20 has been reset. Specifically, if the IC card reader 10 determines in step 103 that there is a reception error, in step 105 it determines whether the first byte of the received block is 3BH or 3FH. As mentioned above, the first byte of a block sent from the IC card 20 is usually 00H and is never 3BH or 3FH. In contrast, the first byte of an ATR block sent immediately after the IC card 20 recovers from a reset state is, according to the standards, 3BH or 3FH. Therefore, in step 105, the IC card reader 10 determines that an ATR has been sent if the first byte of the block is 3BH or 3FH, performs deactivation processing of the IC card 20 in step 106, and performs abnormal termination processing such as notifying the host device 30 of the abnormality in step 107, thereby ending the series of processes.

[0031] If step 105 determines that the first byte of the received block is neither 3BH nor 3FH, the IC card reader 10 performs a retry process for recovery. In step 108, the IC card reader 10 checks the number of retries and determines whether it is within the specified value defined in the standard. If the number of retries has already exceeded the specified value, the IC card reader 10 performs the deactivation process in step 106 and the abnormal termination process in step 107 to terminate the series of processes. On the other hand, if step 108 determines that the number of retries is within the specified value, the IC card reader 10 sends a retry block to the IC card 20 in step 109 to perform recovery processing, and then repeats the process from block reception in step 102.

[0032] The processing performed by the IC card reader 10 described above is actually executed by the processor 11 within the IC card reader 10. This processing prevents data that appears normal but is actually abnormal from being sent to the host device 30, thereby preventing the occurrence of anomalies at the application layer. In this embodiment, only the first byte of the received block is used to determine whether it is ATR. This is because if the determination were made using all the data in the received block that is ATR, the waiting time for each ATR character would be longer than the waiting time between characters in the T=1 protocol communication method, and it would not be possible to receive all the data in the ATR block.

[0033] As described above, with the IC card reader 10 of this embodiment, if the IC card 20 is unintentionally reset due to a contact abnormality at the RST terminal of the IC card 20, even if recovery processing is performed at the protocol layer, it is possible to prevent the abnormal data from being transmitted to the host device 30, which is a higher-level device, as abnormal data will be generated at the application layer. On the other hand, if it is determined that a reception abnormality has occurred due to a factor other than an unintentional reset of the IC card 20, communication recovery processing can be performed in a manner compliant with the standard.

[0034] Furthermore, this technology can be configured as follows:

[0035] (1) An IC card reader that connects to a higher-level device and reads data from a contact-type IC card, A contact pin that is electrically connected to the external contact terminal of the IC card, When communicating with the IC card via the contact pins based on a command from the above-level device, a control means determines whether the block received from the IC card is an ATR block indicating that the IC card has recovered from a reset, and when it is determined to be an ATR block, terminates the reception process as an abnormality. An IC card reader equipped with [the necessary features].

[0036] (2) It operates in accordance with the T=1 protocol communication method specified in the EMV standard, The IC card reader according to (1), wherein the control means determines that a block is an ATR block when the first byte of the block received from the IC card is 3BH or 3FH.

[0037] (3) The IC card reader according to (1) or (2), wherein the control means executes a process to deactivate the IC card when the receiving process is terminated as the abnormality processing.

[0038] (4) A communication processing method in an IC card reader that connects to a higher-level device to read data from a contact-type IC card, A transmission step of sending a block to the IC card based on a command from the above-level device, A receiving step which receives a block that is a response to the block transmitted in the transmission step, An ATR determination step is to determine whether the block received in the reception step is an ATR block indicating that the IC card has recovered from a reset, In the ATR determination step, when it is determined that the ATR is blocked, the termination step terminates the reception process as an abnormality process. A communication processing method having the following characteristics.

[0039] (5) Send and receive based on the T=1 protocol communication method specified in the EMV standard. The communication processing method according to (4), wherein in the ATR determination step, it is determined that a block is an ATR block when the first byte of the block received in the reception step is 3BH or 3FH.

[0040] (6) The communication processing method according to (4) or (5), wherein the processing to deactivate the IC card is performed in the termination step.

[0041] (7) The system further includes a reception determination step that determines whether the reception was successful after the reception step, The communication processing method according to any one of (4) to (6), wherein the ATR determination step is performed when it is determined in the reception determination step that reception is abnormal.

[0042] (8) The communication processing method according to (7), wherein when it is determined in the ATR determination step that the block is not an ATR block, a retry block is sent to the IC card. [Explanation of symbols]

[0043] 10...IC card reader; 11...Processor; 12...Interface unit; 13...IC contact block; 20...IC card; 21...External contact terminal group; 30...Host device.

Claims

1. An IC card reader that connects to a higher-level device and reads data from a contact-type IC card, A contact pin that is electrically connected to the external contact terminal of the IC card, When communicating with the IC card via the contact pins based on a command from the above-level device, a control means determines whether the block received from the IC card is an ATR block indicating that the IC card has recovered from a reset, and when it is determined to be an ATR block, terminates the reception process as an abnormality. An IC card reader equipped with [the necessary features].

2. It operates according to the T=1 protocol communication method defined in the EMV standard. The IC card reader according to claim 1, wherein the control means determines that a block is an ATR block when the first byte of the block received from the IC card is 3BH or 3FH.

3. The IC card reader according to claim 1 or 2, wherein the control means executes a process to deactivate the IC card when the reception process is terminated as the abnormality processing.

4. A communication processing method for an IC card reader that connects to a higher-level device and reads data from a contact-type IC card, A transmission step of sending a block to the IC card based on a command from the above-level device, A receiving step which receives a block that is a response to the block transmitted in the transmission step, An ATR determination step is to determine whether the block received in the reception step is an ATR block indicating that the IC card has recovered from a reset, In the ATR determination step, when it is determined that the ATR is a block, the termination step terminates the reception process as an abnormality process. A communication processing method having the following characteristics.

5. Transmission and reception are performed based on the T=1 protocol communication method defined in the EMV standard. The communication processing method according to claim 4, wherein in the ATR determination step, it is determined that a block is an ATR block when the first byte of the block received in the reception step is 3BH or 3FH.

6. The communication processing method according to claim 4 or 5, wherein the termination step involves performing a process to deactivate the IC card.

7. The system further includes a reception determination step that determines whether the reception was successful after the reception step, The communication processing method according to claim 4 or 5, wherein the ATR determination step is performed when it is determined in the reception determination step that reception is abnormal.

8. The communication processing method according to claim 7, wherein when it is determined in the ATR determination step that the block is not an ATR block, a retry block is transmitted to the IC card.