CN102495754B - Cache-based java card transaction processing method - Google Patents

Cache-based java card transaction processing method Download PDF

Info

Publication number
CN102495754B
CN102495754B CN201110332419.3A CN201110332419A CN102495754B CN 102495754 B CN102495754 B CN 102495754B CN 201110332419 A CN201110332419 A CN 201110332419A CN 102495754 B CN102495754 B CN 102495754B
Authority
CN
China
Prior art keywords
virtual machine
java card
data structure
card virtual
memory
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
CN201110332419.3A
Other languages
Chinese (zh)
Other versions
CN102495754A (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
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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201110332419.3A priority Critical patent/CN102495754B/en
Publication of CN102495754A publication Critical patent/CN102495754A/en
Application granted granted Critical
Publication of CN102495754B publication Critical patent/CN102495754B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a cache-based java card transaction processing method and belongs to the field of information safety. The method comprises the following steps of: 1, energizing a java card virtual machine, judging whether a power-failure protection function is required to be started, if so, starting the power-failure protection function and directly executing the step 3, otherwise, executing the step 2; 2, performing transaction processing initialization; 3, acquiring an applet byte code; and 4, analyzing the applet byte code, if the applet byte code is a byte code which corresponds to a first application program interface, calling the first application program interface and executing the step 3, if the applet byte code is the byte code which corresponds to a first function, calling the first function and executing the step 3, if the applet byte code is the byte code which corresponds to a second function, calling the second function and executing the step 3, if the applet byte code is the byte code which corresponds to a second application program interface, calling the second application program interface and executing the step 3, if the applet byte code is the byte code which corresponds to a third application program interface, calling the third application program interface and executing the step 3, and if the applet byte code is other byte codes, executing corresponding operation according to the byte code and executing the step 3.

Description

Java card transaction methods based on buffer memory
Technical field
The present invention relates to information security field, particularly a kind of java card transaction methods based on buffer memory.
Background technology
The integrated circuit of smartcard internal comprises central processor CPU, programmable read only memory EEPROM (Electrically Erasable Programmable Read-Only Memory), random access memory ram (Random Access Memory) and is solidificated in the chip operating system COS (Chip Operating System) in read only memory ROM (Read-Only Memory).The Performance Ratio of smart card is lower at present, what wherein have the greatest impact is too much to the write operation of EEPROM, yet, issued transaction relevant portion accounts for 75% left and right of EEPROM write operation sum to the write operation of EEPROM, so, improve the performance of smart card, the optimization of transaction processing facility is the task of being badly in need of solution.
Summary of the invention
In view of the deficiencies in the prior art, in order to improve the performance of smart card, the present invention proposes a kind of java card transaction methods based on buffer memory.
The technical solution used in the present invention is as follows:
Comprise:
S1:java card virtual machine powers on, and judges whether to start power down protection, is to carry out power down protection, then carries out S3, otherwise carries out S2;
S2:java card virtual machine carries out issued transaction initialization, carries out S3;
S3:java card virtual machine obtains applet bytecode;
S4: described java card virtual machine is resolved described applet bytecode;
When parsing obtain be bytecode corresponding to the first application programming interfaces time, call the first application programming interfaces and start affairs, return to S3;
When parsing obtain be bytecode corresponding to the first function time, call the first function and write data, return to S3, comprising:
Steps A: when issued transaction zone bit is effectively and when the length that includes the first data structure of current former data is less than or equal to the residual memory space of backup buffer area of described second memory, described java card virtual machine judges in the backup buffers of described second memory whether have the first data structure body that includes described current former data;
As there are for described java card virtual machine the current former data in the first data structure body as described in current new value replacement;
If java card virtual machine as described in not existing by as described in current former data according to the first preset data architecture, backup to as described in the backup buffers of second memory, and described current new value is written in the new value buffer zone of described second memory according to the second preset data architecture; First data structure of storing in the backup buffer area of described second memory, to be newly worth what in buffer area, store be the second data structure, in the backup buffer area of described first memory, store be the 3rd data structure, the storage of former data storage area be former data and/or new value;
When parsing obtain be bytecode corresponding to the second function time, call the second function read data, return to S3, comprising:
When issued transaction sign is effective, described java card virtual machine reads new value from include described second data structure of whole reading address; Or
Described java card virtual machine reads corresponding new value according to described reading address from the second data structure, according to described reading address, from the former data buffer area of described first memory, read former data, and with described in the identical corresponding part of the writing address with described new value in the former data that read described in replacing of the new value that reads;
When parsing obtain be bytecode corresponding to the second application programming interfaces time, call the second application programming interfaces and submit affairs to, return to S3, comprising:
When issued transaction sign is effective and the whole zone bit of the backup buffers of described second memory is effective, described java card virtual machine backups to the former data in described the first data structure in the backup buffers of described first memory according to the 3rd preset data architecture, new value in the second data structure in the new value buffer zone of described second memory is written in the former data storage area of described first memory in corresponding writing address, remove the first data structure and the second data structure, and the value of issued transaction zone bit is set to invalid;
When parsing obtain be bytecode corresponding to the 3rd application programming interfaces time, call the 3rd application programming interfaces and stop affairs, return to S3, comprising:
When issued transaction sign is effective, it is the former data in effective the 3rd data structure that described java card virtual machine reduces zone bit in the backup buffers of described first memory; Remove the first data structure and the second data structure;
When parsing obtain be other bytecodes time, according to described bytecode, carry out corresponding operating, return to S3.
Described java card virtual machine is resolved described applet bytecode and is comprised:
Step a: described java card virtual machine judges whether the first byte in described applet bytecode is first byte of making an appointment, and is to perform step b, otherwise returns to S3;
Step b: described java card virtual machine is according to the byte search index table except first byte in described applet bytecode, and judge in described applet bytecode, whether the byte except first byte is the byte of making an appointment;
As described in applet bytecode the byte except first byte be second byte of making an appointment, described applet bytecode is bytecodes corresponding to described the first application programming interfaces, described java card virtual machine call the first application programming interfaces start affairs, return to S3;
As described in applet bytecode the byte except first byte be the 3rd byte of making an appointment, described applet bytecode is bytecode corresponding to described the first function, described java card virtual machine call the first function is write data, returns to S3;
As described in applet bytecode the byte except first byte be the nybble of making an appointment, described applet bytecode is bytecode corresponding to described the second function, described java card virtual machine call the second function read data, returns to S3;
As described in applet bytecode the byte except first byte be the 5th byte of making an appointment, described applet bytecode is bytecodes corresponding to described the second application programming interfaces, described java card virtual machine call the second application programming interfaces are submitted affairs to, return to S3;
As described in applet bytecode the byte except first byte be the 6th byte of making an appointment, described applet bytecode is bytecodes corresponding to described the 3rd application programming interfaces, described java card virtual machine call the 3rd application programming interfaces stop affairs, return to S3;
As described in applet bytecode the byte except first byte for other bytes, call corresponding interface and carry out corresponding operating, return to S3.
Described java card virtual machine call the first application programming interfaces start things and comprise:
When the first application programming interfaces of java card are called, described java card virtual machine judges whether the value of issued transaction zone bit is true, is to report an error, otherwise the value of issued transaction zone bit is set to true.
Described steps A is specially:
Steps A 1: when described first function of java card is called, described java card virtual machine judges whether the value of described issued transaction zone bit is true, is to perform step A3, otherwise execution step A2;
Steps A 2: described java card virtual machine is replaced the current former data in the former data storage area of described first memory with receiving current new value;
Steps A 3: whether the length that described java card virtual machine judgement includes the second data structure of described current new value is greater than the storage space of the backup buffer area of described the second memory block, is to perform step A4, otherwise execution step A6;
Steps A 4: described java card virtual machine reads described current former data from the former data storage area of described first memory, and described current former data are backuped in the backup buffers of described first memory according to the 3rd preset data architecture;
Steps A 5: described java card virtual machine uses the current new value receiving to replace the current former data in the former data storage area of described first memory;
Steps A 6: described java card virtual machine judges the residual memory space in the backup buffer area of described second memory includes the length of the second data structure of described current new value described in whether being greater than, and is to perform step A7, otherwise execution step A8;
Steps A 7: whether described java card virtual machine judgement exists the first data structure of the former data in current new value writing address in the former data storage area that includes described first memory in the backup buffers of described second memory, as existed, perform step A12, if do not existed, perform step A10;
Steps A 8: described java card virtual machine reads described current former data from the former data storage area of described first memory, and described current former data are backuped in the backup buffers of described first memory by described the 3rd preset data architecture;
Steps A 9: described java card virtual machine reads the data in described the second data structure, and with described in current former data in the former data storage area of first memory described in the data replacement that reads, remove described the second data structure and the first data structure, order performs step A10;
Steps A 10: described java card virtual machine reads described current former data from the former data storage area of described first memory, and the described current former data that read are backuped in the backup buffers of described second memory according to described the first preset data architecture;
Steps A 11: described java card virtual machine is written in the new value buffer zone of second memory by described current new value according to described the second preset data architecture;
Steps A 12: described java card virtual machine is replaced the corresponding data in described the second data structure by described current new value.
Described java card virtual machine call the second function read data comprises:
Step B: when the value of issued transaction zone bit is true, whether the new value writing address of described java card virtual machine judgement in described the second data structure comprises reading address;
As comprise whole reading address, described java card virtual machine reads corresponding new value according to described reading address from described the second data structure body;
As comprise reading address, described java card virtual machine reads corresponding former data from the former data storage area of described first memory according to described reading address, from described the second data structure body, according to described reading address, read corresponding new value, and replace the identical corresponding part of the writing address with described new value in described former data by described new value;
If do not comprised reading address, described java card virtual machine reads corresponding former data from the former data storage area of described first memory according to described reading address.
Described step B is specially:
Step B1: when described second function of java card is called, described java card virtual machine judges whether the value of issued transaction sign is true, is to perform step B3, otherwise execution step B2;
Step B2: described java card virtual machine reads corresponding former data from the former data storage area of described first memory according to described reading address;
Step B3: described java card virtual machine, using first first data structure as current data structure, judges whether the zone bit of described current data structure is effectively, is to perform step B4, otherwise execution step B14;
Step B4: described java card virtual machine judges in described current data structure whether comprise reading address, if comprise whole described reading address, perform step B5, if the described reading address that comprises part performs step B6, if do not comprise described reading address, do not perform step B14;
Step B5: described java card virtual machine reads corresponding new value from described the second data structure according to described reading address;
Step B6: described java card virtual machine reads corresponding former data from the former data storage area of first memory according to described reading address;
Step B7: described java card virtual machine reads corresponding new value according to described reading address from described the second data structure, and replaces corresponding part identical with the writing address of described new value in the former data that read in described step B6 by described new value;
Step B8: described java card virtual machine judges whether described current data structure is last, is to return to S3, otherwise execution step B9;
Step B9: described java card virtual machine is using the first data structure of the next one in the backup buffers of described second memory as current data structure;
Step B10: described java card virtual machine judges whether the zone bit of described current data structure is effectively, is to perform step B11, otherwise returns to execution step B8;
Step B11: described java card virtual machine judges whether described current data structure comprises the remainder of described reading address, if the remainder that comprises whole described reading address performs step B13, if the remainder that comprises the described reading address of part performs step B12, if do not comprise the remainder of described reading address, return to execution step B8;
Step B12: described java card virtual machine reads corresponding new value according to the remainder of described reading address from described the second data structure, and with described in the new value that reads replace corresponding part identical with the writing address of described new value in the former data that read in described step B6, return to execution step B8;
Step B13: described java card virtual machine reads corresponding new value according to the remainder of described reading address from described the second data structure, and with described in the new value that reads replace corresponding part identical with the writing address of described new value in the former data that read in described step B6;
Step B14: described java card virtual machine judges whether described current data structure is last, is to perform step B15, otherwise execution step B16;
Step B15: described java card virtual machine reads corresponding former data from the former data storage area of described first memory according to described reading address;
Step B16: described java card virtual machine is using the next data structure in the backup buffers of described second memory as current data structure;
Step B17: described java card virtual machine judges whether the zone bit of described current data structure is effectively, is to perform step B18, otherwise returns to execution step B14;
Step B18: described java card virtual machine judges whether described current data structure wraps described containing reading address, if comprise whole described reading address, perform step B19, if comprise the described reading address of part, return to execution step B6, if do not comprise described reading address, do not return to execution step B14;
Step B19: described java card virtual machine reads corresponding new value according to described reading address from described the second data structure.
Described java card virtual machine call the second application programming interfaces submit to affairs to comprise:
Step C: when the value of issued transaction zone bit is true, described java card virtual machine judges that whether the whole zone bit of backup buffers of second memory is effective;
Be the former data in the backup buffers of described second memory are backuped to according to the 3rd preset data architecture first memory backup buffers in, new value in the new value buffer zone of described second memory is written in the appropriate address of former data storage area of described first memory, the value of issued transaction zone bit is set to false, and removes described the first data structure and the second data structure;
Otherwise the value of issued transaction zone bit is set to false, and removes described the first data structure and the second data structure.
Described step C is specially:
Step C1: when the second application programming interfaces of java card are called, described java card virtual machine judges whether the value of issued transaction sign is true, is to perform step C2, otherwise returns to S3;
Step C2: whether the zone bit that described java card virtual machine judges first the first data structure is effective, is to perform step C3, otherwise execution step C8;
Step C3: described java card virtual machine is invalid by the whole mark position of first the first data structure;
Step C4: described java card virtual machine reads former data from described the first data structure, and described former data are backuped in the backup buffers of described first memory according to the 3rd preset data architecture;
Step C5: described java card virtual machine is effectively by the mark position that includes the 3rd data structure of described former data;
Step C6: described java card virtual machine reads new value from described the second data structure, and according to the writing address in described the second data structure, described new value is written in the appropriate address of former data storage area of described first memory;
Step C7: described java card virtual machine is invalid by the whole mark position of the backup buffers of described first memory, order performs step C8;
Step C8: described java card virtual machine is set to false by the value of issued transaction zone bit, and remove described the first data structure and the second data structure.
Described java card virtual machine call the 3rd application programming interfaces stop affairs, specifically comprise:
Step D1: when the 3rd application programming interfaces of java card are called, described java card virtual machine judges whether the value of described issued transaction zone bit is true, is to perform step D2, otherwise returns to S3;
Step D2: described java card virtual machine is using first the 3rd data structure as current data structure;
Step D3: whether the zone bit that described java card virtual machine judges described current data structure is effective, is to perform step D5, otherwise execution step D4;
Step D4: described java card virtual machine is removed described the first data structure and the second data structure;
Step D5: described java card virtual machine judges whether described current data structure is last, is to perform step D6, otherwise execution step D8;
Step D6: the former data that described java card virtual machine reduces in described current data structure;
Step D7: described java card virtual machine is invalid by the mark position of described current data structure, returns to execution step D2;
Step D8: described java card virtual machine is as current data structure using the next one the 3rd data structure;
Step D9: described java card virtual machine judges whether the zone bit of described current data structure is effectively, is to perform step D5, otherwise execution step D10;
Step D10: described java card virtual machine reduces the former data in the upper data structure of described current data structure;
Step D11: described java card virtual machine is invalid by the mark position of a described upper data structure, returns to execution step D2.
Described power down protection comprises:
When issued transaction sign is effective, described java card virtual machine reduction zone bit is the data in effective the 3rd data structure, removes the first data structure and the second data structure, and it is invalid that issued transaction sign is set to;
When issued transaction sign is invalid, described java card virtual machine is removed the first data structure and the second data structure.
Described power down protection specifically comprises:
Step e 1: described java card virtual machine judges whether the value of event flags is true, is to perform step E3, otherwise execution step E2;
Step e 2: described java card virtual machine is removed described the first data structure and the second data structure;
Step e 3: described java card virtual machine is using first the 3rd data structure as current data structure;
Step e 4: described java card virtual machine judges whether the zone bit of described current data structure is effectively, is to perform step E6, otherwise execution step E5;
Step e 5: described java card virtual machine is removed described the first data structure and the second data structure, and the value of described event flags set is set to false;
Step e 6: described java card virtual machine judges whether described current data structure is last, is to perform step E7, otherwise execution step E9;
Step e 7: the former data that described java card virtual machine reduces in described current data structure;
Step e 8: described java card virtual machine is invalid by the mark position of described current data structure, returns to execution step E 3;
Step e 9: described java card virtual machine is using the next one the 3rd data structure as current data structure;
Step e 10: described java card virtual machine judges whether the zone bit of described current data structure is effectively, is to return to execution step E6, otherwise execution step E11;
Step e 11: described java card virtual machine reduces the former data in the upper data structure of described current data structure;
Step e 12: described java card virtual machine is invalid by the mark position of a described upper data structure, returns to execution step E3.
Described java card virtual machine carries out issued transaction initialization and comprises:
Java card virtual machine is removed the first data structure and the second data structure, by described issued transaction mark position, is invalid, by the mark position of first the 3rd data structure in described first memory backup buffers, is invalid.
Described reduction is specially:
Former data described in described java card virtual machine in the first data structure, and according to the writing address in described the first data structure body, the described former data that read are written in corresponding address.
Beneficial effect of the present invention is: by repeatedly backing up EEPROM in transaction processing facility, change disposable backup when submitting affairs to into, and reduced the operation of writing EEPROM when stopping affairs, also kept power-down protection simultaneously.
Accompanying drawing explanation
The process flow diagram that Fig. 1 is a kind of java card transaction methods based on buffer memory of providing in inventive embodiments one;
Fig. 2 is the operational flowchart of the first application programming interfaces in a kind of java card transaction methods based on buffer memory providing in inventive embodiments two after called;
Fig. 3 is the operational flowchart of the first function in a kind of java card transaction methods based on buffer memory providing in inventive embodiments two after called;
Fig. 4 is the operational flowchart of the second function in a kind of java card transaction methods based on buffer memory providing in inventive embodiments two after called;
Fig. 5 is the operational flowchart of the second application programming interfaces in a kind of java card transaction methods based on buffer memory providing in inventive embodiments two after called;
Fig. 6 is the operational flowchart of the 3rd application programming interfaces in a kind of java card transaction methods based on buffer memory providing in inventive embodiments two after called;
The operational flowchart that Fig. 7 re-powers after for java card power down in a kind of java card transaction methods based on buffer memory providing in inventive embodiments two;
Fig. 8 is the method flow diagram of example transaction in a kind of java card transaction methods based on buffer memory providing in inventive embodiments three;
Fig. 9 executes first to the result schematic diagram that writes the first new value during 0x4000 in EEPROM is initial address in inventive embodiments three;
Figure 10 executes second portion to the result schematic diagram that writes the second new value during 0x4050 in EEPROM is initial address in inventive embodiments three;
Figure 11 executes third part to the result schematic diagram that writes the 3rd new value during 0x4200 in EEPROM is initial address in inventive embodiments three;
Figure 12 executes the 4th part to submit the result schematic diagram after affairs in inventive embodiments three.
Embodiment
In many large-scale, crucial application programs, computing machine p.s. is all being carried out a large amount of tasks, by these tasks business need that combined, is called affairs.Affairs are all done the as a whole work of carrying out hit or miss, and when affairs failure, system turns back to affairs and starts front state, and this process of cancelling all changes is called rollback.The task of transaction processing facility will guarantee whole affairs or completely successful exactly, or what does not do, if certain part in operation can not successfully complete, and the variation of rollback system.
In following examples, java card comprises java card virtual machine, first memory and second memory, in the first memory of java card, comprise backup buffers, in the second memory of java card, be provided with backup buffers and new value buffer zone, wherein, first memory is nonvolatile memory, as EEPROM, second memory is volatile memory, as RAM, the data of storing in first memory are called former data, and the data that will write in first memory are called new value.
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with the drawings and specific embodiments, the present invention is done further and described in detail.
Embodiment mono-
The embodiment of the present invention provides a kind of java card transaction methods based on buffer memory, comprises and starts affairs, execution affairs, submission affairs, termination affairs and power down protection process, wherein carries out the operation that affairs comprise the operation of read data and write data.
Referring to Fig. 1, being specifically expressed as follows of the java card transaction methods based on buffer memory:
Step S1:java card virtual machine powers on, judges whether to start power down protection, and be to start power down protection, perform step S3 after executing power down protection, otherwise execution step S2;
Step S2:java card virtual machine carries out issued transaction initialization;
Concrete, in the present embodiment, step S2 is specially: removing the data in second memory backup buffers and new value buffer zone, is invalid by issued transaction mark position, by the mark position of first data structure in first memory backup buffers, is invalid;
Step S3:java card virtual machine receives applet bytecode;
Step S4:java card virtual machine is resolved described bytecode;
When obtaining bytecode corresponding to the first application programming interfaces, parsing performs step S5, when obtaining bytecode corresponding to the first function, parsing performs step S6, when obtaining bytecode corresponding to the second function, parsing performs step S7, when obtaining bytecode corresponding to the second application programming interfaces, parsing performs step S8, when obtaining bytecode corresponding to the 3rd application programming interfaces, parsing performs step S9, during other bytecode outside parsing obtains above-mentioned bytecode, according to described other bytecode, carry out corresponding operating, return to execution step S3;
Particularly, described java card virtual machine parsing bytecode comprises:
Step a: whether the first byte that judges described bytecode is first byte of making an appointment, and is to perform step b, otherwise carry out corresponding operating according to described bytecode;
First byte of making an appointment described in the present embodiment particularly, is 8d;
Step b: according to the byte search index table beyond described bytecode first byte, judge whether the byte beyond described bytecode first byte is the byte of making an appointment;
If second byte of making an appointment described bytecode is the bytecode that the first application programming interfaces are corresponding, for example, described in second byte of making an appointment be 0001;
If the 3rd byte of making an appointment described bytecode is the bytecode that the first function is corresponding, for example, described in the 3rd byte of making an appointment be 0002;
If the nybble of making an appointment described bytecode is the bytecode that the second function is corresponding, for example, described in the nybble of making an appointment be 0003;
If the 5th byte of making an appointment described bytecode is the bytecode that the second application programming interfaces are corresponding, for example, described in the 5th byte of making an appointment be 0004;
If the 6th byte of making an appointment described bytecode is bytecodes corresponding to the 3rd application programming interfaces, for example, described in the 6th byte of making an appointment be 0005;
Otherwise according to described bytecode, carry out corresponding operating, return to step S3;
Step S5: call the first application programming interfaces and start affairs, return to execution step S3;
Described beginning affairs specifically comprise:
Check issued transaction zone bit a, when a is effective, report an error, when a is invalid, a is set to effectively;
Step S6: call the first function and write data, return to execution step S3;
Write data specifically comprise:
When issued transaction zone bit a length effective and current new value is not more than in second memory remainder bytes length, judge in second memory backup buffers, whether to have backed up the former data in described current new value writing address;
By described current new value, to replace second memory to be newly worth corresponding new value in buffer zone;
Otherwise in second memory backup buffers, back up the former data in described current new value writing address, and described current new value is added in the new value buffer zone of second memory;
Step S7: call the second function read data, return to execution step S3;
Described read data specifically comprises:
When issued transaction zone bit a is effective, judge in the new value writing address backing up in second memory backup buffers whether comprise reading address;
If comprising whole reading address is newly worth and reads the new value that whole reading address are corresponding buffer zone from second memory;
If comprise part reading address, from first memory, read the data in whole reading address, from second memory backup buffers, read the new value that described part reading address is corresponding and by the new value reading, replace the appropriate section of described data;
If do not comprise reading address, from first memory, do not read the data in whole reading address;
Step S8: call the second application programming interfaces and submit affairs to, return to execution step S3;
Described submission affairs specifically comprise:
Whether the zone bit that judges second memory backup buffers when issued transaction zone bit a is effective is effective;
The data in second memory backup buffers to be backuped in first memory backup buffers, the data that second memory is newly worth in buffer zone write in the appropriate address of first memory, it is invalid that issued transaction zone bit a is set to, and remove the data in second memory;
Otherwise it is invalid directly issued transaction zone bit a to be set to, and removes the data in second memory;
Step S9: call the 3rd application programming interfaces and stop affairs, return to execution step S3;
Described termination affairs specifically comprise:
When issued transaction zone bit a is effective:
In reduction first memory backup buffers, zone bit is the data in active data structure;
Remove the data in second memory backup buffer area and new value buffer area.
Described power down protection specifically comprises:
Judgement detects issued transaction zone bit a;
When a is effective:
In reduction first memory backup buffers, zone bit is the data in active data structure;
Removing the data in second memory, is invalid by issued transaction mark position;
When a is invalid, directly remove the data in second memory.
Preferably, in the present embodiment, when described issued transaction zone bit a is effective, its value is true, and when described issued transaction zone bit a is invalid, its value is false;
In the present embodiment, described first memory is EEPROM, second memory is RAM, the read or write speed of second memory is fast compared with first memory, java card transaction methods based on buffer memory provided by the invention is by transferring the operation to second memory to the part operation of first memory, reduce the operation to first memory, improved the travelling speed of java card.
Embodiment bis-
Referring to Fig. 1, in transaction processing facility, when the first application programming interfaces are called, start affairs, concrete steps are as follows:
Step 101: when java card the first application programming interfaces are called, judging whether the value of issued transaction zone bit a is true, is to report an error, otherwise execution step 102;
Preferably, in the present embodiment, described the first application programming interfaces are specially and start affairs (begintranscation) interface.
Step 102: the value of issued transaction zone bit a is set to true.
Referring to Fig. 2, in transaction processing facility, when the first function is called, carry out data writing operation:
Step 201: when the first function is called, judging whether the value of issued transaction zone bit a is true, is to perform step 203, otherwise execution step 202;
Preferably, in the present embodiment, described the first function is specially writes (write) function.
Step 202: current new value is write to the appropriate address of first memory, return to execution step S3;
Particularly, the writing address that the appropriate address of described first memory is current new value.
Step 203: whether the length that judges current new value is greater than the maximum length that the second storage can be backed up, is to perform step 204, otherwise execution step 206;
Step 204: back up the former data in current new value writing address in the backup buffers of first memory;
Preferably, in the present embodiment, to the former data that back up in current new value writing address in the backup buffers of first memory, be specially: according to designated data structure, in the backup buffers of first memory, back up the former data in current new value writing address, and be effective by the mark position in described data structure, wherein, described data structure is:
|log″_1|log″_2|...|log″_n|;
Log when the length of described former data is less than 255 " _ i (i=1,2,3 ..., structure n) is:
| zone bit | former data length | current new value writing address | former data |;
Log when the length of described former data is greater than 255 " _ i (i=1,2,3 ..., structure n) is:
| zone bit | the former data length of 0| | be newly worth writing address | former data |.
Step 205: current new value is write to the appropriate address of first memory, return to execution step S3;
Particularly, the writing address that the appropriate address of described first memory is current new value.
Step 206: judge whether remainder bytes length in second memory is greater than the length of current new value, is to perform step 207, otherwise execution step 208;
Step 207: checking the data in the new value writing address that whether has backed up first memory in second memory backup buffers, is to perform step 212, otherwise execution step 210;
Step 208: the data in second memory backup buffers are write in first memory backup buffers by predefined form;
Step 209: second memory is newly worth to the appropriate address that data in buffer zone write first memory, removes second memory and be newly worth the data in buffer zone and backup buffers;
Particularly, the appropriate address of described first memory is that described second memory is newly worth writing address corresponding to data in buffer zone.
Step 210: back up the former data in current new value writing address in the backup buffers of second memory;
Particularly, the described former data to backing up in current new value writing address in the backup buffers of second memory are specially in the present embodiment: according to designated data structure, in the backup buffers of second memory, back up the former data in current new value writing address, and be effective by the mark position in described data structure, wherein, described data structure is:
|log_1|log_2|...|log_n′|;
Log_j (j=1,2 ... n ') structure be:
| zone bit | former data length | be newly worth writing address | former data |.
Step 211: described current new value is added in the new value buffer zone of second memory, return to execution step S3;
Particularly, in described new value buffer zone of described current new value being added to second memory, be specially in the present embodiment: according to designated data structure, described current new value is added in the new value buffer zone of second memory, and be effective by the mark position in described data structure, wherein, described data structure is:
|log′_1|log′_2|...|log′_n″|;
Log ' _ k (k=1,2,3 ... the structure of n ") is:
| be newly worth writing address | be newly worth length | new value |.
Step 212: replace second memory by current new value and be newly worth the new value in the log ' that in buffer zone, the writing address of current new value is corresponding, return to execution step S3.
Referring to Fig. 3, in transaction processing facility, when the second function is called, carry out read data operation, concrete steps are as follows:
Step 301: when the second function is called, judging whether the value of issued transaction sign a is true, is to perform step 303, otherwise execution step 302;
Preferably, in the present embodiment, described the second function is specially reads (read) function.
Step 302: read total data from the appropriate address of first memory, return to execution step S3;
Particularly, the data of described total data for all reading.
Step 303: the value that variable i is set is 1, the value that constant n is set equals the quantity of log in second memory backup buffers;
Step 304: whether the zone bit that judges log_i in second memory backup buffers is effectively, is to perform step 305, otherwise execution step 315;
Step 305: judge whether comprise reading address in the address that in second memory backup buffers, log_i is corresponding, if comprise whole reading address, perform step 306, if comprise part reading address, perform step 307, if do not comprise reading address, do not perform step 315;
Step 306: read total data from the new value buffer zone of second memory, process is returned to execution step S3;
Step 307: read total data from the appropriate address of first memory;
Step 308: from second memory, be newly worth reading section data buffer zone, and by the appropriate section of the data that read in the data replacement step 307 reading;
Step 309: judging whether the value of i+1 is greater than the value of n, is to return to execution step S3 process, otherwise execution step 310;
The value of step 310:i is from adding 1;
Step 311: whether the zone bit that judges log_i in second memory backup buffers is effectively, is to perform step 312, otherwise returns to execution step 309;
Step 312: judge whether the address that in second memory backup buffers, log_i is corresponding comprises residue reading address, if comprise whole residue reading address, perform step 314, if comprise part residue reading address, perform step 313, if do not comprise residue reading address, return to execution step 309;
Step 313: from second memory, be newly worth reading section data buffer zone, and by the appropriate section of the data that read in the data replacement step 307 reading;
Particularly, described partial data is that the part comprising in second memory backup buffers remains the new value in the new value buffer zone that reading address is corresponding.
Step 314: be newly worth and read data corresponding to residue reading address buffer zone from second memory, and by the appropriate section of the data that read in the data replacement step 307 reading, return and perform step S3;
Step 315: judge whether the value of i+1 is greater than the value of n, is to perform step 316, otherwise execution step 317;
Step 316: read total data from the appropriate address of first memory, return to execution step S3;
Particularly, the appropriate address of described first memory is reading address.
The value of step 317:i is from adding 1;
Step 318: whether the zone bit that judges log_i in second memory backup buffers is effective, is to perform step 319, otherwise returns to execution step 315;
Step 319: judge whether comprise reading address in the address that in second memory backup buffers, log_i is corresponding, if comprise whole reading address, perform step 320, if comprise part reading address, return to execution step 307, if do not comprise reading address, do not return to execution step 315;
Step 320: read total data from the new value buffer zone of second memory, return to execution step S3.
Referring to Fig. 4, in transaction processing facility, when the second application programming interfaces are called, submit affairs to, concrete steps are as follows:
Step 401: when the second application programming interfaces are called, judging whether the value of issued transaction sign a is true, is to perform step 402, otherwise return to execution step S3;
Preferably, in the present embodiment, described the second application programming interfaces are specially submits affairs (committranscation) interface to.
Step 402: whether the zone bit that judges second memory backup buffers is effectively, is to perform step 403, otherwise execution step 408;
Step 403: be invalid by the mark position of second memory backup buffers;
Step 404: the data in second memory backup buffers are write to first memory backup buffers;
Step 405: by the log writing in step 404 in first memory backup buffers " mark position for effectively;
Step 406: second memory is newly worth to the appropriate address that data in buffer zone are written to first memory;
Step 407: be invalid by the mark position of first memory backup buffers;
Step 408: the value of issued transaction zone bit is set to false, and removes in second memory the data in new value buffer zone and backup buffers.
Referring to Fig. 5, in transaction processing facility, when the 3rd application programming interfaces are called, stop affairs, system rollback, concrete steps are as follows:
Step 501: when the 3rd application programming interfaces are called, judging whether the value of issued transaction zone bit a is true, is to perform step 502, otherwise return to execution step S3;
Preferably, in the present embodiment, described the 3rd application programming interfaces are specially and stop affairs (aborttranscation) interface.
Step 502: the initial value that variable i is set is 1, and the value of constant n equals log in first memory backup buffers " quantity;
Step 503: judge first memory backup buffers log " whether the zone bit of _ i is effectively, is to perform step 505, otherwise execution step 504;
Step 504: remove the data in second memory backup buffers and new value buffer zone, return to execution step S3;
Step 505: judge whether the value of i+1 is greater than the value of n, is to perform step 506, otherwise execution step 508;
" the data reduction of backing up in _ i of step 506: by log;
" mark position of _ i is invalid to step 507: by log, returns to execution step 502;
The value of step 508:i is from adding 1;
Step 509: judge first memory backup buffers log " whether the zone bit of _ i is effectively, is to return to execution step 505, otherwise execution step 510;
" the data reduction of backing up in _ i-1 of step 510: by log;
" mark position of _ i-1 is invalid to step 511:log, returns to execution step 502.
Referring to Fig. 6, the embodiment of the present invention provides the method for power down protection in a kind of java card transaction methods based on buffer memory, and concrete steps are as follows:
While re-powering after the power down of step 601:java card, judging whether the value of event flags a is true, is to perform step 603, otherwise execution step 602;
Step 602: remove the data in second memory backup buffers and new value buffer zone, return to execution step S3;
Step 603: the initial value that variable i is set is 1, and the value of constant n equals log in first memory backup buffers " quantity;
Step 604: judge first memory backup buffers log " whether the zone bit of _ i is effectively, is to perform step 606, otherwise execution step 605;
Step 605: remove the data in second memory backup buffers and new value buffer zone, return to execution step S3;
Step 606: judge whether the value of i+1 is greater than the value of n, is to perform step 607, otherwise execution step 609;
" the data reduction of backing up in _ i of step 607: by log;
" mark position of _ i is invalid to step 608: by log, returns to execution step 603;
The value of step 609:i is from adding 1;
Step 610: judge first memory backup buffers log " whether the zone bit of _ i is effectively, is to return to execution step 606, otherwise execution step 611;
" the data reduction of backing up in _ i-1 of step 611: by log;
" mark position of _ i-1 is invalid to step 612: by log, returns to execution step 603.
Embodiment tri-
Referring to Fig. 7, the embodiment of the present invention be take and in initial address, write the first new value to 0x4000 in first memory, to writing the second new value during 0x4050 in first memory is initial address, to 0x4200 in first memory, for writing the 3rd new value in initial address, provide a kind of java transaction methods flow process based on buffer memory for example, the data (5 that the wherein said first new value is 40 bytes, 6, 7, 8..., 45), the data (5 that the described second new value is 90 bytes, 6, 7, 8, ..., 95), the data (5 that the described the 3rd new value is 130 bytes, 6, 7, 8, ..., 135), the size of first memory backup buffers is 2560 bytes, the size of second memory backup buffers is 128 bytes, the size that second memory is newly worth buffer zone is 128 bytes.
Concrete steps are as follows:
One, call the first application programming interfaces, start affairs;
Two, call the first function, to writing the first new value during 0x4000 in first memory is initial address;
First judgement show issued transaction zone bit a is whether the length 40 that judges the described first new value after true is greater than the maximum length 128 that second memory can back up, and the determination result is NO, execution step 701,702, and execution result is referring to Fig. 9;
Step 701: back up the former data in the 0x4000~0x4040 of first memory address in the backup buffers of second memory;
Step 702: the first new value is added in the new value buffer zone of second memory by predetermined data structure;
Particularly, if now the 3rd application programming interfaces are called or java card virtual machine activation power down protection, remove the data in second memory.
Three, call the first function, to writing the second new value during 0x4050 in first memory is initial address;
First judgement show the value of issued transaction zone bit a is whether the length 90 that judges the described second new value after true is greater than the maximum length 128 that second memory can back up, the determination result is NO, continue to judge whether remainder bytes length 82 in second memory is greater than the length 90 of the described second new value, the determination result is NO, execution step 703,704,705,706, execution result is referring to Figure 10;
Step 703: the data in second memory backup buffers are backuped in the backup buffers of first memory by predetermined data structure;
Particularly, before data in second memory backup buffers are backuped to the backup buffers of first memory by predetermined data structure, by the mark position of first log of second memory, be invalid, after data backup completes, for invalid zone bit, be again set to effectively data backup is preposition.
Step 704: the data that second memory is newly worth in buffer zone write in the 0x4000~0x4040 of first memory address;
Step 705: be the data in 0x4050~0x4140 to backing up first memory address in the backup buffers of second memory by predetermined data structure;
Step 706: the second new value is added in the new value buffer zone of second memory by predetermined data structure;
Particularly, if now the 3rd application programming interfaces are called or java card virtual machine activation power down protection, from the backup buffers of first memory, going back raw address is the former data in 0x4000~0x4040.
Four, call the first function, to writing the 3rd new value during 0x4200 in first memory is initial address;
First judgement show the value of issued transaction zone bit a is whether the length 130 that judges the described the 3rd new value after true is greater than the maximum length 128 that second memory can back up, and judgment result is that to be, execution step 707,708, and execution result is referring to Figure 11;
Step 707: the data in the 0x4200~0x4330 of first memory address are backuped to the backup buffers of first memory by predetermined data structure;
Step 708: the appropriate address that the 3rd new value is write to first memory;
Particularly, if now the 3rd application programming interfaces are called or java card virtual machine activation power down protection, from the backup buffers of first memory, going back raw address is that 0x4000~0x4040 and address are the former data in 0x4200~0x4330.
Five, call the second application programming interfaces, submit affairs to;
First after judgement show that the value of issued transaction zone bit a is true, judge whether the zone bit of second memory backup buffers is effectively, judgment result is that to be, execution step 709,710,711,712, execution result is referring to Figure 12;
Step 709: the data in second memory backup buffers are added in the backup buffers of first memory by predetermined data structure;
Particularly, before data in second memory backup buffers are backuped to the backup buffers of first memory by predetermined data structure, by the mark position of first log of second memory (being whole zone bit), be invalid, after data backup completes, will in step 709, write the log of first memory backup buffers " mark position for effectively.
Step 710: the data that second memory is newly worth in buffer zone write in the 0x4050~0x4140 of first memory address;
Step 711: be invalid by the mark position of first memory backup buffers;
Particularly, the zone bit of described first memory backup buffers is log " _ 1 zone bit.
Step 712: the value of issued transaction zone bit a is set to false, and removes the data in second memory backup buffers and new value buffer zone.
Above-described embodiment is more preferably embodiment of the present invention, and the common variation that those skilled in the art carries out within the scope of technical solution of the present invention and replacement all should be included in protection scope of the present invention.

Claims (12)

1. the java card transaction methods based on buffer memory, is characterized in that,
S1:java card virtual machine powers on, and judges whether to start power down protection, is to carry out power down protection, then carries out S3, otherwise carries out S2;
S2: described java card virtual machine carries out issued transaction initialization;
S3: described java card virtual machine obtains applet bytecode;
S4: described java card virtual machine is resolved described applet bytecode;
When parsing obtain be bytecode corresponding to the first application programming interfaces time, call the first application programming interfaces and start affairs, return to S3;
When parsing obtain be bytecode corresponding to the first function time, call the first function and write data, return to S3, comprising:
Steps A: when issued transaction zone bit is effectively and when the length that includes the first data structure of current former data is less than or equal to the residual memory space of backup buffers of second memory, described java card virtual machine judges in the backup buffers of described second memory whether have the first data structure that includes described current former data;
As there are for described java card virtual machine the current former data in the first data structure as described in current new value replacement;
If java card virtual machine as described in not existing by as described in current former data according to the first preset data architecture, backup to as described in the backup buffers of second memory, and described current new value is written in the new value buffer zone of described second memory according to the second preset data architecture; What in the backup buffers of described second memory, store is the first data structure, be newly worth what in buffer zone, store is the second data structure, in the backup buffers of first memory, store be the 3rd data structure, the storage of former data storage area be former data and/or new value;
When parsing obtain be bytecode corresponding to the second function time, call described the second function read data, return to S3, comprising:
When issued transaction sign is effective, described java card virtual machine reads new value from include described second data structure of whole reading address; Or
Described java card virtual machine reads corresponding new value according to described reading address from described the second data structure, according to described reading address, from the former data storage area of described first memory, read former data, and with described in the identical corresponding part of the writing address with described new value in the former data that read described in replacing of the new value that reads;
When parsing obtain be bytecode corresponding to the second application programming interfaces time, call described the second application programming interfaces and submit affairs to, return to S3, comprising:
When issued transaction sign is effective and the whole zone bit of the backup buffers of described second memory is effective, described java card virtual machine backups to the former data in described the first data structure in the backup buffers of described first memory according to the 3rd preset data architecture, new value in the second data structure in the new value buffer zone of described second memory is written in the former data storage area of described first memory in corresponding writing address, remove described the first data structure and described the second data structure, and the value of described issued transaction zone bit is set to invalid,
When parsing obtain be bytecode corresponding to the 3rd application programming interfaces time, call described the 3rd application programming interfaces and stop affairs, return to S3, comprising:
When issued transaction sign is effective, it is the former data in effective the 3rd data structure that described java card virtual machine reduces zone bit in the backup buffers of described first memory; Remove the first data structure and the second data structure;
When parsing obtain be other bytecodes time, according to described other bytecodes, carry out corresponding operatings, return to S3.
2. method according to claim 1, is characterized in that,
Described java card virtual machine is resolved described applet bytecode and is comprised:
Step a: described java card virtual machine judges whether the first byte in described applet bytecode is first byte of making an appointment, and is to perform step b, otherwise returns to S3;
Step b: described java card virtual machine is according to the byte search index table except first byte in described applet bytecode, and judge in described applet bytecode, whether the byte except first byte is the byte of making an appointment;
As described in applet bytecode the byte except first byte be second byte of making an appointment, described applet bytecode is bytecodes corresponding to described the first application programming interfaces, described java card virtual machine call the first application programming interfaces start affairs, return to S3;
As described in applet bytecode the byte except first byte be the 3rd byte of making an appointment, described applet bytecode is bytecode corresponding to described the first function, described java card virtual machine call the first function is write data, returns to S3;
As described in applet bytecode the byte except first byte be the nybble of making an appointment, described applet bytecode is bytecode corresponding to described the second function, described java card virtual machine call the second function read data, returns to S3;
As described in applet bytecode the byte except first byte be the 5th byte of making an appointment, described applet bytecode is bytecodes corresponding to described the second application programming interfaces, described java card virtual machine call the second application programming interfaces are submitted affairs to, return to S3;
As described in applet bytecode the byte except first byte be the 6th byte of making an appointment, described applet bytecode is bytecodes corresponding to described the 3rd application programming interfaces, described java card virtual machine call the 3rd application programming interfaces stop affairs, return to S3;
As described in applet bytecode the byte except first byte for other bytes, call corresponding interface and carry out corresponding operating, return to S3.
3. method according to claim 2, is characterized in that, described java card virtual machine call the first application programming interfaces start things and comprise:
When described first application programming interfaces of java card are called, described java card virtual machine judges that whether described issued transaction zone bit is effective, is to report an error, otherwise is effective by described issued transaction mark position.
4. method according to claim 1, is characterized in that, described steps A is specially:
Steps A 1: when described first function of java card is called, described java card virtual machine judges that whether described issued transaction zone bit is effective, is to perform step A3, otherwise execution step A2;
Steps A 2: described java card virtual machine is replaced the current former data in the former data storage area of described first memory with receiving current new value;
Steps A 3: whether the length that described java card virtual machine judgement includes the second data structure of described current new value is greater than the storage space of the backup buffers of described the second memory block, is to perform step A4, otherwise execution step A6;
Steps A 4: described java card virtual machine reads described current former data from the former data storage area of described first memory, and described current former data are backuped in the backup buffers of described first memory according to described the 3rd preset data architecture;
Steps A 5: described java card virtual machine uses the current new value receiving to replace the current former data in the former data storage area of described first memory;
Steps A 6: described java card virtual machine judges the residual memory space in the backup buffers of described second memory includes the length of the second data structure of described current new value described in whether being greater than, and is to perform step A7, otherwise execution step A8;
Steps A 7: whether described java card virtual machine judgement exists the first data structure of the former data in current new value writing address in the former data storage area that includes described first memory in the backup buffers of described second memory, as existed, perform step A12, if do not existed, perform step A10;
Steps A 8: described java card virtual machine reads described current former data from the former data storage area of described first memory, and described current former data are backuped in the backup buffers of described first memory by described the 3rd preset data architecture;
Steps A 9: described java card virtual machine reads the data in described the second data structure, and with described in current former data in the former data storage area of first memory described in the data replacement that reads, remove described the second data structure and described the first data structure, order performs step A10;
Steps A 10: described java card virtual machine reads described current former data from the former data storage area of described first memory, and the described current former data that read are backuped in the backup buffers of described second memory according to described the first preset data architecture;
Steps A 11: described java card virtual machine is written in the new value buffer zone of second memory by described current new value according to described the second preset data architecture;
Steps A 12: described java card virtual machine is replaced the corresponding data in described the second data structure by described current new value.
5. method according to claim 2, is characterized in that, described java card virtual machine call the second function read data comprises:
Step B: when described issued transaction zone bit is effective, whether the new value writing address of described java card virtual machine judgement in described the second data structure comprises reading address;
As comprise whole reading address, described java card virtual machine reads corresponding new value according to described reading address from described the second data structure;
As comprise reading address, described java card virtual machine reads corresponding former data from the former data storage area of described first memory according to described reading address, from described the second data structure, according to described reading address, read corresponding new value, and replace the identical corresponding part of the writing address with described new value in described former data by described new value;
If do not comprised reading address, described java card virtual machine reads corresponding former data from the former data storage area of described first memory according to described reading address.
6. method according to claim 5, is characterized in that, described step B is specially:
Step B1: when described second function of java card is called, described java card virtual machine judges that whether described issued transaction zone bit is effective, is to perform step B3, otherwise execution step B2;
Step B2: described java card virtual machine reads corresponding former data from the former data storage area of described first memory according to described reading address;
Step B3: described java card virtual machine, using first first data structure as current data structure, judges whether the zone bit of described current data structure is effectively, is to perform step B4, otherwise execution step B14;
Step B4: described java card virtual machine judges in described current data structure whether comprise reading address, if comprise whole described reading address, perform step B5, if the described reading address that comprises part performs step B6, if do not comprise described reading address, do not perform step B14;
Step B5: described java card virtual machine reads corresponding new value from described the second data structure according to described reading address;
Step B6: described java card virtual machine reads corresponding former data from the former data storage area of first memory according to described reading address;
Step B7: described java card virtual machine reads corresponding new value according to described reading address from described the second data structure, and replaces corresponding part identical with the writing address of described new value in the former data that read in described step B6 by described new value;
Step B8: described java card virtual machine judges whether described current data structure is last data structure, is to return to S3, otherwise execution step B9;
Step B9: described java card virtual machine is using the first data structure of the next one in the backup buffers of described second memory as current data structure;
Step B10: whether the zone bit of current data structure described in described java card virtual machine determining step B9 is effectively, is to perform step B11, otherwise return to execution step B8;
Step B11: described in described java card virtual machine determining step B9, whether current data structure comprises the remainder of described reading address, if the remainder that comprises whole described reading address performs step B13, if the remainder that comprises the described reading address of part performs step B12, if do not comprise the remainder of described reading address, return to execution step B8;
Step B12: described java card virtual machine reads corresponding new value according to the remainder of described reading address from described the second data structure, and with described in the new value that reads replace corresponding part identical with the writing address of described new value in the former data that read in described step B6, return to execution step B8;
Step B13: described java card virtual machine reads corresponding new value according to the remainder of described reading address from described the second data structure, and with described in the new value that reads replace corresponding part identical with the writing address of described new value in the former data that read in described step B6;
Step B14: described in described java card virtual machine determining step B9, whether current data structure is last, is to perform step B15, otherwise execution step B16;
Step B15: described java card virtual machine reads corresponding former data from the former data storage area of described first memory according to described reading address;
Step B16: described java card virtual machine is using the next data structure in the backup buffers of described second memory as current data structure;
Step B17: whether the zone bit of current data structure described in described java card virtual machine determining step B16 is effectively, is to perform step B18, otherwise return to execution step B14;
Step B18: whether current data structure described in described java card virtual machine determining step B16 wraps described containing reading address, if comprise whole described reading address, perform step B19, if comprise the described reading address of part, return to execution step B6, if do not comprise described reading address, do not return to execution step B14;
Step B19: described java card virtual machine reads corresponding new value according to described reading address from described the second data structure.
7. method according to claim 2, is characterized in that, described java card virtual machine call the second application programming interfaces submit to affairs to comprise:
Step C: when described issued transaction zone bit is effective, described java card virtual machine judges that whether the whole zone bit of backup buffers of second memory is effective;
Be the former data in the backup buffers of described second memory are backuped to according to described the 3rd preset data architecture first memory backup buffers in, new value in the new value buffer zone of described second memory is written in the appropriate address of former data storage area of described first memory, by described issued transaction mark position, be invalid, and remove described the first data structure and described the second data structure;
Otherwise by described issued transaction mark position, be invalid, and remove described the first data structure and described the second data structure.
8. method according to claim 7, is characterized in that, described step C is specially:
Step C1: when the second application programming interfaces of java card are called, described java card virtual machine judges that whether described issued transaction zone bit is effective, is to perform step C2, otherwise returns to S3;
Step C2: whether the zone bit that described java card virtual machine judges first the first data structure is effective, is to perform step C3, otherwise execution step C8;
Step C3: described java card virtual machine is invalid by the whole mark position of described first the first data structure;
Step C4: described java card virtual machine reads former data from described the first data structure, and described former data are backuped in the backup buffers of described first memory according to described the 3rd preset data architecture;
Step C5: described java card virtual machine is effectively by the mark position that includes the 3rd data structure of described former data;
Step C6: described java card virtual machine reads new value from described the second data structure, and according to the writing address in described the second data structure, described new value is written in the appropriate address of former data storage area of described first memory;
Step C7: described java card virtual machine is invalid by the whole mark position of the backup buffers of described first memory, order performs step C8;
Step C8: described java card virtual machine is invalid by the set of described issued transaction zone bit, and remove described the first data structure and described the second data structure.
9. method according to claim 2, is characterized in that, described java card virtual machine call the 3rd application programming interfaces stop affairs, specifically comprise:
Step D1: when described the 3rd application programming interfaces of java card are called, described java card virtual machine judges that whether described issued transaction zone bit is effective, is to perform step D2, otherwise returns to S3;
Step D2: described java card virtual machine is using first the 3rd data structure as current data structure;
Step D3: whether the zone bit that described java card virtual machine judges described current data structure is effective, is to perform step D5, otherwise execution step D4;
Step D4: described java card virtual machine is removed described the first data structure and described the second data structure;
Step D5: described java card virtual machine judges whether described current data structure is last data structure, is to perform step D6, otherwise execution step D8;
Step D6: the former data that described java card virtual machine reduces in described current data structure;
Step D7: described java card virtual machine is invalid by the mark position of described current data structure, returns to execution step D2;
Step D8: described java card virtual machine is as current data structure using the next one the 3rd data structure;
Step D9: whether the zone bit of current data structure described in described java card virtual machine determining step D8 is effectively, is to perform step D5, otherwise execution step D10;
Step D10: the former data described in described java card virtual machine reduction step D8 in a upper data structure of current data structure;
Step D11: described java card virtual machine is invalid by the mark position of a described upper data structure, returns to execution step D2.
10. method according to claim 1, is characterized in that, described power down protection comprises:
When issued transaction sign is effective, described java card virtual machine reduction zone bit is the data in effective the 3rd data structure, removes the first data structure and the second data structure, by issued transaction mark position, is invalid;
When issued transaction sign is invalid, described java card virtual machine is removed the first data structure and the second data structure.
11. methods according to claim 10, is characterized in that, described power down protection specifically comprises:
Step e 1: described java card virtual machine judges that whether described event flags is effective, is to perform step E3, otherwise execution step E2;
Step e 2: described java card virtual machine is removed described the first data structure and described the second data structure;
Step e 3: described java card virtual machine is using first the 3rd data structure as current data structure;
Step e 4: described java card virtual machine judges whether the zone bit of described current data structure is effectively, is to perform step E6, otherwise execution step E5;
Step e 5: described java card virtual machine is removed described the first data structure and described the second data structure is invalid by described event flags set set;
Step e 6: described java card virtual machine judges whether described current data structure is last data structure, is to perform step E7, otherwise execution step E9;
Step e 7: the former data that described java card virtual machine reduces in described current data structure;
Step e 8: described java card virtual machine is invalid by the mark position of described current data structure, returns to execution step E3;
Step e 9: described java card virtual machine is using the next one the 3rd data structure as current data structure;
Step e 10: whether the zone bit of current data structure described in described java card virtual machine determining step E9 is effectively, is to return to execution step E6, otherwise execution step E11;
Step e 11: the former data described in described java card virtual machine reduction step E9 in a upper data structure of current data structure;
Step e 12: described java card virtual machine is invalid by the mark position of a described upper data structure, returns to execution step E3.
12. methods according to claim 1, is characterized in that, described java card virtual machine carries out issued transaction initialization and comprises:
Java card virtual machine is removed the first data structure and the second data structure, by described issued transaction mark position, is invalid, by the mark position of first the 3rd data structure in described first memory backup buffers, is invalid.
CN201110332419.3A 2011-10-27 2011-10-27 Cache-based java card transaction processing method Expired - Fee Related CN102495754B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110332419.3A CN102495754B (en) 2011-10-27 2011-10-27 Cache-based java card transaction processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110332419.3A CN102495754B (en) 2011-10-27 2011-10-27 Cache-based java card transaction processing method

Publications (2)

Publication Number Publication Date
CN102495754A CN102495754A (en) 2012-06-13
CN102495754B true CN102495754B (en) 2014-03-26

Family

ID=46187581

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110332419.3A Expired - Fee Related CN102495754B (en) 2011-10-27 2011-10-27 Cache-based java card transaction processing method

Country Status (1)

Country Link
CN (1) CN102495754B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559076B (en) * 2013-11-04 2016-09-28 飞天诚信科技股份有限公司 A kind of method and apparatus using parasitic objects management object heap
CN103793337B (en) * 2013-11-12 2016-08-24 飞天诚信科技股份有限公司 A kind of data guard method of power down preventing
CN106598551B (en) * 2016-12-16 2019-01-29 大唐微电子技术有限公司 A kind for the treatment of method and apparatus of smart card, smart card
CN107341049B (en) * 2017-07-03 2020-02-11 飞天诚信科技股份有限公司 Transaction optimization processing method and device
CN108108271B (en) * 2017-12-25 2020-11-03 飞天诚信科技股份有限公司 Method and device for realizing unified management of affairs and power failure protection
CN110597602B (en) * 2019-09-17 2022-03-04 北京字节跳动网络技术有限公司 Transaction processing method and device, computer equipment and storage medium
CN113434247B (en) * 2021-06-16 2023-12-26 武汉天喻信息产业股份有限公司 Safety protection method for JAVA card virtual machine

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
ITMI20070996A1 (en) * 2007-05-17 2008-11-18 Incard Sa METHOD FOR CHECKING THE EXECUTION OF AN APPLICATION FOR AN IC CARD
CN102023885A (en) * 2010-12-17 2011-04-20 北京握奇数据系统有限公司 Method and system for storing bytecode of JCRE (Java card run time environment)
CN102073544B (en) * 2011-01-28 2012-11-21 武汉天喻信息产业股份有限公司 Page operation-based electrically erasable programmable read-only memory (EEPROM) cache method

Also Published As

Publication number Publication date
CN102495754A (en) 2012-06-13

Similar Documents

Publication Publication Date Title
CN102495754B (en) Cache-based java card transaction processing method
CN109871333B (en) Method for accessing flash memory module, related flash memory controller and electronic device
US20120284551A1 (en) Deep standby method and device for embedded system
CN103914407B (en) A kind of SD card power down protection, restoration methods and the SD card with power down protection
CN103336736B (en) System log acquisition method and device
JP2007058840A5 (en)
CN101814049A (en) Memory leak detection method
US20200401516A1 (en) Data Storage Devices and Data Processing Methods
CN109697170B (en) Method for accessing flash memory module, related flash memory controller and electronic device
CN109582216A (en) Data storage device and data processing method of memory device
CN102073544B (en) Page operation-based electrically erasable programmable read-only memory (EEPROM) cache method
CN104978154A (en) Cache operation-based flash rapid read-write method and system
CN107341049B (en) Transaction optimization processing method and device
CN106409321A (en) Method and device for improving reliability of NAND FLASH
CN101527169A (en) Data write-in method for flash memory and controller thereof
CN108108271B (en) Method and device for realizing unified management of affairs and power failure protection
Kortbeek et al. Wario: efficient code generation for intermittent computing
CN104063329B (en) 64-bit immediate operand processing method and device
CN110069362A (en) Data memory device and data processing method
CN112131032A (en) Fault quick recovery method based on hybrid memory system
CN109254929B (en) Method for realizing reliable data writing into chip
CN113836600B (en) Embedded Flash error writing protection method
CN113626346B (en) Data protection method, device, equipment and medium for solid state disk
CA2025197C (en) Method and system for dynamically controlling the operation of a program
CN107315611A (en) A kind of application system regulation management method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
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: 20140326