CN102005245B - Intelligent card erasing and writing protection method - Google Patents

Intelligent card erasing and writing protection method Download PDF

Info

Publication number
CN102005245B
CN102005245B CN201010566258.XA CN201010566258A CN102005245B CN 102005245 B CN102005245 B CN 102005245B CN 201010566258 A CN201010566258 A CN 201010566258A CN 102005245 B CN102005245 B CN 102005245B
Authority
CN
China
Prior art keywords
backup
block
erasable
mark
smart card
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201010566258.XA
Other languages
Chinese (zh)
Other versions
CN102005245A (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.)
Third Research Institute of the Ministry of Public Security
Original Assignee
Third Research Institute of the Ministry of Public Security
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 Third Research Institute of the Ministry of Public Security filed Critical Third Research Institute of the Ministry of Public Security
Priority to CN201010566258.XA priority Critical patent/CN102005245B/en
Publication of CN102005245A publication Critical patent/CN102005245A/en
Application granted granted Critical
Publication of CN102005245B publication Critical patent/CN102005245B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention aims at disclosing an intelligent card erasing and writing protection method. When an intelligent card begins the erasing and writing operation, a data located block is backed up to a backup region before target address data is modified. Meanwhile, because the backup region is frequently erased and written and is easy to damage, the address of the damaged backup region is allowed to be changed; a backup mark of the backup region singly occupies one block, new addresses are sequentially written in the block during the updating in each time, the block erasing operation can be executed after the block is full, and then, the new addresses are written in from the beginning, so the modification time of the backup mark can be saved, and the goal of the intelligent card erasing and writing protection can be realized.

Description

The erasable guard method of a kind of smart card
Technical field
The present invention relates to a kind of erasable guard method, the particularly erasable guard method of a kind of smart card of field of intelligent cards.
Background technology
At present, the smart card of domestic use, along with the continuous expansion of application item function and the quickening of the pace of product renewal, traditional (as ROM etc.) CPU smart card gradually replace by new-type Flash fast flash memory bank CPU smart card.
And flash storage often needs the erasable operation carrying out data, be generally first wipe legacy data, then write new data; But, will powered-off fault be faced in erasable process, cause the exception of data.
In sum, for the defect of prior art, the erasable guard method of a kind of smart card of special needs, solves the problem of the erasable power down protection of smart card Flash.
Summary of the invention
The object of the present invention is to provide the erasable guard method of a kind of smart card, for the defect of above-mentioned prior art, making system when surprisingly losing power supply, the determinacy of system running state and the integrality of record data can be ensured; After system power supply recovers, field data can be recovered in time, avoids application system confusion reigned.
Technical matters solved by the invention can realize by the following technical solutions:
The erasable guard method of a kind of smart card, it is characterized in that, it comprises the steps:
1), when smart card starts erasable operation, check global variable mark, check whether power down and judge data block and backup area whether normal;
2) if this global variable mark is effective, then read object block content and copy in backup block, starting the erasable operation of backup block;
3) if this global variable mark is invalid, then read backup block sequence number to global variable mark, read object block content and copy in this backup block, starting the erasable operation of backup block;
4) back up successfully if this backup block is erasable, then calculate object block number, new backup mark is set, then starts to carry out data erase and write operation to object block;
5) reset backup mark, completes erasable protection operation;
6) if the erasable backup failure of this backup block, then upgrade backup block number, re-start backup and start the erasable operation of backup block.
In one embodiment of the invention, backup area backup sign retouching operation comprises the steps:
1), when carrying out the erasable operation of the backup mark block of backup block, first check global variable, determine whether 0;
2) if global variable is judged as 0, then represent that this block is fully written, start erasing mark place block, to global variable place write backup mark, its value divides exactly block size value for (global variable+4), and amendment backup mark terminates;
3) if global variable judges not to be 0, then directly to global variable place write backup mark, its value divides exactly block size value for (global variable+4), and amendment backup mark terminates.
In one embodiment of the invention, before smart card carries out data backup, check that backup area backup indicates.
In one embodiment of the invention, smart card carry out data backup block erasable before, check backup block remaining space.
In one embodiment of the invention, smart card carry out data backup block erasable time, upgrade backup block number.
In one embodiment of the invention, smart card carry out data backup block erasable time, damage after allow change backup area address.
In one embodiment of the invention, when smart card carries out data backup block operations, only have when backup mark block writes the just erasable operation of execution backup mark block completely.
The erasable guard method of smart card of the present invention, when smart card starts erasable operation, before modifying target address date, backups in backup area by this data place block; , because backup area is often erasable, easily damage meanwhile, allow after damaging to change backup area address; The backup mark of backup area takies separately a block, each new address when upgrading successively in write-in block, only have when this block write full after just perform this block erase operation, more from the beginning to write, the time of backup mark amendment can be saved like this, realize object of the present invention.
The detailed description and obtaining that feature of the present invention can consult the graphic and following better embodiment of this case is well understood to.
Accompanying drawing explanation
Fig. 1 is the FB(flow block) of the erasable guard method of smart card of the present invention;
Fig. 2 is the process principle figure that backup area of the present invention backup indicates retouching operation.
Embodiment
The technological means realized to make the present invention, creation characteristic, reaching object and effect is easy to understand, below in conjunction with concrete diagram, setting forth the present invention further.
As shown in Figure 1, the erasable guard method of smart card of the present invention, it comprises the steps:
1), when smart card starts erasable operation, check global variable mark blk_seq, check whether power down and judge data block and backup area whether normal;
2) if this global variable mark blk_seq is effective, then read object block content and copy in backup block, starting the erasable operation of backup block;
3) if this global variable mark blk_seq is invalid, then read backup block sequence number to global variable mark blk_seq, read object block content and copy in this backup block, starting the erasable operation of backup block;
4) back up successfully if this backup block is erasable, then calculate object block number, new backup mark is set, then starts to carry out data erase and write operation to object block;
5) reset backup mark, completes erasable protection operation;
6) if the erasable backup failure of this backup block, then upgrade backup block number, re-start backup and start the erasable operation of backup block.
In the present invention, before smart card carries out data backup, check that backup area backup indicates.
In the present invention, smart card carry out data backup block erasable before, check backup block remaining space.
In the present invention, smart card carry out data backup block erasable time, upgrade backup block number.
In the present invention, smart card carry out data backup block erasable time, damage after allow change backup area address.
In the present invention, when smart card carries out data backup block operations, only have when backup mark block writes the just erasable operation of execution backup mark block completely.
For the operation of backup area backup block, particularly to the erasable operating process of backup mark block, because backup area is often erasable, easily damage, allow after damaging to change backup area address; Backup mark (4 byte) takies separately a block, each new address when upgrading successively in write-in block, only have when this block write full after just perform this block erase operation, more from the beginning to write, the time of backup mark amendment can be saved like this.
As shown in Figure 2, in the present invention, backup area backup sign retouching operation comprises the steps:
1), when carrying out the erasable operation of the backup mark block of backup block, first check global variable flag_offset, determine whether 0;
2) if global variable flag_offset is judged as 0, then represent that this block is fully written, start erasing mark place block, to global variable flag_offset place write backup mark, its value divides exactly block size value (blksize) for (global variable flag_offset+4), and amendment backup mark terminates;
3) if global variable flag_offset judges not to be 0, then directly to global variable flag_offset place write backup mark, its value divides exactly block size value (blksize) for (global variable flag_offset+4), and amendment backup mark terminates.
More than show and describe ultimate principle of the present invention and principal character and advantage of the present invention.The technician of the industry should understand; the present invention is not restricted to the described embodiments; what describe in above-described embodiment and instructions just illustrates principle of the present invention; without departing from the spirit and scope of the present invention; the present invention also has various changes and modifications; these changes and improvements all fall in the claimed scope of the invention, and application claims protection domain is defined by appending claims and equivalent thereof.

Claims (5)

1. the erasable guard method of smart card, it is characterized in that, it comprises the steps:
1), when smart card starts erasable operation, check global variable mark, check whether power down and judge data block and backup area whether normal;
2) if this global variable mark is effective, then read object block content and copy in backup block, starting the erasable operation of backup block;
3) if this global variable mark is invalid, then read backup block sequence number to global variable mark, read object block content and copy in this backup block, starting the erasable operation of backup block;
4) back up successfully if this backup block is erasable, then calculate object block number, new backup mark is set, then starts to carry out data erase and write operation to object block;
5) reset backup mark, completes the erasable protection operation of backup block;
6) if the erasable backup failure of this backup block, then upgrade backup block number, re-start backup and start the erasable operation of backup block;
When smart card starts erasable operation, before modifying target address date, this data place block is backuped in backup area; Backup mark takies separately a block, each new address when upgrading successively in write-in block, only have when backup home block write full after just perform and back up home block erase operation, more from the beginning to write; Backup area backup block, in the erasable operating process of backup home block, allows to change backup area address after backup area damages.
2. the erasable guard method of smart card as claimed in claim 1, is characterized in that, the erasable operation of backup area backup mark comprises the steps:
1), when carrying out the erasable operation of the backup home block of backup block, first check global variable, determine whether 0;
2) if global variable is judged as 0, then represent that backup home block is fully written, start erasing mark place block, to global variable place write backup mark, its value divides exactly block size value for (global variable+4), and amendment backup mark terminates;
3) if global variable judges not to be 0, then directly to global variable place write backup mark, its value divides exactly block size value for (global variable+4), and erasable backup mark terminates.
3. the erasable guard method of smart card as claimed in claim 1, is characterized in that, before smart card carries out data backup, checks backup area backup mark.
4. the erasable guard method of smart card as claimed in claim 1, is characterized in that, smart card carry out data backup block erasable before, check backup block remaining space.
5. the erasable guard method of smart card as claimed in claim 1, is characterized in that, smart card carry out data backup block erasable time, upgrade backup block number.
CN201010566258.XA 2010-11-30 2010-11-30 Intelligent card erasing and writing protection method Active CN102005245B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010566258.XA CN102005245B (en) 2010-11-30 2010-11-30 Intelligent card erasing and writing protection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010566258.XA CN102005245B (en) 2010-11-30 2010-11-30 Intelligent card erasing and writing protection method

