CN101571869B - File memory and read method of smart card and device thereof - Google Patents

File memory and read method of smart card and device thereof Download PDF

Info

Publication number
CN101571869B
CN101571869B CN2009100857733A CN200910085773A CN101571869B CN 101571869 B CN101571869 B CN 101571869B CN 2009100857733 A CN2009100857733 A CN 2009100857733A CN 200910085773 A CN200910085773 A CN 200910085773A CN 101571869 B CN101571869 B CN 101571869B
Authority
CN
China
Prior art keywords
file
head
extendfile
basic document
header
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
CN2009100857733A
Other languages
Chinese (zh)
Other versions
CN101571869A (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.)
Beijing Watchdata Co ltd
Original Assignee
Beijing WatchData System Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing WatchData System Co Ltd filed Critical Beijing WatchData System Co Ltd
Priority to CN2009100857733A priority Critical patent/CN101571869B/en
Publication of CN101571869A publication Critical patent/CN101571869A/en
Application granted granted Critical
Publication of CN101571869B publication Critical patent/CN101571869B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a file memory method and read method of a smart card and a device thereof. The invention discloses a file memory method of a smart card aiming at solving the problem that file deleting process in the smart card is trivial, including: basic file headers in the headers of a file to be stored in the same dedicated file DF file body are stored in sequence structure, wherein thebasic file headers contain file identification information and initial address message of expanding file header in the file header and occupies a fixed storage space; the expanding file header is sto red according to the initial address message of the expanding file header; the file body is stored according to file body storage address relevant information in the file header, connection between the current file and the file to be deleted is not required to be rebuilt as each basic file header or file header occupies a fixed storage space, thus simplifying file deleting process.

Description

