IC card technology lecture 4 IC card programming and use

The difference between an IC card and other cards is mainly that the IC card can store a large amount of useful information safely and reliably in the memory on the card, and can provide multiple levels of security and confidentiality measures for the data. Therefore, in order to design a good IC card application system, it is necessary to Understand the data structure characteristics of the IC card. Master the programming and reading and writing methods of the IC card.
From the point of view of use, whether it is a normal memory card, a logical encryption card, or a smart CPU card, the card must have: a publisher code for distinguishing it from other applications, for distinguishing it from other users in the system. Personal code, used to control the erasure password for data modification on the card, and the storage area for storing data. Since the IC card is not connected to the power supply, it is necessary to ensure that the data stored on the card is not lost. The read memory is a ROM type memory. Therefore, the data on the card can be stored for a long time, and the general data can be stored for 100 years. Since the data on the IC card is frequently modified in use, it is generally necessary to use an electrically erasable programmable read only memory, that is, EEPROM. General IC card data rewriting times greater than 100000 times.
The current IC cards used in various IC card application systems are mainly logical encryption cards. This card has multi-level password protection, which is much more secure than ordinary memory cards. At the same time, it is simpler than the smart CPU card structure. The complicated password calculation process is simple in structure and convenient to program. In this lecture, the AT88SC1604 logical encryption card of American ATMEL Company is taken as an example to illustrate the programming method of IC card issuing software and user application software in the IC card application system. And IC card writing process.
1. Data Structure and Programming Features of Logic Memory Card The AT88SC1604 card has a common area and four application data areas. The data structure is shown in the attached table. There are vendor codes, publisher codes, total passwords, password counters, etc. in the public area. Etc. We can plan and use these data areas to control the basic characteristics of the full card. There are four application areas. The first partition has its own partition password, erasure password, password counter and read/write control bits. The data is written, read and modified for control. The rest of the application area is the storage unit for storing data. The first partition storage capacity of the 1604 card is 9K bits, and the other three partitions have a storage capacity of 2K bits. Together with the common area total The storage capacity is 16K bits.
The manufacturer code, also known as the manufacturer code, is written by the IC card manufacturer when the card is shipped from the factory. Generally, the same code is provided for a batch of cards provided by a certain publisher to distinguish it from other manufacturers' cards. The protection fuse 1 is blown. At this time, the IC card developer can read the manufacturer code and judge the manufacturer, but cannot modify it.
Publisher code: used for personalization of the IC card. It is written by the system software when issuing the card. It is used to indicate which application system the card belongs to. For example, the publisher code written by the IC card issued by the ICBC indicates that it belongs. Financial system. When this card is used, the ATM will automatically verify this code. If it is not correct, it means that this is not the card of this system, it can't be used. The publisher code is controlled by fuse 2, before the fuse, the password can be modified, melted and melted. After the silk. This password can be read, can be verified, but can not be modified.
The fuse on the IC card is the IC card personalization mark. In addition to controlling the issuer code, it also controls the reading and writing of data on the entire card. Before the fuse is blown, the data read and write on the card is controlled by the total password SC and the read/write control bit. The password of each partition does not work. At this time, the initial data can be planned and written by the IC card reader. After the fuse is blown, the card is sent to the user. At this time, the data operation of each partition is controlled not only by the total password SC. And subject to partition passwords and erasure passwords and controls.
The total password SC is generally used as the user password and should be set by the user and written to the card through the user environment provided in the IC card distribution software. Once the password is written, it cannot be read or retained in the system, and can only be checked. When the user uses the IC card in the future, it may be checked by the user through the password verification function interface provided by the application. The password is entered correctly, indicating that it is a legitimate user, and the data on the card can be read and written. When the password is input incorrectly The password counter SCAC is decremented by 1. In addition, before the fuse is blown, the total password also controls the reading and writing of each partition password.
The password counter SCAC is used to count the number of user password checks. When the correct password is entered, the counter is cleared (that is, the 8-bit is fully set to -1-). Each time the error is entered, the counter becomes 0-, and if the input is incorrect eight times, When the counters all become 0-, the card is invalid.
Erase password control erases the written data in the memory. Since the EEPROM can only write to the blank area when writing data (ie, each is -1-), the memory area where the data has been written can only be explored first. Write later. Each time you want to erase a line of information. The erase password is written when the card is issued, controlled by the application system, can only be verified, can not be read to prevent illegal destruction of the existing data on the card.
Each partition has its own partition password, in order to achieve a multi-purpose card. Partition password and partition erase password control the reading, writing and wiping operations of the data in this area. For example, use a 1604 card and work permit, medical certificate, salary card and dining card. When using this card in different occasions, the reader will verify each partition password separately, and only operate the data in this area without affecting other partitions.
Storage Partition Address Address Digits Byte Address Bytes FZ Factory Code Area 0-15 16 0-1 2 IZ Publisher Code 16-79 64 2-9 8 SC Total Password 80-95 16 10-11 2 SCAC Total Password Error counter 96-103 8 12 1 CPZ code protection zone 104-167 64 13-20 8 SC1 One-zone password 168-183 16 21-22 2 S1AC One-zone password error counter 184-191 8 23 1 EZ1 one-zone erasure password 192-207 16 24-25 2 E1AC One-area erasure password error counter 208-215 8 26 1 AZ1 Application area one 216-9775 9650 27-1221 1195 SC2 Two-zone password 9776-9791 16 1222-1223 2 EZ2 two-zone wipe In addition to the password 9792-9807 16 1224-1225 2 E2AC two-zone erasure password error counter 9808-9815 8 1226 1 AZ2 application area two 9816-11863 2048 1227-1482 256 SC3 three-zone password 11864-11879 16 1483-1484 2 EZ3 three Area Erase Password 11880-11895 16 1485-1486 2 E3AC Three Area Erase Password Error Counter 11896-11903 8 1487 1 AZ3 Application Area 3 11904-13951 2048 1488-1743 256 SC4 Four Area Code 13952-13967 16 1744-1745 2 EZ4 four-zone erasure password 13968-13983 16 1746-1747 2 E4AC Erase the wrong password counter 13984-13991 8 1748 1 AZ4 application districts and four 13992-16039 16040-16055 20481749-2004 256 testing with zone 162005-20062 Total 160,562,007


