CN113286357B - Communication method and device between intelligent cards and storage medium - Google Patents

Communication method and device between intelligent cards and storage medium Download PDF

Info

Publication number
CN113286357B
CN113286357B CN202110372344.5A CN202110372344A CN113286357B CN 113286357 B CN113286357 B CN 113286357B CN 202110372344 A CN202110372344 A CN 202110372344A CN 113286357 B CN113286357 B CN 113286357B
Authority
CN
China
Prior art keywords
time delay
delay value
time
card
smart card
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110372344.5A
Other languages
Chinese (zh)
Other versions
CN113286357A (en
Inventor
林善文
黄小鹏
沈志成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Eastcompeace Technology Co Ltd
Original Assignee
Eastcompeace Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Eastcompeace Technology Co Ltd filed Critical Eastcompeace Technology Co Ltd
Priority to CN202110372344.5A priority Critical patent/CN113286357B/en
Publication of CN113286357A publication Critical patent/CN113286357A/en
Application granted granted Critical
Publication of CN113286357B publication Critical patent/CN113286357B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/004Synchronisation arrangements compensating for timing error of reception due to propagation delay
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention relates to the technical field of communication, and discloses a communication method, a device and a storage medium between intelligent cards, wherein the communication method comprises the following steps: the first smart card calculates a basic time unit of transmission and/or reception of data based on a timer; calculating a time delay value of the first intelligent card for receiving the data of the second intelligent card based on the basic time unit; based on the time delay value, after the transmission delay of the data is compensated, data communication is carried out between the first intelligent card and the second intelligent card; the first smart card can simulate a main ISO7816 interface to communicate with the second smart card. The invention has at least the following beneficial effects: the first intelligent card simulates a main ISO7816 interface to realize the direct communication between the intelligent card and the intelligent card, a basic time unit and transmission time delay can be defined based on a timer, and the stability and high speed of the communication between the intelligent card and the intelligent card are ensured.

Description

Communication method and device between intelligent cards and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, and a storage medium for communication between smart cards.
Background
With the development and popularization of mobile terminals and mobile payment, more and more scenes need to realize secure communication through more than 2 smart cards, one smart card integrates an SE (secure chip), and the communication security can be guaranteed through the SE.
In the prior art, two smart cards cannot directly communicate with each other, because the smart cards are only slave ISO7816 interfaces and do not have master ISO7816 interfaces, such as SE cards and UICC cards. In the prior art, in order to solve this problem, there is a scheme in which an SE card integrates a slave ISO7816 interface and a master ISO7816 interface, the slave ISO7816 interface is used for communicating with a terminal, and the master ISO7816 interface is used for communicating with a UICC card, so that the terminal and the UICC card can only communicate through the SE card, and a protocol and a communication frame format of a communication process need to be redefined, so long as one party changes and the other party subsequently changes, on the other hand, communication between the SE card and the UICC card also has a problem of unstable communication, which greatly affects a user experience.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides a communication method between intelligent cards, which can realize direct communication between the SE and the intelligent cards through an SE simulation main ISO7816 interface and has the characteristics of high and stable communication speed.
The invention also provides a communication device between the intelligent cards, which has the communication method between the intelligent cards.
The invention also provides a computer readable storage medium with the communication method between the intelligent cards.
According to the first aspect of the invention, the communication method between the intelligent cards comprises the following steps: first of all
According to some embodiments of the invention, the first smartcard calculates the basic time unit of transmission and/or reception of data based on a timer, comprising the steps of: the counting time of the timer is defined by the number of clock signals, and the timer is a decreasing timer; starting the timer to count at the same time when the data starts to be transmitted; stopping the timer counting while the data transmission is over; calculating the transmission time of the data according to the counting time when the timer starts counting and the counting time when the timer stops counting; calculating the basic time unit based on the transmission time of the data.
According to some embodiments of the invention, calculating a delay value for the first smart card to receive data from the second smart card based on the basic time unit comprises: defining a first delay value based on the basic time unit; if the first time delay value is larger than a preset time delay constant, setting the first time delay value as a difference value between the first time delay value and the preset time delay constant; if the first time delay value is larger than the basic time unit, setting a second time delay value as the difference value of the first time delay value and the basic time unit; if the first time delay value is not larger than the basic time unit, setting a second time delay value to be 0; if the second time delay value is larger than zero, setting the first time delay value as the difference value between the first time delay value and the second time delay value; and calculating the time delay value of the first intelligent card for receiving the data of the second intelligent card through the second time delay value and the first time delay value.
According to some embodiments of the invention, the preset time delay constant is determined by an interrupt trigger time and a timer start time.
According to some embodiments of the invention, calculating a delay value for the first smart card to receive data from the second smart card based on the basic time unit comprises: setting a first delay value to 1.5 of said elementary time units; if the first time delay value is larger than a preset time delay constant, setting the first time delay value as a difference value of the first time delay value and the preset time delay constant, wherein the preset time delay constant is determined by interrupt trigger time and timer starting time; if the first time delay value is larger than one basic time unit, setting a second time delay value as the difference value of the first time delay value and one basic time unit; if the first time delay value is not larger than one basic time unit, setting a second time delay value to be 0; if the second delay value is larger than zero, setting the first delay value as the difference value between the first delay value and the second delay value; setting a second time delay value as the time delay value of the first smart card for receiving the first data bit transmitted by the second smart card; setting a first time delay value as a time delay value of the first intelligent card for receiving the second data bit transmitted by the second intelligent card; and calculating the time delay value of the first intelligent card for receiving the data of the second intelligent card based on the second time delay value and the first time delay value.
According to some embodiments of the invention, further comprising a real-time calibration of the first smart card in communication with the second smart card, comprising: setting a communication time threshold, and calibrating the timer based on an external clock if the communication times of the first smart card and the second smart card are greater than or equal to the communication time threshold; and if the communication between the first smart card and the second smart card fails, calibrating the timer based on an external clock.
According to some embodiments of the invention, further comprising the step of: the direct operation register realizes the level reading of the input/output port of the first smart card and/or the second smart card.
According to the communication device between the intelligent cards of the second aspect of the invention, the communication method between the intelligent cards is realized, and the communication device comprises the following steps: the terminal comprises an ISO7816 main interface and is used for providing a power signal, a clock signal, a reset signal, a ground signal and an IO signal which are in accordance with an ISO7816 standard protocol; the first intelligent card is connected with the terminal; the second intelligent card is connected with the terminal and the first intelligent card respectively; the IO port of the second intelligent card is connected with the IO port of the first intelligent card, and the power port, the clock port, the reset port and the ground port of the second intelligent card are respectively connected with the power port, the clock port, the reset port and the ground port of the terminal.
According to some embodiments of the present invention, the first smart card is an SE card, one of the IO ports of the SE card is connected to the IO port of the terminal, the other IO port of the SE card is connected to the IO port of the second smart card, and the power port, the clock port, the reset port, and the ground port of the SE card are respectively connected to the power port, the clock port, the reset port, and the ground port of the terminal.
A computer-readable storage medium according to an embodiment of the third aspect of the invention, has stored thereon a computer program that, when being executed by one or more processors, is capable of performing the steps of the method of communication between smart cards of any one of the preceding claims.
The communication method between the intelligent cards according to the embodiment of the invention at least has the following beneficial effects: the first intelligent card simulates a main ISO7816 interface to realize the direct communication between the intelligent card and the intelligent card, a basic time unit and transmission time delay can be defined based on a timer, and the stability and high speed of the communication between the intelligent card and the intelligent card are ensured.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a schematic flow chart of a method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a basic time cell calculation method according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of a method for calculating data transmission delay according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method for real-time calibrating a timer according to an embodiment of the present invention;
FIG. 5 is a block schematic diagram of an apparatus of an embodiment of the invention;
fig. 6 is a schematic diagram illustrating an effect of data communication according to an embodiment of the invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
It should be understood that, the sequence numbers of the steps in the embodiments of the present invention do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
In the description of the present invention, the meaning of a plurality of means is one or more, the meaning of a plurality of means is two or more, and more than, less than, more than, etc. are understood as excluding the present number, and more than, less than, etc. are understood as including the present number. If the first and second are described for the purpose of distinguishing technical features, the description should not be interpreted as indicating or implying any relative importance or implicit indication of the number of technical features indicated or implicit indication of the precedence of the technical features indicated.
Interpretation of terms:
ISO7816: the standard of the smart card;
ISO7816 host interface: the interface can read the data of the smart card according to an ISO7816 protocol, and generally refers to a card reader end;
etu: basic time unit of data transmission in smart card communication;
IO: an input-output port;
and SE is a security chip.
Referring to fig. 1, fig. 1 is a schematic flow chart of a method according to an embodiment of the present invention, including the following steps:
the first smart card calculates a basic time unit of transmission and/or reception of data based on a timer;
calculating a time delay value of the first intelligent card for receiving the data of the second intelligent card based on the basic time unit;
based on the time delay value, after the transmission delay of the data is compensated, data communication is carried out between the first intelligent card and the second intelligent card;
the first smart card can simulate a main ISO7816 interface to communicate with the second smart card.
It should be noted that, in the prior art, communication cannot be directly performed between two smart cards, and the first smart card in the embodiment of the present technical solution simulates a main ISO7816 interface to be able to directly communicate with a smart card, so as to implement direct communication between the two smart cards, on the other hand, the two smart cards share an external ISO7816 power supply, a clock, a reset and a ground, and the IO simulates a data interface of ISO7816 to implement direct communication between the smart card and the smart card, which can be understood that the smart card in the embodiment of the present technical solution is not limited to a UICC card, an eUICC card, a SIM card and an SE card, and all smart cards capable of implementing the present technical solution all belong to the protection scope of the present technical solution; on the other hand, in order to achieve high efficiency and stability of communication between the smart cards, in the embodiment of the technical scheme, the first smart card calculates etu in data transmission based on the timer, and determines the time delay of the smart card according to the etu.
Fig. 2 shows a flow chart of a method for etu calculation according to an embodiment of the present invention, in which the first smart card calculates a basic time unit for transmission and/or reception of data based on a timer, and includes the following steps:
the counting time of the timer is defined by the number of the clock signals, and the timer is a descending timer;
starting a timer to start counting at the same time when the data starts to be transmitted;
stopping the timer counting at the end of the data transmission;
calculating the transmission time of the data through the counting time when the timer starts counting and the counting time when the timer stops counting;
a basic time unit is calculated based on the transmission time of the data.
In a specific embodiment of the present invention, the SE uses a high-speed timer to replace the hardware ETU used in the prior art to calculate the external clock, so as to determine the time point of sending data and receiving data with high precision. In general, an external clock for ISO7816 communication is up to 5MHz, and at such a high frequency, a certain error is often generated by calculating the external clock through an original hardware ETU, thereby affecting the reliability of communication.
Another specific embodiment of the present invention is:
SCINT = clkNumber; defining the timer time to be clkNumber, which may be defined herein as 1000;
TIMER1LOAD = TIMER _ START _ NUM; the timer may be defined as a decrementing timer
Syslcken | = (1 < < 9); enabling a clock timer
Syslken | = (1 < < 19); enabling a clock timer bus
TIMER1CONTROL = (1 < < 7) | (1 < < 1) |1; the timer starts to work
SCISSR|=BIT6;/*Begin 1ETU counter*/
while ((SCISSSR & BIT 6) | = 0); whether the timing is over
timevalue = TIMER _ START _ NUM-TIMER1VALUE; calculating timer time
G_ISO7816_one_etu_timer_num=timerValue>>param;
G_ISO7816_half_etu_timer_num=(G_ISO7816_one_etu_timer_num>>1)
Based on this, one basic time unit and half time unit can be calculated by the timer, which are denoted as G _ ISO7816_ one _ etu _ timer _ num and G _ ISO7816_ half _ etu _ timer _ num, respectively, in the above embodiments.
Referring to fig. 3, fig. 3 is a flowchart illustrating a method for calculating a data transmission delay according to an embodiment of the present invention, where calculating a delay value of a first smart card receiving data of a second smart card based on a basic time unit includes:
defining a first delay value based on a basic time unit;
if the first time delay value is larger than the preset time delay constant, setting the first time delay value as the difference value of the first time delay value and the preset time delay constant;
if the first time delay value is larger than the basic time unit, setting a second time delay value as the difference value of the first time delay value and the basic time unit;
if the first time delay value is not larger than the basic time unit, setting a second time delay value to be 0;
if the second time delay value is larger than zero, setting the first time delay value as the difference value of the first time delay value and the second time delay value;
and calculating the time delay value of the first intelligent card for receiving the data of the second intelligent card through the second time delay value and the first time delay value.
In some specific embodiments of the present invention, the preset delay constant is determined by the interrupt trigger time and the timer start time, specifically, the preset delay constant is related to the master frequency of the MCU in the actual communication environment, and to a certain extent, the preset delay constant is a time error value between the start of the timer and the time of the sequence transmission.
Referring to fig. 3, calculating a delay value for the first smart card to receive data of the second smart card based on the basic time unit includes: setting the first time delay value to be 1.5 basic time units;
if the first time delay value is larger than the preset time delay constant, setting the first time delay value as the difference value of the first time delay value and the preset time delay constant, wherein the preset time delay constant is determined by the interrupt trigger time and the timer starting time;
if the first time delay value is larger than a basic time unit, setting a second time delay value as the difference value of the first time delay value and the basic time unit;
if the first time delay value is not larger than a basic time unit, setting a second time delay value to be 0;
if the second time delay value is larger than zero, setting the first time delay value as the difference value of the first time delay value and the second time delay value;
setting a second time delay value as a time delay value of the first smart card for receiving a first data bit transmitted by a second smart card;
setting a first time delay value as a time delay value of a first smart card receiving a second data bit transmitted by a second smart card;
and calculating the time delay value of the first intelligent card for receiving the data of the second intelligent card based on the second time delay value and the first time delay value.
A specific embodiment of the present invention is that, when the SE receives data of the UICC card, time delay compensation of a TIMER start process is added, as shown in fig. 3, firstBitNum is a first time delay value, and TIMER _ report _ NUM is a preset time delay constant; startBitNum is a second time delay value; etu _ timer _ num is a basic time unit, specifically:
firstBitNum=G_ISO7816_half_etu_timer_num+
G_ISO7816_one_etu_timer_num;
firstBitNum=(firstBitNum>FIRST_BIT_TIMER_REPAIR_NUM)?
(firstBitNum-FIRST_BIT_TIMER_REPAIR_NUM):firstBitNum;
startBitNum=(firstBitNum>G_ISO7816_one_etu_timer_num)?
(firstBitNum-G_ISO7816_one_etu_timer_num):0;
firstBitNum=(startBitNum>0)?(firstBitNum-startBitNum):firstBitNum;
G_ISO7816_rev_fisrt_bit_wait_timer_num=startBitNum;
G_ISO7816_rev_second_bit_wait_timer_num=firstBitNum。
the first time delay value is used for calculating the time delay value of the first intelligent card for receiving the second data bit transmitted by the second intelligent card through the first time delay value, the startBitNum is used for calculating the time delay value of the first intelligent card for receiving the first data bit transmitted by the second intelligent card through the startBitNum, and the time delay value of the first intelligent card for receiving the data of the second intelligent card is determined based on the second time delay value and the first time delay value. For example, the following examples: firstBitNum is initially set to 1.5etu, firstBitNum BIT \_timer _replay _numis initially set to 1etu, and since it is greater than firstBitNum BIT _ TIMER _ replay _ NUM at this time, firstBitNum is reset to 1.5-1=0.5etu, at which time, firstBitNum is less than 1etu, and thus startBitNum is set to 0, and in the case of startBitNum being 0, the value of firstBitNum is also 0.5etu, so in the initial case of firstBitNum =1.5etu, FIRST \_BIT _TIMER _REPAIR _NUM =1etu, the time delay value of the FIRST data BIT transmitted by the second intelligent card is 0etu, which is equivalent to no time delay, and the FIRST intelligent card starts receiving immediately when receiving the interrupt signal; the time delay value of the first smart card for receiving the second data bit transmitted by the second smart card is 0.5 etu. In another case, the firstBitNum is initially set to 1.5etu, the FIRST _ BIT _ TIMER _ reparar _ NUM is initially set to 0.3 etu, and since the firstBitNum is greater than the FIRST _ BIT _ TIMER _ reparar _ NUM at this time, the firstBitNum is reset to 1.5-0.3=1.2 etu, and the firstBitNum is greater than 1etu, the startBitNum is set to 1.2-1=0.2 etu, and in the case that the startBitNum is greater than 0, the firstBitNum has a value of 1.2-0.2= 1etu, and thus, in the initial case that the firstBitNum is greater than 0, the FIRST smart card data transmission delay time value of the FIRST smart card is 0.2, and the second smart card data transmission time delay time value of the FIRST smart card is 0.2 etu.
In some embodiments of the present invention, the first data bit transmitted by the second smart card and received by the first smart card is always at a low level and is not a valid data bit, and the second data bit transmitted by the second smart card and received by the first smart card is only a valid value for data transmission. In some embodiments of the present invention, the FIRST _ BIT _ TIMER _ reply _ NUM is also a predetermined delay constant of 1.5 μ s.
Fig. 4 is a flowchart illustrating a method for calibrating a timer in real time according to an embodiment of the present invention, including:
setting a communication time threshold, and calibrating the timer based on an external clock if the communication times of the first smart card and the second smart card are greater than or equal to the communication time threshold;
and if the communication between the first smart card and the second smart card fails, calibrating the timer based on the external clock.
One specific embodiment of the present invention is: the smart card is added with a real-time communication calibration function, so that the problem of communication failure caused by crystal oscillator/timer deviation due to temperature change is solved, for example, when the communication process of an SE simulation ISO7816 main interface and a UICC card or an SIM card and the like is performed, and when the communication frequency exceeds 100 times, for example, an external ISO7816 clock is used for calibrating an internal timer, so that the purpose of real-time calibration is achieved.
Figure BDA0003009776710000101
Wherein, etotoclcloeficient is a clock calibration function, and the specific method of clock calibration is a common technique well known to those skilled in the art, and therefore, it is not described herein again.
In the communication process of the security chip SE simulating the ISO7816 and the SIM card or other intelligent cards, if communication failure occurs, the internal clock is calibrated by using the external clock immediately, and the communication failure caused by crystal oscillator/timer deviation due to temperature change is avoided.
Figure BDA0003009776710000102
According to some specific embodiments of the present invention, the method further comprises the step of implementing level reading of the input/output port of the first smart card and/or the second smart card by using the direct operation register. It can be understood that, a method for calling a function at an upper layer is adopted to operate a register, so that data transmission is delayed to a certain extent by the function calling process, and sometimes errors occur.
One specific embodiment of the present invention is: the intelligent card uses a high-speed GPIO interface to directly operate the register to realize GPIO turnover and IO interface level reading within 100 ns;
#define ISO7816IO_LOW (GPIODATA&=~(1))
#define ISO7816IO_HIGH (GPIODATA|=(1))
#define ISO7816IO_DATA (GPIODATA&0x01)
referring to fig. 5, fig. 5 is a block diagram of a device according to an embodiment of the present invention, including:
the terminal comprises an ISO7816 main interface and is used for providing a power signal, a clock signal, a reset signal, a grounding signal and an IO signal which accord with an ISO7816 standard protocol, and the terminal can be a mobile phone, a palm computer, a tablet computer, a telephone watch and the like;
the first intelligent card is connected with the terminal;
the second intelligent card is connected with the terminal and the first intelligent card respectively;
the IO port of the second intelligent card is connected with the IO port of the first intelligent card, and the power supply port, the clock port, the reset port and the ground port of the second intelligent card are respectively connected with the power supply port, the clock port, the reset port and the ground port of the terminal.
In some embodiments of the present invention, the first smart card is an SE card, one of the IO ports of the SE card is connected to an IO port of the terminal, the other IO port of the SE card is connected to an IO port of the second smart card, and the power port, the clock port, the reset port, and the ground port of the SE card are connected to the power port, the clock port, the reset port, and the ground port of the terminal, respectively.
In some specific embodiments of the invention, a VCC RST CLK GND of an ISO7816 main interface in a mobile phone is connected with an SIM card, a general IO port of an SE is connected with the SIM card 7816 from the IO port, and communication between the SE and the SIM card is realized by driving the general IO port pseudo 7816 interface.
In some embodiments of the invention, the SE and SIM instructions are distinguished by an ISO7816 application selection mode, or the application instructions between two smart cards are distinguished, the SE application is selected by default when the chip is powered on, after the SIM card application selection instruction is sent to the SE by the mobile phone, the subsequent instruction is forwarded to the SIM card by the SE, the instruction format is the same as that of a normal SIM card, and no special processing is needed.
Fig. 6 is a schematic diagram illustrating the effect of data communication according to an embodiment of the present invention, in which a smart card, such as an SE analog ISO7816 IO interface, realizes high-speed and stable communication with a smart card, such as a SIM card, and the communication rate may be as high as 300kbps, which is currently substantially 100kbps in the industry. The time sequence in fig. 6 shows that the smart card SE receives 0x95 0x3b 0x2e 0x66 0x71 0x8c 0x1f 0x5a sent by the mobile phone first, and then forwards the received information to the smart card SIM card, the smart card SIM returns 0x9000 to the smart card SE, and the smart card SE returns to the mobile phone.
In some embodiments of the invention, a computer-readable storage medium is also included, the computer-readable storage medium including a stored computer program; the computer program, when executed, controls an apparatus in which the computer-readable storage medium is located to perform a method of communication between smart cards.
The embodiment of the invention has the characteristics of lower hardware requirement, more flexible realization and more convenient use, realizes the direct communication between the SE and the intelligent card through the SE simulation main ISO7816 interface, can define a basic time unit and transmission time delay based on a timer, and ensures the stability and high speed of the communication between the SE and the intelligent card.
Although specific embodiments have been described herein, those of ordinary skill in the art will recognize that many other modifications or alternative embodiments are equally within the scope of this disclosure. For example, any of the functions and/or processing capabilities described in connection with a particular device or component may be performed by any other device or component. In addition, while various exemplary implementations and architectures have been described in accordance with embodiments of the present disclosure, those of ordinary skill in the art will recognize that many other modifications of the exemplary implementations and architectures herein are also within the scope of the present disclosure.
Certain aspects of the present disclosure are described above with reference to block diagrams and flowchart illustrations of systems, methods, systems, and/or computer program products according to example embodiments. It will be understood that one or more blocks of the block diagrams and flowchart illustrations, and combinations of blocks in the block diagrams and flowchart illustrations, respectively, can be implemented by execution of computer-executable program instructions. Also, according to some embodiments, some blocks of the block diagrams and flow diagrams may not necessarily be performed in the order shown, or may not necessarily be performed in their entirety. In addition, additional components and/or operations beyond those shown in block diagrams and flow diagrams may be present in certain embodiments.
Accordingly, blocks of the block diagrams and flowchart illustrations support combinations of means for performing the specified functions, combinations of elements or steps for performing the specified functions and program instruction means for performing the specified functions. It will also be understood that each block of the block diagrams and flowchart illustrations, and combinations of blocks in the block diagrams and flowchart illustrations, can be implemented by special purpose hardware-computer systems that perform the specified functions, elements or steps, or combinations of special purpose hardware and computer instructions.
Program modules, applications, etc. herein may include one or more software components, including, for example, software objects, methods, data structures, etc. Each such software component may include computer-executable instructions that, in response to execution, cause at least a portion of the functionality herein (e.g., one or more operations of the illustrative methods herein) to be performed.
The software components may be encoded in any of a variety of programming languages. An illustrative programming language may be a low-level programming language, such as an assembler language associated with a particular hardware architecture and/or operating system platform. Software components that include assembly language instructions may need to be converted by an assembler program into executable machine code prior to execution by a hardware architecture and/or platform. Another exemplary programming language may be a higher level programming language, which may be portable across a variety of architectures. Software components that include higher level programming languages may need to be converted to an intermediate representation by an interpreter or compiler before execution. Other examples of programming languages include, but are not limited to, a macro language, a shell or command language, a job control language, a scripting language, a database query or search language, or a report writing language. In one or more exemplary embodiments, software components containing instructions of one of the above programming language examples may be executed directly by an operating system or other software component without first being converted to another form.
The software components may be stored as files or other data storage constructs. Software components of similar types or related functionality may be stored together, such as in a particular directory, folder, or library. Software components may be static (e.g., preset or fixed) or dynamic (e.g., created or modified at execution time).
The embodiments of the present invention have been described in detail with reference to the drawings, but the present invention is not limited to the embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.

Claims (7)

1. A communication method between intelligent cards is characterized by comprising the following steps:
the first smart card calculates a basic time unit of transmission and/or reception of data based on a timer;
calculating a time delay value of the first smart card for receiving data of a second smart card based on the basic time unit; when a first time delay value is defined based on the basic time units or when the first time delay value is set to be 1.5 basic time units, calculating a time delay value of the first intelligent card for receiving data of a second intelligent card through a second time delay value and the first time delay value;
compensating the transmission delay of the data based on the time delay value, and then carrying out data communication between the first smart card and the second smart card;
the first smart card can simulate a main ISO7816 interface to communicate with the second smart card;
the first smart card calculates a basic time unit for transmission and/or reception of data based on a timer, comprising the steps of:
defining the counting time of the timer through the number of clock signals, wherein the timer is a descending timer;
starting the timer to count at the same time when the data starts to be transmitted;
stopping the timer counting while the data transmission ends;
calculating the transmission time of the data through the counting time when the timer starts counting and the counting time when the timer stops counting;
calculating the basic time unit based on the transmission time of the data;
the calculating of the time delay value of the first smart card for receiving the data of the second smart card based on the basic time unit comprises:
defining a first delay value based on the basic time unit;
if the first time delay value is larger than a preset time delay constant, setting the first time delay value as a difference value between the first time delay value and the preset time delay constant;
if the first time delay value is larger than the basic time unit, setting a second time delay value as the difference value of the first time delay value and the basic time unit;
if the first time delay value is not larger than the basic time unit, setting a second time delay value to be 0;
if the second time delay value is larger than zero, setting the first time delay value as the difference value of the first time delay value and the second time delay value;
calculating a time delay value of the first intelligent card for receiving the data of the second intelligent card through the second time delay value and the first time delay value;
or the like, or, alternatively,
the calculating of the time delay value of the first smart card for receiving the data of the second smart card based on the basic time unit comprises:
when the first time delay value is set to 1.5 basic time units;
if the first time delay value is larger than a preset time delay constant, setting the first time delay value as a difference value between the first time delay value and the preset time delay constant, wherein the preset time delay constant is determined by interrupt trigger time and timer starting time;
if the first time delay value is larger than one basic time unit, setting a second time delay value as the difference value of the first time delay value and the basic time unit;
if the first time delay value is not larger than one basic time unit, setting a second time delay value to be 0;
if the second time delay value is larger than zero, setting the first time delay value as the difference value of the first time delay value and the second time delay value;
setting a second time delay value as the time delay value of the first smart card for receiving the first data bit transmitted by the second smart card;
setting a first time delay value as a time delay value of a second data bit transmitted by the second intelligent card received by the first intelligent card;
and calculating the time delay value of the first intelligent card for receiving the data of the second intelligent card based on the second time delay value and the first time delay value.
2. The method of claim 1, wherein the predetermined delay constant is determined by an interrupt trigger time and a timer start time.
3. The method of claim 1, further comprising a real-time calibration of the communication between the first smart card and the second smart card, comprising:
setting a communication time threshold, and calibrating the timer based on an external clock if the communication times of the first smart card and the second smart card are greater than or equal to the communication time threshold;
and if the communication between the first smart card and the second smart card fails, calibrating the timer based on an external clock.
4. The method of communication between smart cards according to claim 1, further comprising the steps of:
the direct operation register realizes the level reading of the input/output port of the first intelligent card and/or the second intelligent card.
5. An inter-smart-card communication apparatus for implementing the inter-smart-card communication method according to any one of claims 1 to 4, comprising:
the terminal comprises an ISO7816 main interface and is used for providing a power signal, a clock signal, a reset signal, a ground signal and an IO signal which are in accordance with an ISO7816 standard protocol;
the first intelligent card is connected with the terminal;
the second intelligent card is connected with the terminal and the first intelligent card respectively;
the IO port of the second intelligent card is connected with the IO port of the first intelligent card, and the power port, the clock port, the reset port and the ground port of the second intelligent card are respectively connected with the power port, the clock port, the reset port and the ground port of the terminal.
6. The communication device according to claim 5, wherein the first smart card is an SE card, one of the IO ports of the SE card is connected to the IO port of the terminal, the other IO port of the SE card is connected to the IO port of the second smart card, and the power port, the clock port, the reset port, and the ground port of the SE card are connected to the power port, the clock port, the reset port, and the ground port of the terminal, respectively.
7. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored computer program; the computer program, when executed, controls an apparatus in which the computer-readable storage medium is located to perform the method of communication between smart cards of any of claims 1 to 4.
CN202110372344.5A 2021-04-07 2021-04-07 Communication method and device between intelligent cards and storage medium Active CN113286357B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110372344.5A CN113286357B (en) 2021-04-07 2021-04-07 Communication method and device between intelligent cards and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110372344.5A CN113286357B (en) 2021-04-07 2021-04-07 Communication method and device between intelligent cards and storage medium

Publications (2)

Publication Number Publication Date
CN113286357A CN113286357A (en) 2021-08-20
CN113286357B true CN113286357B (en) 2022-11-25

Family

ID=77276393

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110372344.5A Active CN113286357B (en) 2021-04-07 2021-04-07 Communication method and device between intelligent cards and storage medium

Country Status (1)

Country Link
CN (1) CN113286357B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116702821A (en) * 2023-05-08 2023-09-05 东信和平科技股份有限公司 Multi-chip integrated intelligent card and control method thereof

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100939067B1 (en) * 2006-07-07 2010-01-28 삼성전자주식회사 Smartcard including a plurality of differnt Interfaces
CN101383017B (en) * 2007-09-06 2012-07-04 中国银联股份有限公司 Intelligent SD card and intelligent SD card access method
CN201522717U (en) * 2009-09-25 2010-07-07 北京握奇数据系统有限公司 Intelligence card data processing device
CN102546107B (en) * 2011-12-28 2015-04-22 北京握奇数据系统有限公司 Method, system and adapter card for data transmission between contact card and card reading device
CN103955739B (en) * 2014-05-20 2017-03-15 北京智联安科技有限公司 A kind of bluetooth thin film SIM and the method for accessing SIM cards of mobile phones
FR3038423B1 (en) * 2015-06-30 2018-07-20 Idemia France ELECTRONIC ENTITY AND METHOD IMPLEMENTED IN SUCH AN ELECTRONIC ENTITY
CN106357472A (en) * 2015-07-17 2017-01-25 中兴通讯股份有限公司 Delay measuring method and device
CN109460682B (en) * 2018-11-14 2020-03-24 江苏恒宝智能系统技术有限公司 Intelligent card and implementation method thereof
CN111160508B (en) * 2019-12-31 2023-11-10 上海辰锐信息科技有限公司 Dual-chip safe SIM card
CN211606520U (en) * 2020-01-15 2020-09-29 上海董芯智能科技有限公司 Security chip based on SIM function

Also Published As

Publication number Publication date
CN113286357A (en) 2021-08-20

Similar Documents

Publication Publication Date Title
US6769622B1 (en) System and method for simulating universal serial bus smart card device connected to USB host
CN101361043B (en) Method for booting a host device from an mmc/sd device, a host device bootable from an mmc/sd device and an mmc/sd device method a host device may booted from
CN108141733B (en) NFC split stack architecture
KR20070014368A (en) Method of establishing communication security for smart card and communication apparatus for the same
CN102609741B (en) A kind of method of exchanges data between mobile device and inside and outside portion storage card thereof
CN109284142A (en) File preloads method, apparatus, electronic equipment and computer readable storage medium
US10402354B2 (en) Method, apparatus, communication equipment and storage media for determining link delay
CN113286357B (en) Communication method and device between intelligent cards and storage medium
CN102750249B (en) The method that host computer communicates with slave computer, Apparatus and system
CN213069787U (en) Read-write control system of memory card
CN104239097A (en) Method and system for upgrading fitting by virtue of mobile terminal, and mobile terminal
CN102033828B (en) Method and system for accessing external card
CN104636306A (en) RFFE main equipment port migration device and method based on single chip microcomputer
CN102385912B (en) Host controller for setting sampling phase, semiconductor device and method
CN103488601B (en) A kind of clock delay, data access method, system and equipment
US20220269642A1 (en) Method and apparatus for eliminating glitch, and state machine
CN102255999A (en) Method for determining communication protocol between terminal and smart card and expansion card
CN112416444B (en) Board switching control method, device, equipment and medium
CN113875162B (en) Data exchange device between NFC reader and double-NFC interface responder
KR100751063B1 (en) Method and apparatus for providing emulation PC-based for developing program of embedded system
US11652512B2 (en) Fast NFC processing
CN103679257B (en) A kind of contactless payment telecommunications integrated circuit card and implementation method
CN110971696A (en) System and method for realizing virtual electronic card communication
CN111352357A (en) Robot control method and device and terminal equipment
CN113094278B (en) Method, device, equipment and computer readable storage medium for debugging mobile terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant