Smart card operating system research and case analysis

A smart card is a smart IC card, also known as a CPU card or a microprocessor card or a smart card. The smart card chip has a microcomputer hardware and software configuration, such as: CPU, RAM, ROM, EEPROM, COS operating system, and also has an encryption device for information security protection, a random number generator, and a physical attack self-destruct circuit.

The physical resources in the smart card chip are managed and scheduled by the chip operating system (COS) stored in the ROM. We can design the application rules and specifications of the card according to the specific application requirements, establish a card security system, and operate through the chip. The system implements the specific application functions of the smart card. Therefore, the smart card has a flexible and open application design platform.

1 Smart Card Operating System (COS) Brief

The full name of COS is Card Operation System (in-chip operating system), which is generally developed around the characteristics of the smart card it serves, so it is inevitably affected by the performance and memory capacity of the microprocessor chip in the smart card. influences. First, COS is a dedicated system rather than a general purpose system. That is: a COS can only be applied to a specific (or some) smart card, and the COS in different cards is generally different. Second, compared to the operating systems on the common microcomputers, COS is essentially closer to the monitor, rather than a so-called true operating system.

In general, the smart card chip operating system includes four major functions: card and external communication management; information storage file management; information security management; command interpretation execution management.

In the specific implementation steps of the smart card application, the most important step is to define the file architecture of the data storage. Once the file architecture is defined, both user data and smart card management data can be extremely protected by a package such as a file. At the same time, the file system is one of the most flexible aspects of COS system design. Therefore, the design of the file system is the focus of the COS system design, both in terms of the workload of the system design and the complexity of the design. Below we will focus on the file system design in COS on an example.

2 smart card file system

A file is an organized collection of records in a data unit or card. COS implements its storage and management of individual applications by creating a corresponding file for each application. Therefore, the COS application files store various data or records related to the application. In addition, the COS of some smart cards may also contain application control files that control the application files.

COS files can be classified into Class A DAEs according to their logical hierarchy as shown in Figure 1: Master File, Dedicated File, and Elementer File. Among them, the main file is indispensable for any COS. It is the only file containing file control information and allocable storage area. Its function is equivalent to the root file of the COS file system, which is at the highest level of the COS file system. The basic file is also an essential part. It is the file that actually stores the data unit or record of the standby application, at the bottom of the file system. The special file is optional, and it stores mainly the control information of the file, the location and size of the file, and the like.

For a file, its storage allocation is often the most important. The physical organization of a file involves how a file is placed on a storage device. It is closely related to the access method of the file, and also depends on the physical characteristics of the storage device. Logically, all files must be contiguous for easy addressing, which requires the files to exist in chains. For the COS system of the IC card, the file chain should include three parts of content: MF's entry location; retrieval between DF and subfiles; and retrieval between files of the same level.

There are many ways to achieve the above functions. However, in general, considering the storage allocation of files generally considers the following three questions: When creating a file, whether to allocate the maximum space required for the file at one time; the space for allocating files is the size of the unit; file partition Form of the table (FAT).

Currently commonly used file allocation methods include continuous allocation, link allocation, and index allocation (often, different operating systems often use one of them).

3 Smart Card File System Instance

According to the specific application, the file system of COS is designed according to the application environment to meet the application requirements of the project itself. The COS chip used in the system supports a 32-byte page write mode, so in the file system, the space unit for allocating files is 32 bytes to facilitate file reading and writing.

3.1 EEPROM spatial organization structure division

A: Allocate 64 bytes of space.
B: The file address mapping table is 2k~64 bytes.
C: The data area is 30k.

3.2 DISKHEAD structure information

The DISKHEAD part has a total of 64 bytes. It is the first two pages of the EEPROM's first part (32 bytes per page). It records the basic usage of the EEPROM. Some of the reserved bytes are reserved for later expansion. The area information records the file information of the root file file using 39 bytes, and the root file information is placed in the DISKHEAD part mainly for expansion considerations, as shown in FIG.

3.3 file address mapping table

The file address mapping table is used to store address information of various parts of the file. A total of (2k~64) bytes are used to address the 30k byte EEPROM of the data area. The specific method is shown in Figure 3. It is explained as follows: Before each file is written into the EEPROM, for example, the number A written in the data area, first in the data area of ​​the page A, two bytes in the file address mapping table. The flag byte is written to FF, and then the data is written. After the data is written, if the file is not finished, search for free space (find the item in the file allocation table as 00, get the address information through the address mapping), and then write the address information to the file on the previous page in the file. The location of the address map.

3.4 data area

The data area stores the specific data of each file, and the concept of the file is extended to a data aggregate including a directory file. The distinction between files is performed by a file identifier (FID), and the connection between different files is a chain structure as shown in FIG. 2. The storage locations of the various parts in the file are searched by the file address mapping table to form a chain structure, and when the file ends, the file address mapping table is marked with FF to indicate the end of the file, as shown in FIG.

The file provides two APDU commands by writing the file header information when it is first created and updating the file data later. The format is as follows:

The specific application first uses CREATE FILE to create a file, and then use UPDATE FILE to add data. At the same time, according to the needs of the file system, also provide SELECT FILE, READ FILE, DELETE FILE and other commands.

4 Conclusion

Compared to a non-intelligent IC card, there is only one simple memory logic circuit on the chip. It can be seen that the smart card has a natural advantage in terms of reliability and security. The design of the smart card operating system COS is basically developed in strict accordance with the relevant specifications such as ISO7816, but the design of its file system is a more flexible aspect. According to the characteristics of the system, this paper designs a file system scheme of smart card. From the practical point of view, it is quite successful, but there are still some defects. For example, the file search algorithm can be further improved, and the partition table can be further streamlined. At the same time, the content of the COS system is quite extensive. This article only does some research work on the COS system, especially its file system through a specific example. The deeper and more extensive content needs further research in the future.

(Text / Department of Electronics and Communication Engineering, Changsha University, School of Electrical and Information Engineering, Hunan University, Zhang Zhigang, Zhao Kui)

Kick out the rolls to the required position or equipment.

We have supplied machines for well known brands from industries of water & beverage, logistics, chemical, construction material and paper, etc. The machines can be customized.
Up till now, we have developed many new systems like Palletizer, strapper, paper corner applicator and Carton Sealer, etc. We are already ready to serve you with our best.


Paper Roll Kicker,Conveyor Machine Kicker,Paper Roll Conveyor Kicker

Shandong Sinolion Machinery Corp. Ltd ,