CN100414556C - Method and apparatus for host machine and smart card to conduct information interaction - Google Patents

Method and apparatus for host machine and smart card to conduct information interaction Download PDF

Info

Publication number
CN100414556C
CN100414556C CNB2006101139731A CN200610113973A CN100414556C CN 100414556 C CN100414556 C CN 100414556C CN B2006101139731 A CNB2006101139731 A CN B2006101139731A CN 200610113973 A CN200610113973 A CN 200610113973A CN 100414556 C CN100414556 C CN 100414556C
Authority
CN
China
Prior art keywords
smart card
main frame
interfacing equipment
byte
ccid
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.)
Expired - Fee Related
Application number
CNB2006101139731A
Other languages
Chinese (zh)
Other versions
CN1936917A (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.)
Feitian Technologies Co Ltd
Original Assignee
Beijing Feitian Technologies 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 Beijing Feitian Technologies Co Ltd filed Critical Beijing Feitian Technologies Co Ltd
Priority to CNB2006101139731A priority Critical patent/CN100414556C/en
Publication of CN1936917A publication Critical patent/CN1936917A/en
Application granted granted Critical
Publication of CN100414556C publication Critical patent/CN100414556C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Communication Control (AREA)

Abstract

Solving issue of information interaction between host and smart cart is dependent on driver of device of reading and writing smart cart. The invention discloses method for implementing information interaction between host and smart cart rapidly by using CCID command flow. The invention also discloses equipment of information interaction between host and smart cart in order to realize quick information interaction between host and smart cart.

Description

