CN100576243C - The method for writing data of smart card - Google Patents

The method for writing data of smart card Download PDF

Info

Publication number
CN100576243C
CN100576243C CN200710026487A CN200710026487A CN100576243C CN 100576243 C CN100576243 C CN 100576243C CN 200710026487 A CN200710026487 A CN 200710026487A CN 200710026487 A CN200710026487 A CN 200710026487A CN 100576243 C CN100576243 C CN 100576243C
Authority
CN
China
Prior art keywords
data
transaction protection
smart card
zone bit
transaction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN200710026487A
Other languages
Chinese (zh)
Other versions
CN101226604A (en
Inventor
杨林楷
施伟周
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Eastcompeace Technology Co Ltd
Original Assignee
Eastcompeace Smart Card Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Eastcompeace Smart Card Co Ltd filed Critical Eastcompeace Smart Card Co Ltd
Priority to CN200710026487A priority Critical patent/CN100576243C/en
Publication of CN101226604A publication Critical patent/CN101226604A/en
Application granted granted Critical
Publication of CN100576243C publication Critical patent/CN100576243C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The present invention relates to the method for writing data of smart card; transaction protection zone bit memory block and transaction protection district are set in the described smart card; storage is to the backup of former data in the transaction protection district; the method for writing data of smart card of the present invention is to take place unusual in the ablation process of new data or during outage; backup by former data recovers former data; avoid losing of data, guaranteed that data write fashionable high security, also prolonged the serviceable life of smart card simultaneously.

Description

The method for writing data of smart card
Technical field
The present invention relates to be specially adapted to the specific function data processing method, relate in particular to a kind of method for writing data of smart card.
Background technology
Smart card has been widely used in the various products such as mobile phone, music player, Digital Television, and smart card can be realized multiple functions such as the storage, information processing of identification, data.To be widely used in SIM card (the Subscriber IdentityModel in the mobile phone, client identification module) is example, SIM card promptly is a kind of smart card with user identification function and data storage, processing capacity, and it is widely used in the field of mobile communication.
Generally speaking, smart card in use can need the data in the updated stored district, promptly writes new data and replaces legacy data.In the ablation process of new data, if abnormal conditions, sudden power for example, so, new data can't completely write, and the legacy data that need be replaced also suffers to destroy (may be wiped by all or part of), and this can make smart card normally not use, even can't continue to use.Like this, not only are affected in the job security of smart card and serviceable life, simultaneously, for the user, losing of data may bring more serious loss.
In sum, provide a kind of method for writing data of safe smart card real belong to necessary.
Summary of the invention
Fundamental purpose of the present invention provides a kind of intelligent card data wiring method of high security.
For achieving the above object, smart card provided by the present invention comprises:
Nonvolatile memory with internal data store district;
Also have in the wherein said nonvolatile memory
Transaction protection zone bit memory block, described zone bit have special state and normal condition two states; And
Be used to store the transaction protection district of a plurality of transaction protection registration forms, needing more than two in described a plurality of transaction protection registration forms write fashionable to former destination address, and the registration later on order of cancellation is earlier cancelled successively.
Smart card provided by the present invention is by being provided with transaction protection zone bit memory block and transaction protection district; former data are backed up; in case writing of new data takes place unusual or outage; then recover former data; avoided losing of data; guaranteed that data write fashionable security, also prolonged the serviceable life of smart card simultaneously.
Intelligent card data wiring method provided by the present invention may further comprise the steps:
Step 1 is received after certain destination address writes the order of new data, and the zone bit in the transaction protection zone bit memory block is arranged to special state, opens transaction protection;
Step 2 will comprise that the transaction protection registration form of the former data of destination address stores the transaction protection district into;
Step 3 is written to destination address with new data;
Step 4 in writing the process of new data, judges whether to take place abnormal conditions or outage, if abnormal conditions or outage do not take place, has normally write data, submits affairs then to, last execution in step five; If abnormal conditions or outage have taken place, then the corresponding contents in the transaction protection registration form that the transaction protection district is stored is written to the former destination address in the nonvolatile memory;
Step 5 resets to normal condition with the zone bit in the transaction protection zone bit memory block.
The method for writing data of smart card provided by the present invention is by the cooperation in zone bit and transaction protection district; when write operation generation abnormal conditions or outage; the former data that realize backup are recovered; avoided losing of data; guaranteed that data write fashionable security, also prolonged the serviceable life of smart card simultaneously.
Detailed content will be done clearer introduction in specific embodiment.
Description of drawings
Fig. 1 is the internal circuit configuration synoptic diagram of smart card of the present invention;
Fig. 2 is the synoptic diagram in transaction protection district;
Fig. 3 is a kind of embodiment synoptic diagram of transaction protection registration form;
Fig. 4 is the another kind of embodiment synoptic diagram of transaction protection registration form;
Fig. 5 is the process flow diagram of the method for writing data of smart card of the present invention;
Be described in further detail below in conjunction with embodiment and accompanying drawing thereof.
Embodiment
Before introducing the embodiment of the invention, be necessary at first to introduce " atomicities of affairs " this notion." atomicities of affairs " are meant that affairs are complete operations, and each element of affairs is inseparable, and all elements of affairs must be done as a whole submission or rollback, if any element failure of affairs, then whole affairs will be failed." atomicity " this notion belongs to the known terms in this area, is the category of prior art, does not give unnecessary details at this.Write operation atomicity specific to smart card then can be understood as: regard the write operation of smart card as affairs, its atomicity is meant that whole write operation process must all finish, if fail all to finish, then whole write operation lost efficacy.The present invention promptly is on the basis of the atomicity notion in introducing the write operation process, realizes by special hardware configuration and corresponding method.
Referring to shown in Figure 1, smart card of the present invention 1 inside comprises a nonvolatile memory 10 (for example EEPROM), and described nonvolatile memory 10 comprises internal data store district 11, transaction protection zone bit memory block 12 and transaction protection district 13.Certainly, smart card 1 inside generally also comprises other functional part, because these functional parts are not key of the present invention, for the purpose of expressing clearly, Fig. 1 only shows the schematic structure of key aspect of the present invention.
The internal data of internal data store district 11 storage smart cards, certainly, these data comprise the former data that need be replaced in write operation.
The zone bit that the storage representation transaction protection is opened or closed in the transaction protection zone bit memory block 12; promptly when the zone bit under the storage special state in the transaction protection zone bit 12; the protection of expression things is unlocked; and when zone bit is normal condition; transaction protection is closed; certainly; the special state of zone bit or normal condition all can be stipulated in advance; in the present embodiment; can stipulate that " 1 " is the special state of zone bit; " 0 " is the normal condition of zone bit, and concrete operating process can be referring to hereinafter to the explanation of the method for writing data of smart card of the present invention.
In the present embodiment, transaction protection district 13 is positioned at the last storage area of nonvolatile memory EEPROM.In conjunction with referring to shown in Fig. 2, transaction protection district 13 comprises a plurality of transaction protection registration form Log (Log1, Log2......Logn), and the structure of each transaction protection registration form Log can be with reference to shown in the figure 3.
In conjunction with referring to Fig. 3, each transaction protection registration form Log comprises Header, Length, Address, Old_data four parts, and concrete implication is as follows:
Header, it is positioned at the head of Log, and length is a byte, when Header is nonzero value, represents this Log effective;
Length; the former data that are used to write down protected destination address (promptly; the former data that need be substituted by new data) length; when the length of former data is less than or equal to 255 bytes; the length of Length is a byte (because a byte is 8 bit, its maximum decimal number that can express is 255).In conjunction with reference to shown in the figure 4, when the length of former data greater than 255 the time, the length of Length is three bytes, wherein first flag byte L1 is 0X00, when flag byte L1 occurring, represents that promptly next two byte L2 have represented the length of former data; Obviously, if the length of former data is very big, all can't represent its length with two bytes, so also can increase the byte number of Length again, this is the equivalent transformation that those skilled in that art can be easy to associate;
Address, its length is two bytes, writes down the memory address of former data;
Old_data, the particular content of former data (in the write data process by the new data replaced data), its length is " Length " individual byte, promptly the numerical value of putting down in writing among the Length has been represented the length of Old_data.
More than introduce the structure of smart card of the present invention, elaborated the wiring method of intelligent card data below in conjunction with Fig. 5.
Shown in Fig. 5, the method for writing data of smart card of the present invention may further comprise the steps:
Step 20 is received after certain destination address writes the order of new data, and the distinctive mark position is written in the transaction protection zone bit memory block 12, opens transaction protection; In the present embodiment, the distinctive mark position is " 1 ", therefore, earlier " 1 " is write in the transaction protection zone bit memory block 12, opens transaction protection then.
Step 21 will comprise that the transaction protection registration form of the former data of destination address stores transaction protection district 13 into; Header, the Length, Address, Old_data four parts that comprise among Fig. 2 in the transaction protection registration form being disclosed.This step is one of most crucial steps in the transaction protection, and its fundamental purpose is to need the former data by new data replaces to backup in the transaction protection district 13 in the destination address.
Step 22 is written to destination address with new data, and the former data in the destination address have backuped in the transaction protection district 13 at this moment.
Step 23 in writing the process of new data, judges whether to take place abnormal conditions or sudden power.If abnormal conditions or outage do not take place, then execution in step 25, normally write data, submit affairs then to, and last execution in step 26 resets to normal condition with the zone bit in the transaction protection zone bit memory block 12.
If abnormal conditions or sudden power have taken place in the process that new data writes; then execution in step 24; corresponding contents in the transaction protection registration form that transaction protection district 13 is stored is written to the former destination address in the nonvolatile memory 10; promptly; in order to repair ruined data, will in step 21, back up good former data and be written to raw address again.It is emphasized that, if be common abnormal conditions, so directly execution in step 24, (this moment, smart card 1 can't be proceeded any operation if serious abnormal conditions, for example crash) or sudden power (this moment, smart card 1 had little time execution in step 24) and not having under the situation of standby power supply, then may be when power on next time could execution in step 24: because zone bit is " 1 ", after powering on once more, smart card 1 can be learnt by zone bit serious abnormal conditions or sudden power took place in the write data process last time, execution in step 24 will originally back up good reduction of data in smart card so immediately.
After the execution of step 24; follow execution in step 26 too, the zone bits in the transaction protection zone bit memory block 12 are reset to normal condition, because finished transaction protection this moment; former data have obtained recovery, so zone bit can reset to normal condition " 0 ".
Be not difficult to find out by above-mentioned steps; utilized " atomicities of affairs " this notion in the method for writing data of smart card of the present invention; the advanced behaviour is engaged in protecting before write data; promptly; the former data of destination address are backed up with the form of affairs registration form earlier, store in the transaction protection district 13.In the write data process; if take place unusual or outage; then from affairs protected location 13, take out former data; be written to corresponding raw address; with all data writing operation cancellations; reset into write data state before, finish transaction protection, avoided effectively in the write data process owing to data corruption unusual or that outage causes takes place.It is emphasized that; if; certain unusual or outage causes a plurality of affairs to need to recover (promptly; there are a plurality of unsuccessful write operations to need cancellation); then can cancel successively according to the order of " back registration cancellation earlier "; that is to say,, then can write successively according to the order that the back registration writes earlier if certain unusual or outage causes corresponding contents in a plurality of transaction protection registration forms that the transaction protection district stored need be written to former destination address in the nonvolatile memory.Certainly the rule of " cancellation earlier of registration earlier " also can be implemented.
The foregoing description only is preferred embodiment of the present invention, and the present invention is not limited to above-mentioned embodiment with regard to its more wide form.For example, the form of expression of institute's content is not limited to Header, Length, Address, Old_data four parts in the transaction protection registration form, its order also is not limited to described in the embodiment, can be according to the former data of the content recovery in the affairs registration form as long as follow-up; In addition, nonvolatile memory 10 can also be FLASH (flash memory) or ferroelectric memory or the like except EEPROM, though the nonvolatile memory in the above embodiments is a single memory, but also not getting rid of it physically is to be merged by a plurality of storeies to form, for example, can add non-volatile storage space of the common composition of a ferroelectric memory with an EEPROM, EEPROM is as internal data store district 11, and ferroelectric memory is as transaction protection district 13, transaction protection zone bit memory block 12 can be positioned at above-mentioned any storer, though rising physically is two storeies, but with technical implementation way and the indistinction in the foregoing description, so nonvolatile memory 10 can rise to " nonvolatile storage " this notion; In addition, the form of expression of zone bit also can have varied, and these all are that those skilled in the art can be easy to associate by the foregoing description, do not give unnecessary details at this.In a word, being similar to above-mentioned equivalent transformation all should be included in the claim restricted portion.

Claims (6)

1, the method for writing data of smart card, described smart card has the nonvolatile memory in internal data store district, also has transaction protection zone bit memory block in the described nonvolatile memory, described zone bit has special state and normal condition two states and is used to store the transaction protection district of a plurality of transaction protection registration forms, needing more than two in described a plurality of transaction protection registration form write fashionable to former destination address, the registration later on order of cancellation is earlier cancelled successively;
It may further comprise the steps:
Step 1 is received after certain destination address writes the order of new data, and the zone bit in the transaction protection zone bit memory block is arranged to special state, opens transaction protection;
Step 2 will comprise that the transaction protection registration form of the former data of destination address stores the transaction protection district into;
Step 3 is written to destination address with new data;
Step 4 in writing the process of new data, judges whether to take place abnormal conditions or outage, if abnormal conditions or outage do not take place, has normally write data, submits affairs then to, last execution in step five; If abnormal conditions or outage have taken place, then the corresponding contents in the transaction protection registration form that the transaction protection district is stored is written to the former destination address in the nonvolatile memory;
Step 5 resets to normal condition with the zone bit in the transaction protection zone bit memory block.
2, according to the method for writing data of the described smart card of claim 1, it is characterized in that:
The special state of described zone bit is represented the unlatching of transaction protection, and the normal condition of described zone bit is represented closing of transaction protection.
3, according to the method for writing data of the described smart card of claim 1, it is characterized in that:
Described zone bit is with " 1 " expression special state, with " 0 " expression normal condition.
4, according to the method for writing data of the described smart card of claim 1, it is characterized in that:
Described transaction protection registration form comprises Header, Length, Address, Old_data four parts.
5, according to the method for writing data of each described smart card in the claim 1 to 4, it is characterized in that:
Described nonvolatile memory is an independently EEPROM.
6, according to the method for writing data of the described smart card of claim 1, it is characterized in that:
In step 4; if certain unusual or outage causes the corresponding contents in a plurality of transaction protection registration forms that the transaction protection district stored need be written to former destination address in the nonvolatile memory, then can write successively according to the order that the back registration writes earlier.
CN200710026487A 2007-01-19 2007-01-19 The method for writing data of smart card Active CN100576243C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200710026487A CN100576243C (en) 2007-01-19 2007-01-19 The method for writing data of smart card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200710026487A CN100576243C (en) 2007-01-19 2007-01-19 The method for writing data of smart card

Publications (2)

Publication Number Publication Date
CN101226604A CN101226604A (en) 2008-07-23
CN100576243C true CN100576243C (en) 2009-12-30

Family

ID=39858586

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200710026487A Active CN100576243C (en) 2007-01-19 2007-01-19 The method for writing data of smart card

Country Status (1)

Country Link
CN (1) CN100576243C (en)

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100595733C (en) * 2008-10-24 2010-03-24 普天信息技术研究院有限公司 Smart card operation method and smart card
CN101827140B (en) * 2009-03-03 2014-06-18 展讯通信(上海)有限公司 Method for writing data in user identification module card and mobile terminal
CN101556541B (en) * 2009-05-14 2012-11-21 北京握奇数据系统有限公司 Method for manufacturing intelligent card, device, master card and system
CN101661565B (en) * 2009-09-24 2012-05-02 北京握奇数据系统有限公司 Power-off protection method of intelligent card with Mifare simulation function, device and system
CN102073655B (en) * 2009-11-20 2015-09-02 腾讯科技(深圳)有限公司 A kind of method and apparatus preserving data
CN101807320A (en) * 2010-04-12 2010-08-18 中兴通讯股份有限公司 Terminal aiming at non-contact intelligent card and method thereof for processing abnormality
CN102005245B (en) * 2010-11-30 2015-07-22 公安部第三研究所 Intelligent card erasing and writing protection method
CN102147846A (en) * 2010-12-29 2011-08-10 北京握奇数据系统有限公司 Method for writing data in intelligent card and intelligent card
CN102799931B (en) * 2011-11-29 2015-03-04 深圳中科讯联科技有限公司 Data protection method of radio frequency smart card
CN102521077B (en) * 2011-12-01 2013-12-25 广州中大微电子有限公司 Anti-plug read-in method and system for file
CN102592154B (en) * 2011-12-30 2014-08-20 北京握奇数据系统有限公司 Intelligent card and data processing method and device therefor
CN103093151B (en) * 2012-12-31 2015-09-30 中国电子科技集团公司第十五研究所 A kind of smart card data power fail safeguard circuit
CN103744746B (en) * 2013-12-30 2016-08-03 北京工业大学 A kind of intelligent card records backup based on index and restoration methods
CN104778133B (en) * 2014-01-09 2017-09-22 苏州融卡智能科技有限公司 Increase the method in smart card programmable read only memory life-span
CN103761549A (en) * 2014-01-13 2014-04-30 刘鹏 High-reliability RFID tag identification method
CN106383775B (en) * 2015-08-18 2019-03-08 上海景格科技股份有限公司 Equipment uses time recording method and its device
US20170091254A1 (en) * 2015-09-24 2017-03-30 Kshitij A. Doshi Making volatile isolation transactions failure-atomic in non-volatile memory
CN105337995B (en) * 2015-11-29 2019-06-21 恒宝股份有限公司 A kind of quick personalization method of smart card and system
CN111105563B (en) * 2019-12-17 2021-08-24 厦门计讯物联科技有限公司 Water card data writing method, device, equipment and storage medium for preventing data loss

Also Published As

Publication number Publication date
CN101226604A (en) 2008-07-23

Similar Documents

Publication Publication Date Title
CN100576243C (en) The method for writing data of smart card
CN103577121B (en) A kind of highly reliable linear file access method based on Nand Flash
CN1900919B (en) Flash memory comprising a plurality of blocks
CN101251826B (en) Flash memory, method and apparatus for data management of flash memory
CN100377120C (en) Non-volatile storage device control method
CN100543706C (en) A kind of method that realizes the FLASH chip data security
CN101706709B (en) Card and host apparatus
US20090046522A1 (en) Method for writing data in a non volatile memory unit
US8266391B2 (en) Method for writing data of an atomic transaction to a memory device
CN106227680B (en) A kind of data processing and power fail preventing data guard method
CN109343790A (en) A kind of date storage method based on NAND FLASH, terminal device and storage medium
US20080320253A1 (en) Memory device with circuitry for writing data of an atomic transaction
CN102567146B (en) Log backup method and device and smart card
CN101944386B (en) Control circuit and storage system and method for identifying error data in flash memory
KR100515890B1 (en) Method of efficiently recovering database
CN102890656A (en) Method for improving service life of FLASH
CN105975878A (en) Safe storage method and system based on Nand Flash flash-memory
CN100454302C (en) File management system and method
CN101308702B (en) Data structure suitable for flash memory and data writing and reading method thereof
CN107168889A (en) A kind of method that Flash stores KVM channel informations inside utilization MCU
US20070277028A1 (en) Method and system for recovery from reprogramming failures in nonvolatile memory
JPH10187549A (en) Ic card
CN101506902A (en) Circuit arrangement and method for data processing
CN101441605A (en) Current failure data protection method of flash memory medium
US11294807B2 (en) Delayed write failure logging

Legal Events

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

Owner name: EASTCOMPEACE TECHNOLOGY CO., LTD.

Free format text: FORMER NAME: EASTCOMPEACE SMART CARD CO., LTD.

CP01 Change in the name or title of a patent holder

Address after: 519060 Guangdong province science and Technology Park in Zhuhai Nanping Ping Gong Road No. 8

Patentee after: Eastcompeace Technology Co., Ltd.

Address before: 519060 Guangdong province science and Technology Park in Zhuhai Nanping Ping Gong Road No. 8

Patentee before: Eastcompeace Smart Card Co., Ltd.