File type in the CPU card

According to the tree-like in-card file structure, the files in the CPU card are classified into three types: a main file MF, a special file DF, and a basic file EF.

1, the main file MF

There is only one root file in the file tree of each card file system, and all other files are subfiles of the file.

This file is also the entrance to the entire card, called MF (Master File). There is one and only one MF in each card.

MF is also the most important file in the file system. The operation of the card usually starts with selecting MF. In addition, due to the particularity of the MF, the identifier of the MF is usually defined as 3F00, so that for different cards, the MF selection operation can usually be performed by this default identifier. Since the MF does not have a parent file, it must exist in the application phase of the card, so the MF must be established first during the initialization phase of the card. Other than that, the other properties of MF are exactly like DF.

2, special file DF

DF is similar to the directory file in the PC file system. In general, MF can also be regarded as a special DF.

If the MF is mapped as a logical map of a card, a DF can often be viewed as a type of data or a mapping of applications within the card. Generally, DFs of the same level are completely independent, and COS can ensure data independence and security between them; for different levels of DF, including DF with parent-child relationship, in actual application stage, it can be applied according to actual application. Define security logic that implements isolation or hosting.

In order to identify different DFs, each DF has a unique file identifier under the same level DF and a globally unique application identifier (AID) within the card.

In practice, the file identifier is usually identified by an integer of type Word, and its value is a multiple of 0x100, such as 3F00, 4F00, 5F00, and so on. 1F00 and 2F00 are usually reserved as system special file identifiers. The application identifier AID is usually a finite-length binary string, usually as a brief description of the application corresponding to the DF. Both the file identifier and the application identifier can be used to retrieve the current file sub-layer DF file. If the file identifier is used to retrieve the condition using 3F00, the COS automatically selects the MF; if the card resource allows, the COS can also implement all the cards. The DF or all sub-DF files included in the current DF are searched. In this case, the AID is generally used as the retrieval condition.

The DF can be divided into two categories: DDF and ADF.

(1) Directory-specific file DDF

If a sub-DF is also included in a DF, that is, if the child nodes are not all leaf nodes in the file tree, such a DF is called a DDF (Directory Definition File).

In general, DDF can be used as a collection of applications (DFs) or as an entry point for complex multi-level applications.

In a multi-application card, MF usually contains multiple DFs, where MF is a typical DDF. In order to maintain and manage all DFs under DDF, a system file (DIR file) can generally be included under each DDF to record the entries of all sub-DFs.

(2) Application special file ADF

If there is no other sub-DF in a DF, that is, if all the child nodes in the file tree are all leaf nodes, such a DF is called an Application Definition File (ADF).

Generally, the ADF is a logical mapping applied to the card. The ADF contains stored data files. From the outside of the card, an ADF can be regarded as a collection containing only file control information and data objects.

There are no DF files under ADF, so there is no need for DIR files.

In theory, as long as the card space allows, numerous file structures can be created in the card. However, from the practical application of the card, few applications will require more than three layers of DF structure, namely MF, DDF, ADF; more generally, if the card resources are limited, the application target is clear, COS can only support Two-layer DF structure, namely MF, ADF (MF is the only DDF in the card).

COS's support for multi-level DF architecture can bring great application flexibility, but it also greatly increases the complexity of COS development. The choice of DF level has a great relationship with the card-oriented application, and can be selected according to different application requirements. For example, in a COS that supports only a single application, MF can be directly used as an ADF, and DDF is not supported. For a COS supporting multiple applications, a two-layer DF structure can usually be selected, and each ADF under the MF corresponds to a separate application; For card resources, you can support complex application modes. For cards that build dynamic application systems, you can choose to implement a 3-layer or even unlimited multi-layer DF mode.

3, the basic data file EF

In the file tree, if a file node has no children, that is, it is itself a leaf node, such a file is called EF (Elementary File).

EF is the basic carrier of data in the card. According to different forms, EF files can be divided into different types. COS defines different file operation logic according to various types of EF.