The method and apparatus of a kind of main frame and information interaction of smart card
Technical field
The present invention relates to the data communication field, the method and apparatus of particularly a kind of main frame and information interaction of smart card.
Background technology
CCID (USB Chip/Smart Card Interface Devices-USB chip intelligent card equipment) standard is that it provides a kind of read-write equipment for smart card and main frame or other embedded host to realize the possibility of mutual communication by the common standard of formulating of several big international IT enterprises.The CCID standard code CCID equipment be a kind of chip/intelligence card interface device, equipment is connected with main frame or other embedded host by USB interface, the data communication that meets the CCID standard, equipment carries out communication by interface and the smart card that meets 7816 standard agreements simultaneously.Microsoft provides on its WINDOWS2000 and above operating system and supports CCID to drive, and device fabrication manufacturer can be developed easily use the equipment that meets the CCID interface standard.Simultaneously, the CCID interface standard is supported PC (Personal Computer-personal computer)/SC (Smart Card-smart card) interface interchange, makes numerous developers develop operation to intelligent cipher key equipment easily.On numerous versions of other increase income operating system such as LINUX, also having many CCID that increase income to drive can use for developer and user.
Descriptor is the format piece of data result or information, and it can make main frame know this equipment, and each descriptor has comprised the information about the Global Information of this equipment or an element.According to the CCID consensus standard, the feature that meets its descriptor of equipment of CCID interface standard is: in interface descriptor, byte 0 is the byte length of descriptor, value is 09h, and byte 1 is a fixed terminal, is worth to be 04h, byte 4 is except terminal 0, and the terminal number of support is worth and is 02h or 03h, byte 5 is category codes, value is 0Bh, and byte 6 is the subclass code, is worth to be 00h, byte 7 is protocol code, is worth to be 00h; In the type specification symbol, byte 0 is the byte length of descriptor, is worth to be that 36h, byte 2 are version numbers of CCID standard, and it is the decimal of representing with binary code, is worth to be 0100h, and byte 52 is PIN code supports, is worth to be 00H-03h.Meet the byte in other descriptor of equipment of CCID interface standard, as other byte in the byte in device descriptor, the configuration descriptor and above-mentioned interface descriptor and the type specification symbol still according to the regulation setting in the usb protocol.
When using the CCID standard to realize main frame and information interaction of smart card, we need a kind of equipment and implementation method that can be general, it can be fast, parsing convenient, medelling meets the command stream of CCID and 7816 standards, particularly resolve the method meet 7816 T=0 agreements, thus the 7816 T=0 command streams that equipment meets the CCID standard by parsing fast, convenient, the realization main frame of mode standardization and the information interaction of smart card.7816 T=0 consensus standards are a kind of asynchronous half-duplex piece character transmission agreements, and agreement begins after reset answer or successful PPS (agreement and parameter are selected) exchange.Etu is the Elementary Time Unit of using in the 7816 T=0 agreements, and during reset answer, 1 etu should equate with 372 clock period, i.e. 1etu=372/f.According to 7816 T=0 agreements, the order of using in the transmission is always started by interfacing equipment, and what it does with the header notice smart card of one 5 byte, and allows transmitted data byte under the control of the process byte that smart card sends.In order to distinguish input data transfer command (data enter smart card during execution) and output data transmission command (data are left smart card during execution), suppose that smart card and interfacing equipment know data direction in advance, after one 5 byte header transmission, interfacing equipment is waited for a process byte, and the value of process byte will indicate the action of interfacing equipment request.In each process byte, smart card can be proceeded down this order with an ACK (affirmation) or NULL byte, or does not approve of with the suitable expression of not replying, or finishes this order with end sequence SW1-SW2 (state byte).
In present prior art, the information interaction of main frame and smart card is finished by read-write equipment for smart card.When main frame and smart card communication, need to rely on the driver that is installed in the read-write equipment for smart card in the main frame in advance and realize the mutual of information, the driver that read-write equipment for smart card manufacturer provides has nothing in common with each other, the standard that neither one is unified, and operations such as the installation of driver, upgrading, unloading are very inconvenient, also easily operating system caused damage.The information interaction that how to realize main frame and smart card simply and easily is the problem that IT worker and user are concerned about very much.
Summary of the invention
The problem that realizes for the information interaction that solves main frame and smart card need rely on the driver of read-write equipment for smart card, the present invention proposes the method that a kind of CCID of utilization command stream realizes main frame and information interaction of smart card fast, main frame and smart card connect by interfacing equipment, described main frame and described interfacing equipment adopt CCID standard communications protocol to carry out information interaction, described interfacing equipment and described smart card adopt 7816 T=0 agreements to carry out information interaction, said method comprising the steps of:
Steps A: described main frame sends the electrification reset order to described smart card, and receives the reset answer packet that meets the CCID standard, and described interfacing equipment is preserved the T=0 protocol type sign of described smart card;
Step B: described main frame sends the command stream that meets the CCID standard to described interfacing equipment;
Step C: described interfacing equipment is received described command stream, and the packet that sends in the described command stream arrives described smart card;
Step D: described smart card is received described packet, sends an acknowledgement to described interfacing equipment;
Step e: described interfacing equipment is received described replying, judge whether reciprocal process makes mistakes, if make mistakes, then send the error message bag that meets the CCID standard and arrive described main frame, if do not make mistakes, then finish communication, then the response message of smart card is formed the reply data bag that meets the CCID standard, and send the reply data bag to described main frame according to the regulation and the smart card of 7816 T=0 agreements;
Step F: described main frame is received described reply data bag or error message bag, and the primary information of finishing between described main frame and the described smart card is mutual.
Described steps A specifically comprises:
Steps A 1: described main frame sends the electrification reset order to described smart card;
Steps A 2: described smart card sends reset answer to described interfacing equipment;
Steps A 3: described interfacing equipment is judged the protocol type of described smart card according to described reset answer, and preserves described smart card protocol type code;
Steps A 4: described interfacing equipment is formed described reset answer and is met the packet of CCID interface standard, and sends described packet to described main frame;
Steps A 5: described main frame receives the described packet that meets the CCID interface standard.
Described steps A 3 judges that the method for the protocol type of described smart card is: described interfacing equipment judges by the layout character in the described reset answer whether the corresponding interface character exists, if exist, then described interfacing equipment is checked the value of the low nibble of last TD interface character, if the value of low nibble is 0, then the protocol type of described smart card is 7816 T=0 protocol types.
Described step C specifically comprises:
Step C1: described interfacing equipment is received described command stream, resolves the implication of described command stream;
Step C2: described interfacing equipment is determined data packet length and its position in described interfacing equipment transmitting-receiving buffering in the described command stream according to the data length sign in the described command stream;
Step C3: described interfacing equipment splits out the packet in the described command stream, and the packet header that sends described packet is to described smart card.
Described step e specifically comprises: described interfacing equipment is waited for and is received described replying, whether mistake appears in judgement and the described information interaction of smart card process, if mistake, then described interfacing equipment is unified error flag or different error message codes with described wrong the demarcation, with the described wrong error message bag that meets the CCID standard of forming, send described error message bag to described main frame, if mistake do not occur, then described interfacing equipment judges whether described replying is the process byte, if, then described interfacing equipment carries out corresponding interaction process according to 7816 T=0 agreements, described interfacing equipment is formed the reply data bag that meets the CCID standard with data and response message that smart card returns, send described reply data bag to described main frame, if described replying is status information, described interfacing equipment is formed the reply data bag that meets the CCID standard with described status information of replying, and sends described reply data bag to described main frame.
Described interfacing equipment carries out corresponding interaction process according to 7816 T=0 agreements and specifically comprises following four kinds of situations:
Situation 1: be provided with one and wait for the state that receives byte, if the process byte that described interfacing equipment value of receiving is 60H, then described interfacing equipment provides an extra work stand-by period, and returns the state that receives byte of waiting for.
Situation 2: be provided with one and wait for the state that receives byte, if the value of the process byte that described interfacing equipment receives is identical with the INS byte, then described interfacing equipment receives all data to described smart card transmission or from described smart card, and returns the state that receives byte of waiting for.
Situation 3: be provided with one and wait for the state that receives byte, if the value of the process byte that described interfacing equipment receives is identical with the complement code of INS byte, then described interfacing equipment receives next data byte to described smart card transmission or from described smart card, and returns the state that receives byte of waiting for.
Situation 4: be provided with one and wait for the state that receives byte, if what described interfacing equipment received is state byte, then described interfacing equipment returns to be waited for the state that receives byte and continues to receive next state byte, if two state bytes that receive continuously all are legal, then described interfacing equipment sends the reply data bag to described main frame.
Described interfacing equipment is the card reader that meets the CCID standard.
The present invention also provides the device of a kind of main frame and information interaction of smart card, and described device comprises usb interface module, main control module, 7816 T=0 interface modules;
Described usb interface module is used to realize that described main frame and described main control module adopt CCID standard communications protocol to carry out information interaction;
Described main control module is used to receive replying that command stream, electrification reset order and smart card that described main frame sends send, and sends packet in the command stream to smart card, and sends the reply data bag or the error message bag that meet the CCID standard and arrive described main frame;
Described 7816 T=0 interface modules are used to realize that described main control module and smart card adopt 7816 T=0 agreements to carry out information interaction.
Described usb interface module comprises that descriptor is provided with the unit and end points is provided with the unit;
Described descriptor is provided with the unit and is used for being provided with and meets descriptor and the corresponding value thereof that the CCID standard stipulates;
Described end points is provided with the unit and is used at least one OUT end points and is set to the BULK-OUT end points, and at least one IN end points is set to the BULK-IN end points, and at least one IN end points is set to interrupt endpoint.
Described main control module comprises following firmware program unit:
Resolution unit, computing unit, split cells, error message tag unit, reply component units, error message component units, error message judging unit and process byte judging unit;
Described resolution unit is used for described main control module and receives described command stream, resolves the implication of described command stream;
Described computing unit is used for the data length sign of the described command stream received according to described main control module, determines data packet length and its position in described interfacing equipment transmitting-receiving buffering in the described command stream;
Described split cells is used for splitting out the packet of the described command stream that described main control module receives;
It is unified error flag or different error message codes that described error message tag unit is used for error flag;
The described component units of replying is used for described replying formed the reply data bag that meets the CCID standard;
Described error message component units is used for the described wrong error message bag that meets the CCID standard of forming;
Described error message judging unit is used for judging whether described 7816 T=0 interface modules and described information interaction of smart card process mistake occurs, if mistake, then described error message tag unit is unified error flag or different error message codes with described wrong the demarcation, described error message component units is with the described wrong error message bag that meets the CCID standard of forming, described main control module sends described error message bag to described main frame, if mistake do not occur, the then described component units of replying is formed the reply data bag that meets the CCID standard with described replying, and described main control module sends described reply data bag to described main frame;
Described process byte judging unit is used to judge whether the replying of smart card transmission that described main control module is received is the process byte, if, described main control module carries out corresponding interaction process according to 7816 T=0 agreements, the described component units of replying will be replied the reply data bag that composition meets the CCID standard, described main control module sends the reply data bag to main frame, if not, the described component units of replying will be replied the reply data bag that composition meets the CCID standard, and described main control module sends the reply data bag to main frame.
Beneficial effect: because the present invention has introduced the CCID standard, the driver that makes main frame not need to install read-write equipment for smart card just can be finished the information interaction between main frame and interfacing equipment, improve the applicability of interfacing equipment widely, impelled the producer that produces interfacing equipment to develop better to be used for main frame and smart card to carry out the interfacing equipment of information interaction.
Description of drawings
Fig. 1 is the form block diagram that meets the command stream of CCID standard;
Fig. 2 is the form block diagram that meets the packet of CCID standard;
Fig. 3 is the process flow diagram of the embodiment of the invention;
Fig. 4 is the structure drawing of device of main frame and information interaction of smart card.
Embodiment
The invention will be further described below in conjunction with the drawings and specific embodiments, but not as a limitation of the invention.
As shown in Figure 1, the form block diagram that meets the command stream of CCID standard: the command stream that meets the CCID standard is made up of packet header and packet two parts, wherein preceding 10 bytes, i.e. 0-9 byte, be the header part that meets the command stream of CCID standard, the 10th byte is the packet part that meets the command stream of CCID standard.0 byte 6FH in the packet header represents the command type of main frame to the order of CCID equipment transmission character transmission, and CCID equipment is analyzed the order implication of this CCID command stream representative by judging this command type, carries out corresponding C CID operation of equipment.The data length of this transmission of 1-4 byte representation in the packet header, this data length of CCID equipment utilization comes the resolution data bag, by calculating the length information of 4 bytes representative, length and the position in CCID equipment transmitting-receiving buffering that can the specified data bag.
As shown in Figure 2, the form block diagram that meets the packet of CCID standard: the packet that meets the CCID standard is made up of packet header and packet two parts, wherein preceding 10 bytes, i.e. 0-9 byte, be the header part that meets the packet of CCID standard, the 10th byte is the packet part that meets the packet of CCID standard.0 byte 80H in the packet header represents the command type of CCID equipment to the order of main frame transmission character transmission, and CCID equipment is analyzed the order implication of this CCID packet representative by judging this command type, carries out corresponding C CID operation of equipment.The data length of this transmission of 1-4 byte representation in the packet header, CCID utilizes this data length to come the resolution data bag, by calculating the length information of 4 byte representatives, can determine CCID length of data package and the position in CCID equipment transmitting-receiving buffering.
Embodiment
Referring to Fig. 3, utilize the CCID command stream to realize that the smart card and the main frame that meet 7816 consensus standards carry out information interactive method, its concrete steps are as follows:
Step 101:CCID device power states it self is CCID equipment, and statement BULK-OUT, BULK-IN and interrupt endpoint also connects with main frame;
Step 102: main frame sends the electrification reset order to smart card and makes it to power on, and CCID equipment receives reset answer and analyzes, and preserves the smart card protocol type code;
Step 103:CCID equipment is received the command stream that meets the CCID standard;
Step 104:CCID device parses meets the command stream of CCID standard, splits the packet header of command stream;
Step 105:CCID equipment is judged the implication of the command stream that meets the CCID standard, if the transmission data command, then execution in step 107, if other CCID operational order, then execution in step 106;
Step 106: carry out the CCID operational order and operate accordingly;
Step 107:CCID equipment judges that to the Card Type information of preserving if the smart card of T=0 agreement, then execution in step 109, and if not the smart card of T=0 agreement, then execution in step 108;
Step 108: carry out other processing;
Step 109:CCID equipment carries out information interaction according to T=0 agreement and smart card;
Step 110:CCID equipment is known length of data package and its position in CCID equipment transmitting-receiving buffering that will send by the data length sign in the calculation command stream packet header;
Step 111:CCID equipment sends the packet header of determining good packet and arrives smart card, and receives replying of smart card;
Step 112:CCID equipment is received replying of smart card transmission, error message whether occurs in judgement and the information interaction of smart card process, if error message, then execution in step 113, if error message do not occur, then execution in step 114;
Step 113:CCID equipment customizes the return parameters of different type of errors according to the reason of makeing mistakes, and the error message bag that meets the CCID standard is formed in error message, sends the packets of information of makeing mistakes to main frame;
Whether replying that step 114:CCID equipment inspection is received is the process byte, if, execution in step 115, if not, execution in step 116;
Step 115:CCID equipment carries out corresponding interaction process according to 7816 T=0 consensus standards;
Step 116:CCID equipment is formed the reply data bag that meets the CCID standard with the replying of state byte of receiving, and sends the reply data bag to main frame;
Step 117: main frame is received reply data bag or error message bag, and the primary information of finishing between main frame and the smart card is mutual.
The process that step 102 is concrete is: the smart card that will meet 7816 agreements inserts CCID equipment, CCID equipment sends announcement information by interrupt endpoint to main frame, notice main frame smart card has inserted CCID equipment, the notified information of main frame, know that smart card has inserted CCID equipment, send the electrification reset order to CCID equipment, CCID equipment is received the electrification reset order, sending the electrification reset order to smart card makes it to power on, smart card is received the electrification reset order, the smart card electrification reset, send reset answer to CCID equipment, CCID equipment is received the reset answer that smart card sends, and judge by the layout character in the described reset answer whether the corresponding interface character exists, if exist, then CCID equipment is checked the value of the low nibble of last TD interface character, if the value of low nibble is 0, then the protocol type of described smart card is 7816 T=0 protocol types, preserve the protocol type sign, reset answer is formed the packet that meets the CCID standard, and packet is sent to main frame, main frame is received packet, know that smart card powers on, send the command stream that meets the CCID standard to CCID equipment.The agreement sign can be used for determining follow-up protocol type to smart card operation, all will use and judge this sign in whole information interactive process, and is electric down up to smart card, unless the protocol changes of other successful PPS exchange or other form is arranged.
The error message bag that meets the CCID standard in the step 113 can be an error message code independently, for example replys overtime, bad parity or grammar mistake, also can be a unified error flag.Replying overtime determination methods is: CCID equipment is being set a timer before smart card sends data, and when sending data, open this timer, CCID equipment is received the information of overtime interruption, carry out corresponding timeout treatment, and form the error message bag that meets the CCID standard, send the packets of information of makeing mistakes to main frame.The determination methods of bad parity is: CCID equipment is after sending byte to smart card, the I/O data line that detects 7816 interface modules in the CCID equipment is low, the byte that the CCID device resends sent to smart card just now, if the number of times of CCID device resends byte surpasses 7816 agreement specified standards, CCID device report bad parity then, carry out parity error and handle, and form the error message bag that meets the CCID standard, send the packets of information of makeing mistakes to main frame.The determination methods of grammar mistake is: the intelligent card data that CCID equipment receives not is the state byte of 7816 consensus standard defineds or the value of process byte, carry out the grammer error handling processing, and form the error message bag that meets the CCID standard, send the packets of information of makeing mistakes to main frame.
CCID equipment according to the detailed process that 7816 T=0 consensus standards carry out corresponding interaction process is in the step 115: be provided with one and wait for the state that receives byte; If the value of the process byte that CCID equipment receives is sexadecimal number 60H, then CCID equipment provides an extra work stand-by period, and returns the state that receives byte of waiting for; If the value of the process byte that CCID equipment receives is identical with the INS byte, represents that then CCID equipment receives all data to the smart card transmission or from smart card, and return the state that receives byte of waiting for; If the value of the process byte that CCID equipment receives is identical with the complement code of INS byte, represents that then CCID equipment receives next data byte to the smart card transmission or from smart card, and return the state that receives byte of waiting for; If what described interfacing equipment received is state byte, then described interfacing equipment returns to be waited for the state that receives byte and continues to receive next state byte, if two state bytes that receive continuously all are legal, then described interfacing equipment sends the reply data bag to described main frame.
Adopt the communications protocol that meets the CCID standard to carry out communication between main frame and the CCID equipment.
Referring to Fig. 4, the present invention also provides the device of a kind of main frame and information interaction of smart card, and device comprises usb interface module, main control module, 7816 T=0 interface modules;
Usb interface module is used to realize that main frame and main control module adopt CCID standard communications protocol to carry out information interaction;
Main control module is used to receive replying that command stream, electrification reset order and smart card that main frame sends send, and sends packet in the command stream to smart card, and transmission meets the reply data bag of CCID standard or error message bag to main frame;
7816 T=0 interface modules are used to realize that main control module and smart card adopt 7816 T=0 agreements to carry out information interaction.
Usb interface module comprises that descriptor is provided with the unit and end points is provided with the unit;
Descriptor is provided with the unit and is used for being provided with and meets descriptor and the corresponding value thereof that the CCID standard stipulates;
End points is provided with the unit and is used at least one OUT end points and is set to the BULK-OUT end points, and at least one IN end points is set to the BULK-IN end points, and at least one IN end points is set to interrupt endpoint.
Main control module comprises following firmware program unit:
Resolution unit, computing unit, split cells, error message tag unit, reply component units, error message component units, error message judging unit and process byte judging unit;
Resolution unit is used for the main control module stream that receives orders, the implication of resolve command stream;
Computing unit is used for the data length sign of the command stream received according to main control module, determines data packet length and its position in interfacing equipment transmitting-receiving buffering in the command stream;
Split cells is used for splitting out the packet of the command stream that main control module receives;
It is unified error flag or different error message codes that the error message tag unit is used for error flag;
Replying component units is used for forming the reply data bag that meets the CCID standard with replying;
The error message component units is used for mistake is formed the error message bag that meets the CCID standard;
The error message judging unit is used for judging whether 7816 T=0 interface modules and information interaction of smart card process mistake occurs, if mistake, then error message tag unit is demarcated mistake and is unified error flag or different error message codes, the error message component units is formed error message the error message bag that meets the CCID standard, main control module sends the packets of information of makeing mistakes to main frame, if mistake do not occur, then reply component units and will reply the reply data bag that composition meets the CCID standard, main control module sends the reply data bag to main frame;
Process byte judging unit is used to judge whether the replying of smart card transmission that main control module is received is the process byte, if, main control module carries out corresponding interaction process according to 7816 T=0 agreements, reply component units and will reply the reply data bag that composition meets the CCID standard, main control module sends the reply data bag to main frame, if not, to reply component units and will reply the reply data bag that composition meets the CCID standard, main control module sends the reply data bag to main frame.
Above-described embodiment is more preferably embodiment a kind of of the present invention, and the common variation that those skilled in the art carries out in the technical solution of the present invention scope and replacing all should be included in protection scope of the present invention.

