Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, embodiment of the present invention is described further in detail below in conjunction with accompanying drawing.
Embodiment 1
For the response message content that solves when logic encryption card is modified, cause the read write line can't the identification card type, thus the problem that can't operate card, the embodiment of the invention provides a kind of recognition methods of logic encryption card.Referring to Fig. 1, this method may further comprise the steps:
S1: the response message of read write line receive logic encrypted card;
S2: this read write line judges according to this response message whether the type of card of this logic encryption card is known, if, execution in step S3, if not, execution in step S4;
S3: this read write line sends to main frame and comprises the known success ATR that powers on of type of card, and type of card is kept in this read write line execution in step S8;
S4: this read write line sends the success ATR that powers on that comprises type of card the unknown to main frame;
S5: this read write line receives the instruction that this main frame issues, and this read write line judges whether the instruction that receives is to set the type of card instruction, if, execution in step S6, if not, execution in step S9;
S6: the type of card that this read write line will be set appointment in the type of card instruction is kept in this read write line, or,
The type of card that this read write line will be set appointment in the type of card instruction is kept in this read write line, and will set type of card instruct in the response message of type of card of appointment write this logic encryption card;
S7: this read write line sends to this main frame and sets the type of card successful information;
S8: this read write line receives the instruction that this main frame issues;
S9: this read write line loads corresponding card processing module according to the type of card of preserving in this read write line;
S10: this read write line is carried out this instruction according to this card processing module, card is operated, and the execution result that will instruct returns to this main frame.
The embodiment of the invention is by strengthening the recognition capability of read write line to the logical encrypt Card Type, add the type of card unknown state, and issue the information of setting type of card or the method for revising response message according to this state by main frame, make when the response message of logic encryption card is changed, still can strengthen user's experience by this method identification and operation.
Embodiment 2
In order to solve when the change of the response message content of logic encryption card, cause the read write line can't the identification card type, thus the problem that can't operate card, the embodiment of the invention provides a kind of recognition methods of logic encryption card.Referring to Fig. 2, this method may further comprise the steps:
201: read write line is connected to main frame by usb bus;
After read write line and main frame connected, the standard of following CCID (USB Chip/Smart Card Interface Devices-USB, chip intelligent card equipment) agreement was carried out the transmitting-receiving of mutual, the instruction of data by usb bus.
202: when logic encryption card inserts with main frame is connected read write line, read write line is to main frame transmission insertion status data;
Wherein, this insertion status data is specially " 0x5003 ".
203: main frame receives the insertion status data that read write line sends, and issues the order that powers on;
Wherein, this order that powers on is specially 0,x62 00 00 00 00 00 02 01 00 00.
204: read write line receives the order that powers on that main frame issues, and sends reset timing to logic encryption card;
Wherein, this reset timing is the sequential that meets ISO7816 agreement regulation, after read write line receives power on order or the card operational order that main frame issues, all will send the reset timing that meet ISO7816 agreement regulation by the logic encryption card in draw-in groove.
205: after logic encryption card receives reset timing, to read write line echo reply information;
Wherein, the length of response message is generally four bytes, is positioned at preceding four bytes of logical encrypt card memory area.For example: the response message of SLE4442 card correspondence is 0,xa2 13 10 91;
The response message length of logic encryption card also can be two bytes, and corresponding, the response message of such logic encryption card writes in preceding two bytes of this logical encrypt card memory area.
206: whether the response message that read write line returns according to logic encryption card, judgement power on successful, if power on successfully, carry out steps 207, if it is unsuccessful to power on, and execution in step 216;
Particularly, judge and to power on whether successful method is: read write line reads the response message that logic encryption card returns, if logic encryption card no response or the data length that returns, form are incorrect, and the logic encryption card operation failure that powers on then, otherwise the presentation logic encrypted card powers on successfully.
207: read write line judges according to the response message that logic encryption card returns whether type of card is known, if then execution in step 208, otherwise, execution in step 210;
Wherein, judge whether known method specifically comprises type of card: the response message that returns according to logic encryption card, the read write line inquiry is preset in the response message and the type of card matching list of read write line inside, if this response message can find corresponding type of card in response message that is preset in read write line inside and type of card matching list, then type of card is known, otherwise, then type of card the unknown.
Wherein, the content in response message and the type of card matching list is the corresponding relation of response message and type of card, the corresponding type of card of a response message.
For example: a response message " 1111 " is arranged, this information can find a type of card " A " corresponding with it in response message and type of card matching list, then type of card is known, one response message " 2222 " is arranged again, this information can't find the type of card corresponding with it in response message and type of card matching list, then type of card is unknown.
In the present embodiment, if this response message is four bytes, 0,xa2 13 10 91 o'clock, read write line can be learnt that this type of card is the SLE4442 card by response message and type of card matching list, read write line is preserved the SLE4442 type of card.
208: read write line sends to main frame and includes the known success ATR that powers on of type of card, and preserves type of card in register;
In embodiments of the present invention, read write line is 0,x80 03 00 00 0,000 02 00 00 00 3b 01 55 to the success ATR that powers on that main frame sends;
Wherein, preceding 11 the byte 0,x80 03 00 00 00 00 02 00 00 003b presentation logic encrypted cards that power among the success ATR power on successfully;
Wherein, the data 0x55 of the 13 byte represents that type of card is known;
Wherein, second byte 0x03 represents that the length of the tenth data that byte is later among this ATR is 3 bytes, the data 0x01 of the 12 byte represents that the length of the later partial data section of the 12 byte is 1 byte, whether the data representation type of card of the 13 byte is known, main frame can be different according to content in the data segment with read write line, preset to be used for representing the data that type of card is known or unknown.
Further, the read write line response message that logic encryption card can also be returned also is encapsulated among the success ATR that powers on and sends to main frame; For example, the success ATR that powers on can also be 0,x80 07 00 00 00 00 02 0,000 00 3b 05 55 a2 13 10 91, wherein, the data 0x55 of the 13 byte represents that type of card is known, and the 14 to the 17 byte is the response message that logic encryption card returns.
209: main frame sends instructions under read write line, execution in step 212;
Wherein, the standard format of card operational order is as shown in the table:
CLA |
INS |
P1 |
P2 |
LC/LE |
Data1 |
Data2 |
00 |
C0 |
00 |
01 |
------ |
------ |
------ |
00 |
A4 |
00 |
00 |
02 |
04 |
00 |
Wherein, the card instruction is read in instruction 0x00 a4 00 00 02 04 00 expressions, and 0xa4 represents setup parameter, and P1 position 0x00 represents to read the main storage area, and Data1 represents start address in the position.
210: read write line sends the success ATR that powers on that includes type of card unknown identification information to main frame;
In the present embodiment, the success ATR that powers on that read write line returns to main frame is 0,x80 03 00 00 00 0,002 00 00 00 3b 01 aa, and the presentation logic encrypted card powers on successfully, and type of card the unknown;
Further, the response message of the read write line the unknown that logic encryption card can also be returned of read write line also is encapsulated among the success ATR that powers on and sends to main frame; For example, the success ATR that powers on can also be 0x800700000000020000003b 05aa 11 22 33 44, wherein, the data 0xaa of the 13 byte represents type of card the unknown, and the 13 the later part of byte is the response message that logic encryption card returns.
211: main frame receives the success ATR that powers on that includes type of card unknown identification information, issues to read write line and sets type of card instruction, execution in step 212;
Wherein, setting the type of card instruction is main frame and the default instruction of read write line, revises the instruction of the type of card of logic encryption card for indicating read write line, includes the default type of card of main frame in this setting type of card instruction;
In the embodiment of the invention, main frame is 0x00c00001 to the setting type of card instruction that read write line sends;
Wherein, the INS location conten is 0xc0 in this instruction, represents that this instruction is to set the type of card instruction, and the P2 argument section is 0x01, and it is the SLE4442 card that expression is provided with type of card;
Several type of card setting commands in addition are as shown in the table:
1 |
0x00?c0?00?01 |
Setting type of card is the SLE4442 card |
2 |
0x00?c0?00?02 |
Setting type of card is the SLE4428 card |
3 |
0x00?c0?00?03 |
Setting type of card is the AT1608 card |
4 |
0x?00c?00004 |
Setting type of card is branch cards such as AT1604 |
5 |
0x?00c?00005 |
Setting type of card is not five equilibrium card of AT1604 |
212: read write line judges whether the instruction that receives is to set the type of card instruction, if instruction is to set the type of card instruction, and execution in step 213, if not, then this instruction is the card operational order, execution in step 214;
Particularly, if the INS location conten is 0xc0 in the instruction, represent that this instruction is to set the type of card instruction; If not, represent that this instruction is to set type of card instruction card operational order in addition.
213: read write line is preserved the type of card of setting appointment in the type of card instruction, and returns setting type of card successful information, execution in step 209 to main frame;
In the embodiment of the invention, after read write line received and sets type of card instruction 0x0,0c0 00 01, read write line was preserved the SLE4442 type of card in register;
Wherein, read write line is preserved type of card in register after, return setting type of card successful information and be specially 0x9000.
214: read write line receives the card operational order that main frame issues, and uses corresponding card processing module to analyze the card operational order that main frame issues according to type of card, and logic encryption card is operated;
Read write line loads corresponding card processing module according to the type of card of preserving in the read write line after receiving the card operational order that main frame issues then, and read write line is operated card according to the operational order that main frame issues by the card processing module;
Wherein, the card processing module is that itself has in the read write line, the card processing module that dissimilar logic encryption cards is corresponding different.In the card processing module of read write line, the mapping relations of preserving a card operational order after the card processing module is analyzed the type and order parameter of card operational order, issue corresponding instruction and give logic encryption card, and logic encryption card is operated.
For example, when main frame will read data in the logic encryption card in the read write line, read write line successively received two instructions that main frame issues:
0x6f 07000000002500000000a40000020000 and
0x6f?05000000002600000000b0000005,
Wherein article one instruction is for setting the Card Reader parameter instruction, the card processing module is analyzed this instruction to be needed logic encryption card is carried out read operation as can be known, the side-play amount of the start address of reading of data is 04, a setup parameter successful information is returned to main frame in read write line setup parameter success back, receives the second instruction then;
The data length that the second instruction that the analysis of card processing module receives needs to read as can be known is 5 bytes, and the card processing module sends instruction to logic encryption card then, reads the data in the logic encryption card;
The card processing module sends 5 Card Reader instructions according to known parameters to logic encryption card, reads the data of a byte at every turn:
0x300400,0x300500,0x300600,0x300700,0x300800
Correspondingly, logic encryption card whenever receives a Card Reader instruction and returns 1 byte data to read write line.
In embodiments of the present invention, what preserve in the register is the SLE4442 type of card, read write line loads SLE4442 card processing module and analyzes the card operational order that main frame issues according to the SLE4442 card processing module that loads, and logic encryption card is operated accordingly.
215: read write line finishes to main frame link order execution result.
In step 215, the data that read write line returns logic encryption card send to main frame after encapsulating according to the standard of CCID agreement again.
216: read write line returns the failure ATR that powers on to main frame.
In step 216, this failure ATR that powers on is specially 0x8000000000000241fe 00;
The embodiment of the invention also provides the recognition methods of another kind of logic encryption card: after the step 210, after read write line is judged type of card the unknown according to the response message of logic encryption card, send the success ATR that powers on that includes type of card unknown identification information to main frame, main frame issues to read write line and sets the type of card instruction, the response message of preserving in this instruction indication read write line correction logic encrypted card, when needing that later on this is sticked into line operate, type of card is known again.
In step 212, read write line receives the setting type of card instruction 0x00c00001 that main frame issues, and judges that this instruction that receives is that step 213 is replaceable to be following method after setting the type of card instruction, and referring to Fig. 3, this method specifically may further comprise the steps:
301: the type of card that read write line will be set appointment in the type of card instruction is kept in the read write line, and inquiry is preset in this type of card response message of read write line inside;
In embodiments of the present invention, read write line is according to setting type of card instruction 0x00c 00001, obtaining the corresponding type of card of this setting type of card instruction is SLE4442, inquiry is preset in the response message and the type of card matching list of read write line inside, and the response message that draws the logic encryption card of SLE4442 card correspondence is 0xa2131091.
302: the response message of the corresponding type of card that read write line will inquire writes logic encryption card;
Particularly, the position that is written to stored logic encrypted card response message in the logic encryption card main storage area of the response message content byte-by-byte of the read write line corresponding type of card that will inquire;
The response message of the corresponding type of card that read write line will inquire writes before the logic encryption card, also will load and the corresponding card processing module of type of card;
In embodiments of the present invention, because type of card is SLE4442, Card Reader is write the card processing module that loads SLE4442 card correspondence;
In embodiments of the present invention, read write line writes response message in logic encryption card detailed process is specially: read write line divides and writes the response message of four byte lengths to the main storage area of logic encryption card four times, writes a byte at every turn;
In the embodiment of the invention, read write line sends following four to logic encryption card successively and writes the card instruction:
0x3800a2,0x380113,0x380210,0x380391;
Wherein, the 1st byte writing the card instruction is to write the instruction head of card instruction, and 0x38 represents to write data to the main storage area, and the 2nd byte representation writing the card instruction writes the address offset amount of data, writes the 3rd particular content that byte representation writes of card instruction.
303: read write line is write card success back and is write the card successful information to the main frame transmission.
Wherein, write the card successful information and be specially 0x9000;
If read write line is write card crash, then send and write card crash information to main frame, information is specially 0x6d 00.
The embodiment of the invention is by strengthening the recognition capability of read write line to the logical encrypt Card Type, add the type of card unknown state, and issue the information of setting type of card or the method for revising response message according to this state by main frame, make when the response message of logic encryption card is changed, still can strengthen user's experience by this method identification and operation.The embodiment of the invention can utilize software to realize that corresponding software programs can be stored in the storage medium that can read, for example, and in the hard disk of computing machine, buffer memory or the CD.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.