A kind of file storage of smart card, read method and device
Technical field
The invention belongs to data processing field, particularly a kind of file storage of smart card, read method and device.
Background technology
The structure of smart card document system has been done regulation in ISO/IEC 7816-4 standard, in smart card, intelligence is used standardized file structure.It does not contain special application file, such as the special file of using for specific file handler.
Basically be divided into two classes concerning the file of smart card: the 1st class is a catalogue file, it is called as " private file " DF (Dedicated File), second class is the file that utility data is housed, and it is referred to as " basic document " EF (Elementary File).Private file (DF) can be regarded as a deedbox, wherein be equipped with EF or sub-DF (other more bottom logically with EF ownership DF together).
For any one file, all exist the structure of following two kinds of forms: the logical organization of file and the physical arrangement of file.The logical organization of file is to trigger viewed file organization form from User Perspective, is data and structure thereof that the user can directly handle, and it is independent of the physical characteristics of file, is called file organization again.The physical arrangement of file is called the storage organization of file again, is meant the storage organization form of file on external memory, and this is not only relevant with the memory property of storage medium, and relevant with the external memory allocation scheme that is adopted.
For the logical organization of file, done regulation in the 7816-4 standard, these file types all are to support: the loop structure of the linear structure of transparent configuration, fixed-length record, the linear structure of variable-length record, fixed-length record and TLV structure.
For the physical arrangement of file, file management layer most important functions is exactly to be the file allocation storage space, effectively utilizes the access speed that storage space can improve file.Memory allocation method commonly used has: continuous dispensing, chain type are distributed and three kinds of index assignment.File manipulation architecture when adopting the continuous dispensing mode will be the file structure of sequential; The link allocation scheme will form the interlinkage file structure.
The file major part of traditional intelligence card operation system support belongs to the sequential file structure.The order that file takies the dish piece in record in logical file order and the storer has consistance, and just the file occupation space is continuous.The major advantage of this allocation scheme is that sequential access is easy, in case know the start address of file, does not need other processing, can realize from beginning sequentially, byte-by-byte ground down reads and writes.Owing to do not need the computing of other address translation, so access speed is fast especially.
But this allocation scheme has very big shortcoming, as dynamic allocation of memory,, will make disk space be divided into many fritters along with file is set up the distribution of time space and the recovery of file delete time space, these less continuums have been difficult to be used for storage file, and these are exactly fragment.
Early stage applicating Chinese spare at smart card is not deleted usually after foundation, therefore sequential structured file can satisfy the demands, but along with the development of technology, application extension, some file is to need deletion after setting up, and therefore this sequential organization no longer satisfies the demands.
The existing problem of sequential file structure is, is necessary for a disk space that file allocation is continuous.If a file can be deposited in a plurality of discrete pieces, just can eliminate above-mentioned shortcoming.Existing most of smart card operating systems adopt the disposal route of chain type storage organization, and a plurality of discrete dish block chaining that will belong to a file by the indicator linking on each dish piece becomes same chained list.The pointer explicitly of each physical block of chained file can be left in the chained list and just form a file allocation table.
The shortcoming of chain file is not support direct access efficiently, needs frequent visit FAT (FileAllocation Table file allocation table) to calculate the piece number at access offset place.And the size of piece fixes, and file big or small indefinite can cause the waste in space in the piece, increased the fragment in the piece.
Because it is to take discrete allocation scheme that link distributes, and has eliminated external fragmentation, so improved operating factor of memory space significantly; Because be current needs according to file, distributing essential dish piece for it again, in the time of the file dynamic growth, can dynamically be its distribution plate piece, so need not know the size of file in advance again.Additions and deletions to file change also very convenient in addition.
Existing smart card document system is divided into base region and expansion area with the memory block, and file is divided into file header (document control information) and file body.The base region adopts sequential organization to place file, and the expansion area adopts chain file to place file.The file header of All Files is all in the base region.
What file header adopted in the base region is the file system of sequential organization, is not tree structure but chain structure in the process of actual storage, address that can the next file file header of sign in the last file header.Just there is certain coupling like this between the file.The for example file header of the file header of the file header of file EF1, file EF2 and file EF3 storage in order in the base region, and the address of sign EF2 file header in the file header of EF1, the address of sign EF3 file header in the file header of EF2, so there are certain coupling in the file header of file EF1, the file header of file EF2 and the file header of file EF3.If the file header of file EF2 is deleted, then need in the file header of EF1, identify the address of EF3 file header, as seen (file header and the file body that are EF2 are deleted) behind the deleted file EF2, need carry out corresponding modification to EF1, simultaneously if also have other file or file header behind the EF3 file header, also need to identify again the address of the file header of its back in the EF3 file header.Can certainly be file header storage in order in the base region of file header, file EF2 (comprising file header and file body) and the file EF3 of file EF1, behind the deleted file EF2, carry out above-mentioned similar operations.
Existing file system adopts the base region to add the form of expansion area separate management.Be placed on the file of expansion area for needs, the form that its adopts file body and file header separately to deposit, file body is placed on the expansion area, and file header is placed on the base region.File header and other are built the file structure storage in order of base region in.Because the correlativity between the file after the file delete, need rebulid the contact between the existing file, so deleted file is handled loaded down with trivial details.
Summary of the invention
Handle loaded down with trivial details problem for the file delete that solves in the smart card, the embodiment of the invention provides a kind of file memory method of smart card, comprising:
Treating in the same private file DF file body preserved in the file header of file the basic document head in order structure store, the basic document head comprises the initial address message (IAM) of the extendfile head in file identification information and the file header, and the basic document head takies fixed-size storage space;
Start address by the extendfile head in the basic document head is stored the extendfile head;
According to the file body memory address relevant information in the file header file body is stored.
The embodiment of the invention also provides a kind of file memory method of smart card simultaneously, comprising:
The file header that treating in the same DF file body preserved file structure is in order stored, and file header comprises the initial address message (IAM) of file identification information and file body, and file header takies fixed-size storage space;
Initial address message (IAM) by the file body in the basic document head is stored file body.
The embodiment of the invention also provides a kind of file read method of smart card simultaneously, is used to read the basic document head of storage means storage as the aforementioned, comprising:
Determine the start address of DF file body at the basic document head place of file to be read, according to the start address of DF file body, the file identification of fixing by size side-play amount retrieval and the file identification coupling of file to be read;
File body memory address relevant information according in the file header at the file identification place of mating obtains the file body initial address message (IAM);
Read the information to be found in the file body.
The embodiment of the invention also provides a kind of file read method of smart card simultaneously, is used to read the file body of storage means storage as the aforementioned, comprising:
Determine the start address of DF file body at the file header place of file to be read, according to the start address of DF file body, the file identification of fixing by size side-play amount retrieval and the file identification coupling of file to be read;
Initial address message (IAM) according to the file body in the file header at the file identification place of mating reads the information to be found in the file body.
The embodiment of the invention also provides a kind of file storage device of smart card simultaneously, comprising:
Basic document head memory module: be used for same private file DF file body wait to preserve in the file header of file the basic document head in order structure store, the basic document head comprises the initial address message (IAM) of the extendfile head in file identification information and the file header, and the basic document head takies fixed-size storage space;
Extendfile head memory module: be used for the extendfile head being stored by the start address of the extendfile head of basic document head;
The first file body memory module: be used for file body being stored according to the file body memory address relevant information of file header.
The embodiment of the invention also provides a kind of file storage device of smart card simultaneously, comprising:
The file header memory module: be used for the file header of waiting to preserve file of same DF file body in order structure store, file header comprises the initial address message (IAM) of file identification information and file body, file header takies fixed-size storage space;
The second file body memory module: be used for file body being stored by the initial address message (IAM) of the file body of basic document head.。
The embodiment of the invention also provides a kind of document reading apparatus of smart card simultaneously, is used to read the basic document head of storage means storage as the aforementioned, comprising:
First determination module: be used for determining the start address of DF file body at the basic document head place of file to be read, according to the start address of DF file body, the file identification of fixing by size side-play amount retrieval and the file identification coupling of file to be read;
Acquisition module: be used for file body memory address relevant information, obtain the file body initial address message (IAM) according to the file header at the file identification place of mating;
First read module: the information to be found that is used for reading file body.
The embodiment of the invention also provides a kind of document reading apparatus of smart card simultaneously, is used to read the basic document head of storage means storage as the aforementioned, comprising:
Second determination module: be used for determining the start address of DF file body at the file header place of file to be read, according to the start address of DF file body, the file identification of fixing by size side-play amount retrieval and the file identification coupling of file to be read;
Second read module: be used for the initial address message (IAM) of file body, read the information to be found in the file body according to the file header at the file identification place of coupling.
The specific embodiments that is provided by the invention described above as can be seen, take fixed-size storage space just because of each basic document head or file header, need not rebulid the contact between the existing file when making file delete, thereby simplify the deleted file processing procedure.
Description of drawings
Fig. 1 is the first embodiment file logical structure synoptic diagram provided by the invention;
Fig. 2 is the first embodiment method flow diagram provided by the invention;
Fig. 3 is the first embodiment file physical structure synoptic diagram provided by the invention;
Fig. 4 is the second embodiment method flow diagram provided by the invention;
Fig. 5 is the 3rd an embodiment system construction drawing provided by the invention;
Fig. 6 is the 4th an embodiment system construction drawing provided by the invention;
Fig. 7 is the 5th an embodiment method flow diagram provided by the invention;
Fig. 8 is the 6th an embodiment system construction drawing provided by the invention.
Embodiment
In order to solve after the file delete in the smart card, need rebulid the problem of the contact between the existing file, first embodiment provided by the invention is a kind of file memory method of smart card, at first the file system in the present embodiment is described, file system in the present embodiment adopts 32 COS file system, comprises 1 file interface layer and 3 functional layers: Drive Layer, document storage management layer, FLASH conversion coating.File interface is used for carrying out information interaction with the external world, reading and writing, wipes the file in the smart card.Drive Layer realizes concrete Flash (in the present embodiment as storage space) is carried out reading and writing, the driving of operation such as wipes, and is the set of Flash operational attribute.
The FLASH conversion coating, the main senior interactive function of realizing between Drive Layer and the file system storage administration layer, each physics can be wiped the relation of piece among managing file system and the Flash, and intelligent processing capacity, for example be used for the mapping of mechanism, piece, wear leveling (wear-leveling) bad block management of the logical address of file being converted to physical address or the like.
The document storage management layer is the core of total system, comprises the logical organization and the physical arrangement of regulation file, and it has directly determined the validity of storage space utilization and the access speed of file.
This novel smart card document system has adopted the mode of two kinds of file physical structure combinations to carry out the management of storage space.The memory block also is divided into base region and expansion area.The sequential structure is adopted in the base region, and chain structure is adopted in the expansion area, can build the base region in for the read-only class file that needs fast access, can build the expansion area in for the file of needs deletion.
The document storage management layer is divided into 6 parts with its free memory, consider that management needs easily, each zone of file system layer is divided according to the sector, is the base unit of operation with the sector, certainly in a certain specific sector, can carry out with the byte is the write operation of unit.
Consider that norflash is unit with the page or leaf, every page of 256 bytes, in the present embodiment, a page or leaf is a sector.
Arrange in the following order these fundamental regions.As shown in table 1:
Division name Boot sector (BR) The power down protection district The base region Expansion area chained list 1 Expansion area chained list 2 Root sector (MF) The expansion area
Table 1
Boot sector (promoter region) is first important data structure in the file system, it is positioned at first sector of file system layer, the information relevant with the file system storage organization all leaves in here, powers on to read start address and the some other essential information that this sector can obtain each district by program initialization at every turn.
The power down protection district is the sector of reserving for the power down protection backup area.
The sequential storage mode is adopted for tightening storage area in the base region, and what deposit is file extent information and file body.Speed was fast when the advantage of base region sequential file was consecutive access, the efficient height, and (except that storage file itself, not needing other extra storage) saved in storage.Its shortcoming is that random processing efficient is low, and maximum problem is exactly cumbersome for the physical sequential insertion and the deletion action of maintenance documentation, is easy to cause fragment.Therefore the file of building the file base region in had better not be deleted, if deletion, the space of the base region at file place be not released (promptly for example the file header of EF2 deleted after, the storage space of storing the file header of EF2 originally is not used to store other file), remove nonsystematic by reformatting.
The expansion area chained list adopts the chained list of FAT form, and the FAT table is used for a kind of chain structure of file index and location.Here the FAT table is responsible for the space of expansion area is managed, and is equivalent to the catalogue of expansion area.
The root sector is used for depositing all information of MF head, distributes first bunch of starting cluster as the root sector of expansion area simultaneously, and wherein MF is the DF of root directory.
The expansion area adopts chain file to place file.Single file all is to connect by chained list to begin from first sector of expansion area bunch being the processing that unit carries out data, bunch is the fundamental element of chained list.
In order to carry out correct access to a DF file or EF file, be necessary for file and be provided for describing data structure with control documents, be called file header.File header comprises following three category informations, essential information, access control information and use information.
Documentor can impose various operations to file by means of the information of file header.File and file header are one to one, and the ordered set of file header is exactly catalogue file, i.e. DF.
All EF and DF structure can be divided into the form of file header+file body.For the EF file body is the set of data element associated with the file.And for DF, the DF file body is exactly the set of file header (being the DF file header of EF file header and its next stage).
Can realize the appropriate tissue of file and effectively management by the file directory management.Reasonably the method for organization directory structure can be accelerated the speed to catalog search.
Adopt the mode of basic document head fixed length in the present embodiment, the file applications difference has determined that then the length of its file header is indefinite.The file header or the file header of EF that are DF should all be relevant with his father DF.Just DF or the file header of EF all should be placed in his father DF file body.If file header structure is in order placed, so the simplest mode is to place file header according to the LV form, promptly indicates the length L of oneself in the previous file head, so just can learn the start address of its next file header.During locating file, find the address of next file header according to the size of L appointment.Because the length difference of each file header in the prior art, if any one file delete wherein, the shared space of its file header will form fragment, equal the size that the file header of file is set up in next preparation just because can not guarantee the original occupation space of this document head.In order to guarantee the validity of LV form, must be with the file header of other EF or DF to reach.Certainly also can adopt the mode of file header fixed length, the file header that is each file is set to fixed length, but compare with such scheme, because file applications difference, the size of the useful information of the file header of each file can be different, if adopt the mode of file header fixed length, the file header less for useful information then need replenish a little garbages, causes the waste of unnecessary storage space.
The front is mentioned, and only needs the essential information of file during retrieval.And that these essential informations are All Fileses is total, as attributes such as filenames.Because essential information is exactly the basic document head of file, for the ease of the needs of retrieval and deleted file.With the basic document head fixed size of all DF and EF, document retrieval work is equivalent to search next file and only need move fixing side-play amount searching the operation of record in the fixed-length record file with sequential organization like this.And also need not to influence the basic document head of alternative document during deleted file.And the shared space of the basic document head of deleted file can also be reused by newly-established file.
Also adopt the file header of DF and EF all to adopt the form of unified basic document head and extendfile head in the present embodiment, in the process of catalog file, only used the filename essential information, only when finding file header filename wherein and specifying the filename that to search to match, just need from this directory entry, to read the physical address of this document.And the information in some other this document head need not when catalog without exception.Therefore can adopt way, file header is divided into the form of basic document head and extendfile head, only place the basic document head in the file body of file directory DF the unpack in filename and other file header.The basic document head comprises the address of filename and extendfile head.And the information in other the file header is put together as the file body of extendfile head and file.
The tree structure of file directory all is placed on the expansion area management.The front is mentioned catalogue file DF is used as file processing.Only deposit the basic document head in the DF file body, so file header and file body are deposited separately.Because EF that DF sets up down and the number of DF are indefinite, so the shared space of DF can not fixed size, and can dynamic assignment.The chain file structure satisfies the demand of DF.Therefore all DF are placed on the expansion area.
If quantity of documents is too much, the space is not enough, can reallocate one bunch and give current DF.Number and the form of setting up DF and EF under this DF are not subjected to any restriction.Because the expansion area manages the space according to the form of piece chained list, therefore, build the file of expansion area and the deletion that DF can be random in, its shared space can be released automatically by the FAT table and reclaim.
The basic document head of EF is to be placed in the file body of DF.And the extendfile head of EF and file body can be specified together and built base region or expansion area in.The size of extendfile head length degree and file body can be specified by the basic document head, also can be specified by the extendfile head, and the extendfile head leaves file body front (can certainly make the address of specifying file body in the extendfile head) in.
DF handles according to the processing mode of EF equally.The form that DF is divided into basic document head+extendfile head+file body.The basic document head of DF is placed in the file body of his father DF, the extendfile head of DF and file body are done as a whole being placed in the index block of expansion area for this DF distribution, the file body of DF is used for placing the basic document head of all EF under the basic document head of DF of this DF next stage and this DF.
After adopting this mode, for build in DF under the same DF and EF between them without any the coupling contact, just relevant with the DF at its place.
Present embodiment is that example describes with file EF2, the EF3 that stores as Fig. 1 logical organization, and method flow comprises as shown in Figure 2:
Step 101: with the basic document head of file EF2 in the DF1 file body and file EF3 in order structure store.The basic document head of EF2 comprises the start address of the extendfile head of file identification information " EF2 " and EF2, EF2 basic document head takies 16 bytes, the basic document head of EF3 comprises the start address of the extendfile head of file identification information " EF3 " and EF3, EF3 basic document head takies 16 bytes, and EF2 and EF3 basic document head take fixed-size storage space.
Step 102: press the start address of each self-corresponding extendfile head in EF2 and the EF3 basic document head, respectively the extendfile head of EF2 and EF3 is stored.The extendfile head comprises file type, file body memory address relevant information.
Step 103: press the file body memory address relevant information in the extendfile head of EF2 and EF3, respectively the file body of EF2 and EF3 is stored.
Step 101 in practical operation, when the file logic of EF3 be the file organization form be MF DF1 EF3.Then at first read the address of the MF extendfile head in the MF basic document head that is stored in the root sector, after obtaining the address of MF extendfile head, because MF extendfile head back is deposited the MF file body in proper order, and the MF file body memory address relevant information in the MF extendfile head comprises: the size of MF extendfile head, therefore can know the start address of the file body of MF, with the basic document head sequential storage of DF1 after the file body of MF, and in the basic document head of DF1, indicate the address of the extendfile head of distributing to DF1, indicate the size of the extendfile head of distributing to DF1 in the extendfile head of DF1, the basic document head of EF2 and EF3 structure is in order stored behind the extendfile head of DF1.
Certainly, in the step 101 can also be with the basic document head of file EF2 in the DF1 file body and file EF3 in order structure store.The basic document head of EF2 comprises the start address of the extendfile head of file identification information " EF2 " and EF2, and the size of the extendfile head of EF2, EF2 basic document head takies 16 bytes, same EF3 is similar, like this, compare with the scheme that in the extendfile head, comprises the size of extendfile head of EF2 or EF3, the start address of the extendfile head of EF2 or EF3, the size of extendfile head is stored in the basic document head, the size that can also in the basic document head of EF2 or EF3, comprise the file body of EF2 or EF3, wherein the file body memory address relevant information of EF2 or EF3 all is present in the basic document head, comprising: the start address of extendfile head, the size of extendfile head.
In EF2 and EF3 basic document head, indicate the start address of distributing to each self-corresponding extendfile head in the step 102, afterwards by the start address of the extendfile head of EF2 that distributes and EF3, respectively the extendfile head of EF2 and EF3 is stored, and indicated the size of the big or small and file body separately of extendfile head separately in the extendfile head of EF2 and EF3 respectively.Wherein, the start address of the extendfile head of EF2 and EF3 is as the some of file body memory address relevant information, file body memory address relevant information also comprises: the structure storage in order of the size of the extendfile head in the extendfile head of EF2 and EF3, the extendfile head of EF2 and EF3 and file body.
If adopt the scheme that comprises the size of extendfile head in the basic document head, then need not in the extendfile head of EF2 and EF3, to indicate respectively the size of extendfile head separately in this step.
In the step 103 because know the start address of EF2 and EF3 extendfile head separately and the size of extendfile head, so can obtain the start address of the file body of EF2 and EF3 separately, so just can be with the file body of EF2 and EF3, after structure is stored in extendfile head by EF2 and EF3 in order.
If adopt the scheme that comprises the size of extendfile head in the basic document head, then can directly obtain the start address of file body, can also in the basic document head, comprise the size of file body by the file body memory address relevant information (being the start address of extendfile head, the size of extendfile head) of basic document head.
The basic document head of each file, extendfile head and file body are in the storage configuration of storage space as shown in Figure 3 in the present embodiment.
Certainly step 102 also can be indicated respectively in the file header (can be extendfile head or basic document head) of EF2 and EF3 and distribute to the start address of file body separately, stores the file body of EF2 and EF3 in step 103 by the start address of distributing.With the file body of EF2 and EF3 in order structure be stored in by the mode behind the extendfile head of EF2 and EF3 and compare with this mode, do not need to determine the start address of the file body of distributing according to the FAT table.No matter be to adopt in the above-mentioned the sort of mode file header all to comprise file body memory address relevant information (file body memory address relevant information is the start address of file body) herein, so that when reading, know the memory address of file body by file header.
Present embodiment is illustrated with two files of EF2, EF3, and same similarly method also can be used for file DF2, EF2 and the EF3 of DF1 next stage are stored.
As the preferred version in the present embodiment is that basic document head with EF2, EF3 is stored in the expansion area, and like this, if file EF2 is deleted, then its shared space can be released automatically by the FAT table and reclaim.
As the preferred version in this enforcement, can be stored in the base region for the extendfile head that is difficult for deleted file equally, speed is fast during with the assurance access, efficient height, saving storage space.Extendfile head for easy deleted file can be stored in the expansion area, and when file was deleted like this, its shared space can be released automatically by the FAT table and reclaim.
Can also adopt following step in the present embodiment, at first with the file header of file EF2 in the DF1 file body and file EF3 in order structure store.The file header of EF2 comprises the start address of the file body of file identification information " EF2 " and EF2, the EF2 file header takies 48 bytes, the file header of EF3 comprises the start address of the extendfile head of file identification information " EF3 " and EF3, EF3 basic document head takies 48 bytes, and EF2 and EF3 basic document head take fixed-size storage space.Press in EF2 and the EF3 file header start address of corresponding file body separately afterwards, respectively the file body of EF2 and EF3 is stored.Aforementioned employing is compared the scheme that file header is divided into basic document head and extendfile head with this programme, because the information that comprises in the basic document head is less, the basic document head length degree of each file is similar, therefore each file adopts the mode of basic document head fixed length, can better save the waste that storage space reduces storage space.
Second embodiment of the invention is a kind of file read method of smart card, and method flow comprises as shown in Figure 4:
Step 201: determine the start address of DF1 file body at the basic document head place of file EF3, according to the start address of DF file body, by the file identification of 16 bytes retrieval with file identification information " EF3 " coupling.
Step 202: the initial address message (IAM) of the extendfile head of indicating in the basic document head according to EF3 obtains the memory address relevant information of file body in the EF3 extendfile head.
Step 203: after obtaining the memory address relevant information of EF3 file body, read the information to be found in the EF3 file body.
Step 201 is in practical operation, read the address of the MF extendfile head in the MF basic document head that is stored in the root sector, after obtaining the address of MF extendfile head, because MF extendfile head back is deposited the MF file body in proper order, and the MF file body memory address relevant information in the MF extendfile head comprises: the size of MF extendfile head, therefore can know the start address of the file body of MF, by 16 bytes is unit, basic document head in the file body of traversal MF, find the basic document head of DF1, pass through the address of the extendfile head in the basic document head of DF1 again, find the extendfile head of DF1 and then find the file body of DF1, by 16 bytes is unit, travels through the basic document head in the DF1 file body, has then found the basic document head of EF3.Because in embodiment one in the file storage, be the storage that the side-play amount of fixing by size 16 bytes is carried out, therefore when reading, the side-play amount of Gu Ding 16 bytes travels through the file header in the file body equally by size.
Step 202 is in practical operation, file body memory address relevant information according to EF3, it is the initial address message (IAM) of the extendfile head indicated in the basic document head, and the size of the extendfile head of indicating in the extendfile head, obtain the start address (extendfile head and file body are in order) of EF3 file body.Perhaps directly read the start address of the EF3 file body of indicating in the EF3 extendfile head.
The file body memory address relevant information of indicating in can certainly basic document head according to EF3, it is the initial address message (IAM) of extendfile head, and the size of the extendfile head of indicating in the basic document head, obtain the start address (extendfile head and file body are in order) of EF3 file body.Perhaps directly read the start address of the EF3 file body of indicating in the EF3 basic document head.
Step 203 according to the start address of EF3 file body, just can read the information to be found in the EF3 file body according to demand in practical operation.
The 3rd embodiment provided by the invention is a kind of file storage device of smart card, and its structure comprises as shown in Figure 5:
Basic document head memory module 301: be used for same private file DF file body wait to preserve in the file header of file the basic document head in order structure store, the basic document head comprises the initial address message (IAM) of the extendfile head in file identification information and the file header, and the basic document head takies fixed-size storage space;
Extendfile head memory module 302: be used for the extendfile head being stored by the start address of the extendfile head of basic document head;
The first file body memory module 303: be used for file body being stored according to the file body memory address relevant information of file header.
The 4th embodiment provided by the invention is a kind of file storage device of smart card, and its structure comprises as shown in Figure 6:
File header memory module 401: be used for the file header of waiting to preserve file of same DF file body in order structure store, file header comprises the initial address message (IAM) of file identification information and file body, file header takies fixed-size storage space;
The second file body memory module 402: be used for file body being stored by the initial address message (IAM) of the file body of basic document head.
The 5th embodiment provided by the invention is a kind of document reading apparatus of smart card, is used to read the basic document head of storage means storage as described above, and its structure comprises as shown in Figure 7:
First determination module 501: be used for determining the start address of DF file body at the basic document head place of file to be read, according to the start address of DF file body, the file identification of fixing by size side-play amount retrieval and the file identification coupling of file to be read;
Acquisition module 502: be used for file body memory address relevant information, obtain the file body initial address message (IAM) according to the file header at the file identification place of mating;
First read module 503: the information to be found that is used for reading file body.
The 6th embodiment provided by the invention is a kind of document reading apparatus of smart card, is used to read the basic document head of storage means storage as described above, and its structure comprises as shown in Figure 8:
Second determination module 601: be used for determining the start address of DF file body at the file header place of file to be read, according to the start address of DF file body, the file identification of fixing by size side-play amount retrieval and the file identification coupling of file to be read;
Second read module 602: be used for the initial address message (IAM) of file body, read the information to be found in the file body according to the file header at the file identification place of coupling.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.