Claims (13)

1. the method for main frame and information interaction of smart card, it is characterized in that, main frame and smart card connect by interfacing equipment, described main frame and described interfacing equipment adopt CCID standard communications protocol to carry out information interaction, described interfacing equipment and described smart card adopt 7816 T=0 agreements to carry out information interaction, said method comprising the steps of:
Steps A: described main frame sends the electrification reset order to described smart card, and receives the reset answer packet that meets the CCID standard, and described interfacing equipment is preserved the T=0 protocol type sign of described smart card;
Step B: described main frame sends the command stream that meets the CCID standard to described interfacing equipment;
Step C: described interfacing equipment is received described command stream, and the packet that sends in the described command stream arrives described smart card;
Step D: described smart card is received described packet, sends an acknowledgement to described interfacing equipment;
Step e: described interfacing equipment is received described replying, judge whether reciprocal process makes mistakes, if make mistakes, then send the error message bag that meets the CCID standard and arrive described main frame, if do not make mistakes, then finish communication, then the response message of smart card is formed the reply data bag that meets the CCID standard, and send the reply data bag to described main frame according to the regulation and the smart card of 7816 T=0 agreements;
Step F: described main frame is received described reply data bag or error message bag, and the primary information of finishing between described main frame and the described smart card is mutual.
2. the method for main frame as claimed in claim 1 and information interaction of smart card is characterized in that, described steps A specifically comprises:
Steps A 1: described main frame sends the electrification reset order to described smart card;
Steps A 2: described smart card sends reset answer to described interfacing equipment;
Steps A 3: described interfacing equipment is judged the protocol type of described smart card according to described reset answer, and preserves described smart card protocol type code;
Steps A 4: described interfacing equipment is formed described reset answer and is met the packet of CCID interface standard, and sends described packet to described main frame;
Steps A 5: described main frame receives the described packet that meets the CCID interface standard.
3. the method for main frame as claimed in claim 2 and information interaction of smart card, it is characterized in that, described steps A 3 judges that the method for the protocol type of described smart card is: described interfacing equipment judges by the layout character in the described reset answer whether the corresponding interface character exists, if exist, then described interfacing equipment is checked the value of the low nibble of last TD interface character, if the value of low nibble is 0, then the protocol type of described smart card is 7816 T=0 protocol types.
4. the method for main frame as claimed in claim 1 and information interaction of smart card is characterized in that, described step C specifically comprises:
Step C1: described interfacing equipment is received described command stream, resolves the implication of described command stream;
Step C2: described interfacing equipment is determined data packet length and its position in described interfacing equipment transmitting-receiving buffering in the described command stream according to the data length sign in the described command stream;
Step C3: described interfacing equipment splits out the packet in the described command stream, and the packet header that sends described packet is to described smart card.
5. the method for main frame as claimed in claim 1 and information interaction of smart card is characterized in that, described step e specifically comprises: described interfacing equipment is waited for described the replying of reception, mistake whether occurs in judgement and the described information interaction of smart card process,
If mistake, then described interfacing equipment is unified error flag or different error message codes with described wrong the demarcation, with the described wrong error message bag that meets the CCID standard of forming, sends described error message bag to described main frame,
If mistake do not occur, then described interfacing equipment judges whether described replying is the process byte, if, then described interfacing equipment carries out corresponding interaction process according to 7816 T=0 agreements, described interfacing equipment is formed the reply data bag that meets the CCID standard with data and response message that smart card returns, send described reply data bag to described main frame, if described replying is status information, described interfacing equipment is formed the reply data bag that meets the CCID standard with described status information of replying, and sends described reply data bag to described main frame.
6. the method for main frame as claimed in claim 5 and information interaction of smart card, it is characterized in that, the concrete grammar that described interfacing equipment carries out corresponding interaction process according to 7816 T=0 agreements is: be provided with one and wait for the state that receives byte, if described interfacing equipment value of receiving is the process byte of 60H, then described interfacing equipment provides an extra work stand-by period, and returns the state that receives byte of waiting for.
7. the method for main frame as claimed in claim 5 and information interaction of smart card, it is characterized in that, the concrete grammar that described interfacing equipment carries out corresponding interaction process according to 7816 T=0 agreements is: be provided with one and wait for the state that receives byte, if the value of the process byte that described interfacing equipment receives is identical with the INS byte, then described interfacing equipment receives all data to described smart card transmission or from described smart card, and returns the state that receives byte of waiting for.
8. the method for main frame as claimed in claim 5 and information interaction of smart card, it is characterized in that, the concrete grammar that described interfacing equipment carries out corresponding interaction process according to 7816 T=0 agreements is: be provided with one and wait for the state that receives byte, if the value of the process byte that described interfacing equipment receives is identical with the complement code of INS byte, then described interfacing equipment receives next data byte to described smart card transmission or from described smart card, and returns the state that receives byte of waiting for.
9. the method for main frame as claimed in claim 5 and information interaction of smart card, it is characterized in that, the concrete grammar that described interfacing equipment carries out corresponding interaction process according to 7816 T=0 agreements is: be provided with one and wait for the state that receives byte, if what described interfacing equipment received is state byte, then described interfacing equipment returns to be waited for the state that receives byte and continues to receive next state byte, if two state bytes that receive continuously all are legal, then described interfacing equipment sends the reply data bag to described main frame.
10. as the method for any described main frame of claim and information interaction of smart card among the claim 1-9, it is characterized in that described interfacing equipment is the card reader that meets the CCID standard.
11. the device of main frame and information interaction of smart card is characterized in that described device comprises usb interface module, main control module, 7816 T=0 interface modules;
Described usb interface module is used to realize that described main frame and described main control module adopt CCID standard communications protocol to carry out information interaction;
Described main control module is used to receive replying that command stream, electrification reset order and smart card that described main frame sends send, and sends packet in the command stream to smart card, and sends the reply data bag or the error message bag that meet the CCID standard and arrive described main frame;
Described 7816 T=0 interface modules are used to realize that described main control module and smart card adopt 7816 T=0 agreements to carry out information interaction.
12. the device of main frame as claimed in claim 11 and information interaction of smart card is characterized in that, described usb interface module comprises that descriptor is provided with the unit and end points is provided with the unit;
Described descriptor is provided with the unit and is used for being provided with and meets descriptor and the corresponding value thereof that the CCID standard stipulates;
Described end points is provided with the unit and is used at least one OUT end points and is set to the BULK-OUT end points, and at least one IN end points is set to the BULK-IN end points, and at least one IN end points is set to interrupt endpoint.
13. the device of main frame as claimed in claim 11 and information interaction of smart card is characterized in that, described main control module comprises following firmware program unit:
Resolution unit, computing unit, split cells, error message tag unit, reply component units, error message component units, error message judging unit and process byte judging unit;
Described resolution unit is used for described main control module and receives described command stream, resolves the implication of described command stream;
Described computing unit is used for the data length sign of the described command stream received according to described main control module, determines data packet length and its position in described interfacing equipment transmitting-receiving buffering in the described command stream;
Described split cells is used for splitting out the packet of the described command stream that described main control module receives;
It is unified error flag or different error message codes that described error message tag unit is used for error flag;
The described component units of replying is used for described replying formed the reply data bag that meets the CCID standard;
Described error message component units is used for the described wrong error message bag that meets the CCID standard of forming;
Described error message judging unit is used for judging whether described 7816 T=0 interface modules and described information interaction of smart card process mistake occurs, if mistake, then described error message tag unit is unified error flag or different error message codes with described wrong the demarcation, described error message component units is with the described wrong error message bag that meets the CCID standard of forming, described main control module sends described error message bag to described main frame, if mistake do not occur, the then described component units of replying is formed the reply data bag that meets the CCID standard with described replying, and described main control module sends described reply data bag to described main frame;
Described process byte judging unit is used to judge whether the replying of smart card transmission that described main control module is received is the process byte, if, described main control module carries out corresponding interaction process according to 7816 T=0 agreements, the described component units of replying will be replied the reply data bag that composition meets the CCID standard, described main control module sends the reply data bag to main frame, if not, the described component units of replying will be replied the reply data bag that composition meets the CCID standard, and described main control module sends the reply data bag to main frame.
CNB2006101139731A 2006-10-23 2006-10-23 Method and apparatus for host machine and smart card to conduct information interaction Expired - Fee Related CN100414556C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006101139731A CN100414556C (en) 2006-10-23 2006-10-23 Method and apparatus for host machine and smart card to conduct information interaction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006101139731A CN100414556C (en) 2006-10-23 2006-10-23 Method and apparatus for host machine and smart card to conduct information interaction