Publications (2)

Publication Number Publication Date
CN102005245A CN102005245A (en) 2011-04-06
CN102005245B true CN102005245B (en) 2015-07-22

Family

ID=43812522

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010566258.XA Active CN102005245B (en) 2010-11-30 2010-11-30 Intelligent card erasing and writing protection method

Country Status (1)

Country Link
CN (1) CN102005245B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI520153B (en) * 2013-11-05 2016-02-01 威盛電子股份有限公司 Non-volatile memory device and operation method thereof
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
CN106445851A (en) * 2016-08-26 2017-02-22 北京中电华大电子设计有限责任公司 Method for improving interface response capability of Flash NFC-SIM smart card
CN112131040B (en) * 2020-09-30 2022-02-11 郑州信大捷安信息技术股份有限公司 Wear balance management method and system for power-down backup area of smart card

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101226604A (en) * 2007-01-19 2008-07-23 东信和平智能卡股份有限公司 Smart card and data write-in method
CN101382918A (en) * 2008-07-26 2009-03-11 深圳市硅格半导体有限公司 NAND flash memory optimizing and managing method based on data interchange zone
CN101876927A (en) * 2009-11-30 2010-11-03 北京握奇数据系统有限公司 Power-off protection method for realizing FAT32 file system, and device thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101226604A (en) * 2007-01-19 2008-07-23 东信和平智能卡股份有限公司 Smart card and data write-in method
CN101382918A (en) * 2008-07-26 2009-03-11 深圳市硅格半导体有限公司 NAND flash memory optimizing and managing method based on data interchange zone
CN101876927A (en) * 2009-11-30 2010-11-03 北京握奇数据系统有限公司 Power-off protection method for realizing FAT32 file system, and device thereof

Also Published As

Publication number Publication date
CN102005245A (en) 2011-04-06

Similar Documents

Publication Publication Date Title
EP2115595B1 (en) Memory device performance enhancement through pre-erase mechanism
CN102662852B (en) Method for storing nonvolatile data by using MCU internal data Flash
KR101818599B1 (en) Non-volatile temporary data handling
CN102005245B (en) Intelligent card erasing and writing protection method
US20100122015A1 (en) Software adapted wear leveling
CN107329905B (en) Data storage device and flash memory control method
CN101640069B (en) Average wear method and average wear system for flash memory
CN101373451B (en) Computer system for protecting double-basic input /output system program and control method thereof
CN102004706B (en) Flash erasing power-fail protection method based on FTL(Flash Translation Layer)
CN104750615A (en) Data storage device and flash memory control method
EP1036364A1 (en) Alignment of cluster address to block addresses within a semiconductor non-volatile mass storage memory
CN109933545A (en) The data processing method of data memory device and memory device
CN104808951A (en) Storage control method and device
CN101699476B (en) Data processing method and device of smart cards
CN1936853B (en) Data cut-off protection and repairing method of inlaid apparatus
CN103914407A (en) Secure digital memory (SD) card power down protection and restoring method and SD card with power down protection function
CN101567217A (en) Flash memory safely writing method and data writing method
CN107291374A (en) Method and device for recording use time of data block
CN104765569A (en) Data write-in method, memory control circuit unit and memory storing device
CN107045423B (en) Memory device and data access method thereof
CN103425549A (en) Firmware managing method and system of embedded controller
TW201403309A (en) Data storage device and operating method for flash memory
CN110688141B (en) Firmware updating method
CN115878033B (en) Solid state disk and mapping table management method thereof
JP4794530B2 (en) Semiconductor device and mobile phone

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