In the card, EF belongs to a certain DF, and COS uses two ways to identify EF. One is the file identifier FID of the EF. Generally, the EF and the parent DF have the same FID high byte. The EF FID low byte is used as the extended short file identifier of the EF file, called eSFI, the lower 5 bits of the eSFI. For the short file identifier SFI, all EFs have different SFI requirements under the same DF. The second is the file type of EF. The file type identifier is included in the file attribute description of each EF. Some special types of EFs are unique under the same DF.

The choice of EF is different from DF. The operation of the DF generally requires an explicit selection operation in advance, the selected DF is used as the current file, and all subsequent file operations are performed on the current file; before the EF operation, the parent DF is selected as the current file, and the EF is required. The choice is implicitly made in the specific operational command. There are two ways to select EF. One is to choose through SFI, SFI is unique under current DF; the other is to select by file type, mainly for the operation of some system files, such as personal password PIN file, symmetric key file, etc. These types of files are also required to exist uniquely under the current DF.

Let's take a look at the different EFs and their modes of operation.

(1) Classification by data structure

The data stored in the card can be divided into two categories, one is transparent stream data, the specific data content and format are interpreted outside the card, the card is interpreted as a continuous binary data stream; the second type is structural data, data In the form of records, COS is able to interpret data as a number of binary records. Depending on the structure of the stored data, EF can be divided into different categories, and EFs of different structures correspond to different types of operations.

a. Transparent binary

A transparent binary is the basis of all the files in the card. The card processes the data as a stream of bytes. The main attribute of the binary is only the size of the file.

The operation of the binary folder includes two modes of reading and writing of file data.

There are two ways to read and write data.

Read and write operations of all data in the file body.
Read and write operations on a section of data in the file body. Before the read and write operations, the offset of the starting position of the segment to be read and written must be given in the file body and the length of the segment to be read or written.

It should be noted that for segment read and write, it is necessary to strictly check whether the segment is beyond the scope of the file body.

b. Fixed length record file

In the fixed length record file, the file body is divided into n equal length segments, and each segment corresponds to one data record.

The main attributes of the binary file include: the size of each record in the record, the total number of records that can be accommodated. In the actual use phase, in order to identify the validity of the record, the number of records that have been currently written may also be included. In order to perform the search one by one, it is also necessary to record the record number of the current operation and the like.

The record number of the current operation is automatically maintained by the COS, and is automatically set to empty when the file is first selected, and then modified according to the actual access.

The operation of the fixed-length record file is performed on the record, including three modes of reading, writing, and adding.

There are several ways to record read and write operations.

Specifies the record read and write operation of the record number. This operation does not change the current operation record sequence number.
The positioning method relative to the current recording position, including the previous and next records of the current record. If the current record number is empty, if the previous record is accessed, the first record is returned, and the current record is set as the first record; if the next record is accessed, the last record is returned, and the current record is set to the last record. recording.
Relative to the global record location, such as the first, last record, etc., this operation will set the record as the current record.

During the operation of the fixed length record, it is necessary to strictly check whether the record number is within the range of the number of records included in the file, whether the record data corresponding to the current record number is valid, and the like.

The addition of the record adds a new record after the last record.

If the last logical record is not the last one in the physical, ie there is still free recording space after that, the new record order is added later, and the new record is set to the logical "last record".
If the last logical record is the last one in the physical, that is, there is no free recording space thereafter, the add operation fails and the card returns the corresponding error code.

c. Variable length record file

The variable length record file is the same as the fixed length record file. The data area of ​​the file body is divided into a plurality of record segments, but the length of each record segment is different, and the card must be positioned according to the actual length of each record.

The properties of the variable length record file include the size of the file body, that is, the maximum value that the sum of all record lengths can reach. In addition, there is the total number of all records contained in the current file. Since the length of the record is not determined, and only the content of each record is stored in the fixed length record file, each record in the variable length record file body must also contain the actual data length of the record. At the same time, the card also needs to record the record number of the current operation and the like.

The record number of the current operation is automatically maintained by the COS, and is automatically set to empty when the file is first selected, and then modified according to the actual access.

The operation of the variable length record file is also performed on the record, including the operations of reading, writing, and adding of the record.

The read and write operations on the record include the following forms.