Publications (2)

Publication Number Publication Date
CN1936917A CN1936917A (en) 2007-03-28
CN100414556C true CN100414556C (en) 2008-08-27

Family

ID=37954414

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006101139731A Expired - Fee Related CN100414556C (en) 2006-10-23 2006-10-23 Method and apparatus for host machine and smart card to conduct information interaction

Country Status (1)

Country Link
CN (1) CN100414556C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105162498B (en) * 2015-09-28 2018-09-25 飞天诚信科技股份有限公司 Bluetooth adapter and its communication means
CN107689946B (en) * 2016-08-05 2020-04-17 李明 Data communication method and data communication system
CN107688760B (en) * 2016-08-05 2020-04-21 李明 Data communication method and data communication system
US10609552B2 (en) 2016-08-05 2020-03-31 Tendyron Corporation System and method for data communication protection
CN109727438B (en) * 2018-12-26 2021-06-22 浙江西盈科技股份有限公司 Method for serial number interaction between remote controller and host

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1418349A (en) * 2000-03-15 2003-05-14 施蓝姆伯格***公司 Method of communication between smart card and host station
CN2572474Y (en) * 2002-10-09 2003-09-10 中国印钞造币总公司 Analog card device
US20040211835A1 (en) * 2003-04-22 2004-10-28 Stmicroelectronics, Inc. Smart card device used as mass storage device
CN1841296A (en) * 2005-03-15 2006-10-04 美国凹凸微系有限公司 Method and apparatus for contactless ICC connectivity

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1418349A (en) * 2000-03-15 2003-05-14 施蓝姆伯格***公司 Method of communication between smart card and host station
CN2572474Y (en) * 2002-10-09 2003-09-10 中国印钞造币总公司 Analog card device
US20040211835A1 (en) * 2003-04-22 2004-10-28 Stmicroelectronics, Inc. Smart card device used as mass storage device
CN1841296A (en) * 2005-03-15 2006-10-04 美国凹凸微系有限公司 Method and apparatus for contactless ICC connectivity