Claims (18)

1. the file memory method of a smart card is characterized in that, comprising:
Treating in the same private file DF file body preserved in the file header of file the basic document head in order structure store, the basic document head comprises that file identification information and waiting preserves the initial address message (IAM) of the extendfile head in the file header of file, and the basic document head takies fixed-size storage space;
Start address by the extendfile head in the basic document head is stored the extendfile head;
According to the file body memory address relevant information in the extendfile head file body is stored.
2. the method for claim 1, it is characterized in that, file body memory address relevant information comprises: be stored in the extendfile head in the basic document head initial address message (IAM), be stored in the size of the extendfile head in the extendfile head, the structure storage in order of extendfile head and file body.
3. the method for claim 1 is characterized in that, file body memory address relevant information is stored in the basic document head and comprises: the structure storage in order of the size of the initial address message (IAM) of extendfile head, extendfile head, extendfile head and file body.
4. as the described method of the arbitrary claim of claim 1 to 3, it is characterized in that file to be preserved is private file DF and/or basic document EF file.
5. as the described method of the arbitrary claim of claim 1 to 3, it is characterized in that the basic document head is stored in the expansion area.
6. as the described method of the arbitrary claim of claim 1 to 3, it is characterized in that the extendfile head is stored in the base region, the basic document head also comprises and is used to identify the memory block identification information that the extendfile head is stored in the base region; Or
The extendfile head is stored in the expansion area, and the basic document head also comprises and is used to identify the memory block identification information that the extendfile head is stored in the expansion area.
7. the file memory method of a smart card is characterized in that, comprising:
The file header that treating in the same private file DF file body preserved file structure is in order stored, and file header comprises the initial address message (IAM) of file identification information and file body, and file header takies fixed-size storage space;
Initial address message (IAM) by the file body in the basic document head in the file header is stored file body.
8. the file read method of a smart card is characterized in that, is used to read the file body of the method for claim 1 storage, comprising:
Determine the start address of private file DF file body at the basic document head place of file to be read, according to the start address of private file DF file body, the file identification of fixing by size side-play amount retrieval and the file identification coupling of file to be read;
File body memory address relevant information according in the extendfile head at the file identification place of mating obtains the file body initial address message (IAM);
Read the information to be found in the file body.
9. method as claimed in claim 8 is characterized in that, file body memory address relevant information comprises: the initial address message (IAM) of the extendfile head in the basic document head, and the size of the extendfile head in the extendfile head.
10. method as claimed in claim 8 is characterized in that, file body memory address relevant information comprises: the initial address message (IAM) of the extendfile head in the extendfile head, and the size of extendfile head.
11., it is characterized in that file to be read is private file DF and/or basic document EF file as the described method of the arbitrary claim of claim 8 to 10.
12., it is characterized in that the start address of the private file DF file body at the basic document head place of file to be read is the address, expansion area as the described method of the arbitrary claim of claim 8 to 10.
13., it is characterized in that the basic document head comprises also and be used to identify the memory block identification information that the extendfile head is stored in the base region that the start address of extendfile head is the address, base region as the described method of the arbitrary claim of claim 8 to 10; Or
The basic document head comprises also and is used to identify the memory block identification information that the extendfile head is stored in the expansion area that the start address of extendfile head is the address, expansion area.
14. the file read method of a smart card is characterized in that, is used to read the file body of method storage as claimed in claim 7, comprising:
Determine the start address of private file DF file body at the file header place of file to be read, according to the start address of private file DF file body, the file identification of fixing by size side-play amount retrieval and the file identification coupling of file to be read;
Initial address message (IAM) according to the file body in the basic document head at the file identification place of mating reads the information to be found in the file body.
15. the file storage device of a smart card is characterized in that, comprising:
Basic document head memory module: be used for same private file DF file body wait to preserve in the file header of file the basic document head in order structure store, the basic document head comprises that file identification information and waiting preserves the initial address message (IAM) of the extendfile head in the file header of file, and the basic document head takies fixed-size storage space;
Extendfile head memory module: be used for the extendfile head being stored by the start address of the extendfile head of basic document head;
The first file body memory module: be used for file body being stored according to the file body memory address relevant information of extendfile head.
16. the file storage device of a smart card is characterized in that, comprising:
The file header memory module: be used for the file header of waiting to preserve file of same private file DF file body in order structure store, file header comprises the initial address message (IAM) of file identification information and file body, file header takies fixed-size storage space;
The second file body memory module: be used for file body being stored by the initial address message (IAM) of the file body in the file header basic document head.
17. the document reading apparatus of a smart card is characterized in that, is used to read the file body of the method for claim 1 storage, comprising:
First determination module: the start address of private file DF file body that is used for determining the basic document head place of file to be read, according to the start address of private file DF file body, the file identification of the fixing by size side-play amount retrieval and the file identification coupling of file to be read;
Acquisition module: be used for file body memory address relevant information, obtain the file body initial address message (IAM) according to the extendfile head at the file identification place of mating;
First read module: the information to be found that is used for reading file body.
18. the document reading apparatus of a smart card is characterized in that, is used to read the file body of method storage as claimed in claim 7, comprising:
Second determination module: the start address of private file DF file body that is used for determining the file header place of file to be read, according to the start address of private file DF file body, the file identification of the fixing by size side-play amount retrieval and the file identification coupling of file to be read;
Second read module: be used for the initial address message (IAM) of file body, read the information to be found in the file body according to the basic document head at the file identification place of coupling.
CN2009100857733A 2009-05-31 2009-05-31 File memory and read method of smart card and device thereof Expired - Fee Related CN101571869B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009100857733A CN101571869B (en) 2009-05-31 2009-05-31 File memory and read method of smart card and device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009100857733A CN101571869B (en) 2009-05-31 2009-05-31 File memory and read method of smart card and device thereof