Specifies the record read and write operation of the record number. This operation does not change the current operation record number.
The positioning method relative to the current recording position, including the previous and next records of the current record. If the current record number is empty, if the previous record is accessed, the first record is returned, and the current record is set as the first record; if the next record is accessed, the last record is returned, and the current record is set to the last record. recording.
Relative to the global record location, such as the first, last record, etc., this operation will set the record as the current record.

It should be noted that the storage of variable length records generally uses chain storage. The important principle that must be followed for the write operation of variable length records is that the new data length must be as long as the original data length, which is also a write operation. The content to be checked during processing. At the same time, it is also necessary to check whether the record number specified by the operation is valid.

The addition to the record is to add a new record after the last record in the body of the file. After the new record is added successfully, it will be called the new last record.

When adding, the card needs to check whether the remaining space of the file body can accommodate the record at this time, including the actual data length of the record and the length of the indicated bytes.

d. Circular fixed length record file

The circular fixed length record file is similar to the fixed length record file, and the file body is divided into a plurality of record segments of equal length, the difference being the relationship between the records. The first and last logical points of the fixed-length record file are basically consistent with the physical meaning, but in the circular fixed-length file, the first record and the last record in the physical meaning of the data space are connected to form a record ring, logic. The first and last records on the top represent the earliest added and newly added entries.

The attributes of the circular fixed length record file include the size of each record accommodated and the number of records that can be accommodated. Also because it is a ring structure, it is necessary to record the recording position of the first logical and logical last. At the same time, the card also needs to record the record number of the current operation and the like.

The record number of the current operation is automatically maintained by the COS, and is automatically set to empty when the file is first selected, and then modified according to the actual access.

The operation of the circular fixed length record file is also performed on the record, including the operations of reading, writing, adding, etc. of the record.

The read and write operations on the record include the following forms.

Specifies the record read and write operation of the record number. This operation does not change the current operation record sequence number.
The positioning method relative to the current recording position, including the previous and next records of the current record. If the current record number is empty, if the previous one is accessed, the first record is returned, and the current record is set as the first record; if the next record is accessed, the last record is returned, and the current record is set as the last record. .
Relative to the global record location, such as the first, last record, etc., this operation will set the record as the current record.

It is important to note that unlike fixed-length records, each record has the concept of the next record and the previous record, which can be looped indefinitely. In addition, the first and last ones are logical concepts. Strictly separated in the physical sense.

The addition to the record is to add a new record after the last logical record in the body of the file.

If the initial record loop is not fully filled, the new record added will occupy an empty position and become the new "last", with the logical first record position unchanged.
If the recording ring is completely full, it is conceivable that the first and last logical points are adjacent, the "first" is the "next record" of the "last", and the "last" is the "first" A "previous record", when a new record is added, the new record will occupy the space of the original "first record", and the old record content is overwritten. The new record will become the "last record" and the next record of the original "first record" will become the new "first record".

Therefore, when the adding operation is performed, the card needs to determine the update of the pointer of the ring according to the occupancy of the recording ring. Unlike the addition of the variable length record file, the ring record file can be added indefinitely.

Of course, the operation mode of different file types can also be extended on the basis of this, or the above operation mode can be simplified to some extent, or even only a transparent binary file type, etc., which can be performed according to the actual needs of the COS. Choose.

(2) Classified by document use

In addition to dividing according to the data structure in the EF file, it is also possible to classify according to the type of data stored in the EF file, that is, according to the purpose of the file.

a. DIR file

A DIR file is a file used to record its child DF under DDF, usually a variable length record file.

Each item recorded corresponds to a sub-DF, which generally includes information such as the AID of the DF.

The application terminal can obtain all the existing ADFs in the card by reading the DIR file, that is, all the applications existing in the card.

The DIR file exists uniquely under DDF and must be created before the child DF is created.

DIR files can be read as log files, but usually do not allow external write file operations. In addition, any explicit operation of the DIR file is generally not implemented, and maintenance of the DIR file is automatically performed by the COS system.

b. PIN file

The PIN file is a file related to card security in the card, and stores the personal password information of the user related to the DF.

The PIN file under DF can be determined according to the needs of the application, and if it exists, it is unique under DF. A PIN file is usually a fixed length record file.