Also Published As

Publication number Publication date
CN1936917A (en) 2007-03-28

Similar Documents

Publication Publication Date Title
CN101719054B (en) Method and device for realizing multi-card slot access
CN100474857C (en) Method for information interaction between host computer and smart card
CN100468440C (en) Method and device for information interaction between host and smart card
US6769622B1 (en) System and method for simulating universal serial bus smart card device connected to USB host
CN100414556C (en) Method and apparatus for host machine and smart card to conduct information interaction
US8346991B2 (en) Multi-function peripheral device, corresponding method and electronic system having a peripheral and a host communicating via a single interface
CN108141733B (en) NFC split stack architecture
CN101765830A (en) Method for processing application commands from physical channels using a portable electronic device and corresponding device and system
US20140289465A1 (en) Smart card, portable electronic device and smart card processing device
CN103294509A (en) Multi-serial equipment driving process for VxWorks operating system
CN103414497B (en) For communication between electronic by the control method forwarded and corresponding equipment
US20120124066A1 (en) Secs communication device and secs communication method thereof
CN102968325A (en) USB (Universal Serial Bus) equipment and method and device for automatically initializing same
CN102521197A (en) Method for realizing ISO7816 protocol with UART (universal asynchronous receiver/transmitter) of low-cost MCU (micro-control unit)
CN101699416A (en) Communication method and system between host computer and card reader with multiple card holders
CN100424665C (en) Method and device for implementing CCID equipment
CN105117761A (en) Label information processing method
CN107302522B (en) USB-based SpaceWire network plug and play base protocol
CN113806153B (en) Chip verification method
EP1710759A1 (en) Terminal equipment
US7185119B2 (en) Method and apparatus for checking and analyzing the state of peripherals wherein state information is converted into a pattern of identification information
CN103326752B (en) The control method deactivated by interface for communication between electronic and relevant device
CN101630295A (en) Omnipotent drive method for IC card and system using same
CN111522588B (en) Chip operation interaction method and communication system based on SWD protocol
KR100622828B1 (en) Communication Method of Serial Communication System

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee

Owner name: FEITIAN CHENGXIN TECHNOLOGIES CO., LTD.

Free format text: FORMER NAME: BEIJING FEITIAN CHENGXIN SCIENCE + TECHNOLOGY CO. LTD.

CP03 Change of name, title or address

Address after: 100085 Beijing city Haidian District Xueqing Road No. 9 Ebizal building B block 17 layer

Patentee after: Feitian Technologies Co.,Ltd.

Address before: 100083, Haidian District, Xueyuan Road, No. 40 research, 7 floor, 5 floor, Beijing

Patentee before: FEITIAN TECHNOLOGIES Co.,Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20080827