Publications (2)

Publication Number Publication Date
CN101571869A CN101571869A (en) 2009-11-04
CN101571869B true CN101571869B (en) 2011-04-20

Family

ID=41231226

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009100857733A Expired - Fee Related CN101571869B (en) 2009-05-31 2009-05-31 File memory and read method of smart card and device thereof

Country Status (1)

Country Link
CN (1) CN101571869B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111090396A (en) * 2019-12-10 2020-05-01 联想(北京)有限公司 File processing method and device and electronic equipment

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073634B (en) * 2009-11-20 2013-10-23 中国银联股份有限公司 Smart card file system and file selection method thereof
CN102253938B (en) * 2010-05-18 2015-05-20 深圳市朗科科技股份有限公司 Method and device for writing and restoring file
US9424267B2 (en) * 2013-01-02 2016-08-23 Oracle International Corporation Compression and deduplication layered driver
CN103631857A (en) * 2013-10-22 2014-03-12 北京昆腾微电子有限公司 Smart card file system and method for searching file
CN103970869A (en) * 2014-05-12 2014-08-06 浙江宇视科技有限公司 Large file storage method
CN104536869B (en) * 2014-12-12 2017-09-12 华为技术有限公司 Mobile terminal and its method for managing resource
CN106354718B (en) * 2015-07-13 2021-05-25 中国移动通信集团公司 File management method and device of user identification module
CN107330118A (en) * 2017-07-13 2017-11-07 北京智芯微电子科技有限公司 A kind of method and device of storage COS files
CN111225169B (en) * 2018-11-26 2023-02-03 浙江宇视科技有限公司 Storage method and device for small video files
CN110083675B (en) * 2019-04-19 2021-11-30 宝能汽车集团有限公司 Text processing method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1547130A (en) * 2003-11-28 2004-11-17 北京中星微电子有限公司 A MIDI music file
CN1633141A (en) * 2005-01-18 2005-06-29 大唐微电子技术有限公司 Method for importing SIM card telephone directory into intelligent terminal and intelligent terminal therefor
CN101345790A (en) * 2007-07-09 2009-01-14 上海基信通讯技术有限公司 Method for editing audio files in mobile phone

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1547130A (en) * 2003-11-28 2004-11-17 北京中星微电子有限公司 A MIDI music file
CN1633141A (en) * 2005-01-18 2005-06-29 大唐微电子技术有限公司 Method for importing SIM card telephone directory into intelligent terminal and intelligent terminal therefor
CN101345790A (en) * 2007-07-09 2009-01-14 上海基信通讯技术有限公司 Method for editing audio files in mobile phone

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111090396A (en) * 2019-12-10 2020-05-01 联想(北京)有限公司 File processing method and device and electronic equipment