Each item recorded corresponds to a PIN record, which is usually the attribute and content of the PIN. The number of PINs that each PIN file can hold can be defined according to the implementation of the COS. Depending on the specifics of the application, the COS can choose to implement a single PIN or a mode capable of supporting multiple PINs.

The content of the PIN file is important information that needs to be kept secret, and reading is usually not allowed.

There is no explicit selection process for the PIN file, which is automatically searched by the COS during the execution of the command related to the PIN.

There is usually no explicit write operation for the PIN file, usually by adding a PIN, modifying the PIN, reinstalling the PIN, and the like.

c. Symmetric KEY file

The symmetric KEY file is another important file related to card security in the card, and stores various symmetric KEY information related to DF.

The KEY file under DF can be determined according to the needs of the application. If it exists, it exists only under DF. According to the type of KEY saved in the symmetric KEY file, the KEY file can choose to use a fixed length record file or a variable length record file, and the selected type is determined by COS. At present, the DES and 3DES algorithms are generally used as the basis of the symmetric key system in the card security system, so the fixed length record file can be selected.

Each item recorded corresponds to a KEY record, which is usually the attribute and content of the KEY. Each KEY file can usually hold multiple KEY records. The number of occlusions and the role of each KEY are determined by the specific application of the DF.

It is important to note that in the current card security system, each DF has a mandatory symmetric key, which is usually not stored in a symmetric KEY file.

The contents of the KEY file are important information that needs to be kept secret, and reading operations are usually not allowed.

There is no explicit selection process for the KEY file, which is automatically searched by the COS during the execution of the command related to the KEY.

There is usually no explicit write operation on the KEY file, usually by writing a KEY, reloading the KEY, and so on.

d. asymmetric KEY file

The asymmetric KEY file is different from the PIN file and the symmetric KEY file. On the one hand, it is an important file related to card security in the card, and saves the asymmetric KEY information related to DF security. On the other hand, it can also be used as an application in the card. The file, the specific use is defined by the application.

Asymmetric KEY files generally only exist in COS and applications that support the PKI system. In each file, only a pair of asymmetric KEY information is stored, including the public key and the private key. It is usually stored in a transparent binary file format, and the contents of the file body are interpreted by COS.

The selection process of the asymmetric KEY file is specified in the execution process of the command related to the asymmetric, and the information of the related asymmetric key pair can be obtained by selecting the file.

In this KEY file, the private key information needs to be kept strictly confidential, and the public key information can be made public. Therefore, the read operation of the file should be controlled hierarchically. Generally, the reading of the private key can be set to prohibit or require some protection. The reading of the public key can be set without security conditions or loose.

There is no explicit write operation to an asymmetric KEY file, usually by writing a KEY command.

e. Apply a custom interpretation file

In addition to the special file types explained by these systems, the application can also customize some special file types. The data meaning of these special files is customized and self-explanatory by the application. COS just treats it as transparent binary, fixed length record, and indefinite length. Record, ring record and other file types to operate.

We often come into contact with two special files in the development of application support related to finance, one is the electronic wallet file, and the other is the electronic passbook file. If the COS wants to support financial applications, the definition of these two special files is generally included in the COS. The operation of these two types of files is completely done by applying commands.

This Sakura Umbrella is the symbol of cute and fashion. And it's convenient for carrying and could be carried wherever the user goes. This is available and perfect for the rainy and windy weather. Our Sakura Umbrellas aren't just great to help block the sun and provide the guests with needed shade but also offer a beautiful and fun way to dress up in any Wedding Reception, Birthday Party, Baby Shower or any Special Event space.


Hyades Umbrella is counted among the significant names, offering a wide range of excellent sakura umbrella design. Our Sakura umbrella is in great demand due to its unique features like perfect finish, captivating design, smooth finish and strong structure. Our umbrella is made using quality material and modern techniques at our production headquarters. Moreover, clients can easily avail this umbrella in variety of specifications

Sakura Umbrella

Sakura Umbrella,Pvc Sakura Umbrella,New Sakura Umbrella,Creative New Sakura Umbrella

Hyades Umbrella Co., Ltd. , https://www.hyadesumbrella.com

Posted on