II. IC card programming and usage process The reading and writing operation of the IC card is mainly at the time of card issuance and when the user pays the card and the card is consumed. The card is the personalization process of the card issuer according to the user's request for the blank card. The process is executed by the card issuing program running on the microcomputer of the card issuing unit, such as bank, factory, agency, etc. This card issuing program also needs IC card developers to develop and design according to the above-mentioned structural characteristics. The user holds the card in the store POS machine. Or on the bank ATM machine, the card payment also needs to be carried out at the bank or payment. This process is the process of reading or modifying the data on the card, which is completed by the IC card user application on the user terminal. Interactive processing with the terminal. This user application is also designed by the IC card developer. Below, the IC card storage structure features discussed in the previous section are combined to illustrate the operation process in the two softwares.
1. IC card personalization operation flow As mentioned above, this process is embedded in the IC card issuance software, which can complete the personalization of the IC card, that is, the initial data entry process. Firstly, the system checks the IC card manufacturer code and card type. When correct, write the publisher code on the blank card to make sure the card is a valid card for the system. The software should then provide an interactive user interface that allows the user to enter their own user password (SC) from the keyboard. This password should not be issued by the user. It is reserved and processed, but should be directly written to the card by calling the password writing function. The partition password in the multi-partition can also be directly input by the user through the interface provided to the user. In order to simplify the password memory requirement, it can also be adopted according to the unified The user password is generated by a certain algorithm to generate the partition password and written on the card. The erasing password is generated by the publisher, that is, the system, and entered into the card during personalization, for use by the system. After the above password is written, The software should also provide the user with the opportunity to verify and re-edit the password. After the confirmation is correct, the software issues a blow command, blows the fuse 2, and completes the personalization process of the IC card. Then the system can request the IC card data area. As the initial write data.
2. IC card user application software flow As mentioned above, this process is embedded in the user software of each IC card reading and writing terminal. This process is executed each time the IC card is operated. Once the IC card is inserted into the reader, the user software First, check the manufacturer code and publisher code to confirm the legality of the card. After confirming that it is a valid card in the system, enter the user password verification process. If it is an invalid card, it should alarm. Then in the user password check interface. The cardholder's legality is authenticated. The cardholder is required to enter the user's password and check the password on the card. After the error is correct, the card can be read and written. If there is a partition password, the user is required to type and verify. If the data is modified, it should be checked against the surviving password retained in the system. When correct, the data on the card can be read out for modification, the corresponding storage area is erased, and the modified data is written back to the storage area. We know the legitimacy of the IC card, the cardholder legality and the legality of the system must be mutually confirmed. These confirmations and read and write operations to the IC card need to call the functions in the function library provided by the IC card reader. carry out.
The function used in IC card application programming is as described above: The main point of developing an IC card application system is to properly embed and call the IC card operation function in a database management software to perform such things as legality verification and IC card reading. Out, erase and write operations. To do this, we need to understand the IC stop function library provided by the reader driver package. These functions can be divided into two categories: in the WINDOWS application environment, a Group dynamic link library functions (.DLL files) are used for various program calls. In the DOS environment, the respective function libraries are provided for different languages. At this time, only a part of the functions used in FOXPROFOR DOS are explained. See the corresponding manual.
Execute the command before the FOXPRO program is executed: .SET LIBRARY TO MWIC.LIB
FOXPRO will automatically log in to the IC card function in -MWIC.LIB-. Later, you can use the interface function in the program as you use the FOXPRO internal function. When compiling the user program as an .EXE file, you must also -MWIC .LIB-chaining can be performed.
The interface functions in MWIC.LIB can be divided into two categories:
General function: basic operation for various card types.
1.MW-INITCOM() initializes the serial communication port.
2.MW-SETTYPE() Set the card type.
3.MW-READ() Read the data on the card.
4.MW-WRITE() writes data to the card.
5.MW-ERASE() erases the specified area.
AT88SC1604 card-specific function: only for this type of card, because the structure and location of the password in different card types are different.
1.MW-PASS16() Check total password and erasure password
2.MW-CPASS16() Change the total password and erase password
3.MW-RDECU16() read error count value
4.MW-FUSE16() blown fuse

Rattan Wrapped Glassware

bar glassware,cocktail glassware,cocktail glassware,cocktail glassware,household glassware,ribbed glassware,glassware for kitchen,commercial bar glassware,custom glassware,tumbler glassware,coloured glassware

Rattan Wrapped Glassware,Rattan Wrapped Drinking Glasses,Home Decor Rattan Wrapped Glass Vase,Weave Sleeve Glass Vase

Shaanxi Freeway Export and Import Co.,LTD. , https://www.fw-deco.com

Posted on