Also Published As

Publication number Publication date
CN101571869A (en) 2009-11-04

Similar Documents

Publication Publication Date Title
CN101571869B (en) File memory and read method of smart card and device thereof
CN106708427B (en) A kind of storage method suitable for key-value pair data
CN103229173B (en) Metadata management method and system
CN100426259C (en) Virtual access method of storage document data
CN101968795B (en) Cache method for file system with changeable data block length
CN103646063B (en) A kind of spaceborne high speed document management system
CN101488153A (en) Method for implementing high-capacity flash memory file system in embedded type Linux
CN100424699C (en) Attribute extensible object file system
CN101315628A (en) Internal memory database system and method and device for implementing internal memory data base
CN101241476A (en) Dummy storage system and method
WO2021208239A1 (en) Low-latency file system address space management method and system, and medium
CN102073464A (en) Method for creating allocation-on-demand incremental volume
CN106682110B (en) Image file storage and management system and method based on Hash grid index
CN101241472A (en) Mapping management process and system
CN103514249A (en) Method and system for automatic data reduction and storage device
CN102169460A (en) Method and device for managing variable length data
CN102567427A (en) Method and device for processing object data
CN102915340A (en) Expanded B+ tree-based object file system
CN107239526A (en) File system implementation method, scrap cleaning method, operating position localization method
CN102253985B (en) File system data management method and system
CN101344861A (en) Smart card internal memory management method
CN102024060B (en) Method for memorizing files and restoring error deleted files
CN102541969B (en) File protection method and system based on file allocation table (FAT) file system, and memory
CN109656481A (en) A method of it improving smart card document system FLASH and the service life is written
CN102279805A (en) Memory data storing and reading method

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
CB03 Change of inventor or designer information

Inventor after: Zhang Nan

Inventor after: Yang Guilong

Inventor after: Wang Youjun

Inventor before: Zhang Nan

Inventor before: Yang Guilong

CB03 Change of inventor or designer information
CP01 Change in the name or title of a patent holder

Address after: 100015 Beijing city Chaoyang District Dongzhimen West eight Street No. 2 room Wanhong Yan Dong Business Garden

Patentee after: BEIJING WATCHDATA Co.,Ltd.

Address before: 100015 Beijing city Chaoyang District Dongzhimen West eight Street No. 2 room Wanhong Yan Dong Business Garden

Patentee before: BEIJING WATCH DATA SYSTEM Co.,Ltd.

CP01 Change in the name or title of a patent holder
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110420

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