Mutual authentication system

Abstract: When mutual authentication is effected between an IC card (1) and a host device (8), key data and random number data transmitted from the host device (8) are immediately subjected to the encrypting process without storing the same into a RAM of a CPU (15) in the IC card (1), and only authentication data obtained as the result of the encrypting process is stored. As a result, the memory area in the RAM can be saved and effectively used.

Description: This invention relates to a method and a system for effecting mutual authentication between a portable type electronic device such as an IC card having an IC (integrated circuit) chip enclosed therein and a host device or terminal device. In order to effect the mutual authentication between the IC card and host device, first authentication data and first key data stored in the IC card are transferred to the host device and stored therein, second authentication data and second key data stored in the host device are transferred to the IC card and stored therein, and the second and first authentication data are encrypted by use of second and first key data, and supplied back to the host device and the IC card, respectively, for authentication. As described before, in the mutual authentication system with the above construction, memory areas for holding four different types of data, that is, first authentication data and first key data to be transferred to the host device and second authentication data and second key data transferred from the host device must be provided in, for example, a RAM of a CPU in the IC card. Likewise, memory areas for holding four different types of data must be provided in a CPU in the host device. EP-A-0 320 489 discloses a method and a system of a mutual authentication of an IC card and a host device in which a random code number is generated within a circuit of the IC card, said random number is transmitted to the host device, the host device encrypting said random number and transmitting the encrypted data to the IC card. Within the IC card, the transmitted encrypted number is stored in a memory cell where it cannot be accessed from outside. This stored value is used as a starting number of the circuitry which generates the random number. Thereby, said starting number is protected from forgery since it can be accessed only by the circuitry of the IC card. For authentication purposes said stored number is used as a starting number for producing a random number, and this random number is transmitted to the host device. Certain operations are made within the IC card as well as within the host device, such operations being identical. The results of said operations are compared, and if there is obtained coincidence, authentication has been obtained. EP-A-0 216 298 discloses an identification system in which authentication is obtained by using an encrypted peculiar data stored in an IC card for a decryption process within an IC card terminal. The decrypted data obtained in the terminal are compared with the peculiar data stored in the IC card. Authenticity is confirmed if there is coincidence between the peculiar data of the card and the decrypted data from the terminal. An object of this invention is to provide a mutual authentication method and system which is so constructed that an amount of data to be held can be reduced and a memory area can be effectively used to hold other data. According to this invention, the above object can be attained by a mutual authentication method and system as defined in claims 1, 7 and 11. This invention can be more fully understood from the following detailed description when taken in conjunction with the accompanying drawings, in which: Fig. 1 is a block diagram showing one embodiment of a mutual authentication system according to this invention; Fig. 2 is a function block diagram of an IC card shown in Fig. 1; Fig. 3 is a block diagram showing the internal construction of the IC card shown in Fig. 1; Fig. 4 is a diagram schematically showing memory areas of a data memory in the IC card; Figs. 5A to 5E are diagrams showing the formats of various commands input to the IC card; Figs. 6 to 10 are flowcharts for explaining the operation of the mutual authentication system of the above embodiment; and Fig. 11 is a schematic diagram of the mutual authentication system according to the present invention. There will now be described an embodiment of this invention with reference to the accompanying drawings. Fig. 1 shows an example of the construction of a terminal device 8 (one of two electronic devices) used as a host device for dealing with an IC card (the other of the two electronic devices) used as a portable type electronic device according to this invention. That is, the terminal device 8 permits an IC card 1 to be connected to a CPU 3 functioning as a control section via a card reader/writer 2 and is constructed by connecting a keyboard 4, CRT display unit 5, printer 6 and floppy disk drive unit 7 to the CPU 3. The IC card 1 is held by a user and is used to verify an identification number which is known only to the user and store necessary data at the time of transaction such as purchase of articles. As is clearly seen from the function block thereof shown in Fig. 2, it is constructed by sections for effecting basic functions including a read/write section 11, identification number (ID) setting/verifying section 12 and encrypting/decrypting section 13 and a supervisor 14 for controlling the basic functions. The read/write section 11 has a function of reading data from, writing data into or erasing data from a data memory 16 to be described later. The ID number setting/verifying section 12 has a function of permitting an ID number set by the user to be stored and preventing the same from being read out and verifying the ID number after the ID number is set so as to permit the succeeding process to be effected. The encrypting/decrypting section 13 encrypts data for preventing leakage and forgery of the communication data when data is transmitted from the CPU 3 to another terminal device via a communication network, for example, and decrypts the encrypted data. The supervisor 14 decodes a function code input from the card reader/ writer 2 or a function code with data and selects and effects necessary functions among the basic functions. In order to effect the above various functions, the IC card 1 is constituted by a CPU 15 used as a control element, data memory 16, program memory 17 and contact section 18 for electrical connection with the card reader/writer 2 as shown in Fig. 3 and those (CPU 15, data memory 16, program memory 17) of the elements which lie inside an area defined by broken lines are formed on one IC chip (or a plurality of IC chips) and buried inside the main body of the IC card 1. The CPU 15 includes an internal memory, RAM. The program memory 17 is constituted by a mask ROM for storing a control program of the CPU 15 having a subroutine for effecting the above basic functions, for example. The data memory 16 is used to store various data and is constituted by an erasable nonvolatile memory such as an EEPROM. As shown in Fig. 4, for example, the data memory 16 is constituted by a common data file (which is hereinafter referred to as a CDF) 16A commonly used for all of the applications and a plurality of application data files (which are hereinafter referred to as ADFs) 16B, 16C, 16D used for respective applications and data file names (DFN) are respectively given to the ADFs 16B, 16C, 16D. In the example of Fig. 4, the CDF 16A contains designation key data (DK) aaa indicated by a key data number KID01 and internal key data (IK) bbb indicated by a key data number KID02, and the ADF 16B indicated by DFN=AAA contains designation key data (DK) ccc indicated by a key data number KID03 and designation key data (DK) ddd indicated by a key data number KID04. Further, the ADF 16C indicated by DFN=BBB contains internal key data (IK) eee indicated by a key data number KID05 and a data area indicated by an area number AID55. Particularly, the data area includes attribute information for permitting access when correct authentication is obtained in the authentication process by use of the internal key data (IK) in the ADF 16C. Further, the ADF 16D indicated by DFN=CCC contains internal key data fff indicated by a key data number KID80, a data area indicated by an area number AID56 and a data area indicated by an area number AID57. Particularly, the data area indicated by the area number AID56 includes attribute information for permitting access when correct authentication is obtained in the authentication process by use of the internal key data (IK) in the CDF 16A, and the data area indicated by the area number AID57 includes attribute information for permitting access when correct authentication is obtained in the authentication process by use of the internal key data (IK) in the CDF 16A or internal key data (IK) in the ADF 16D. The designation key data (DK) is used by the terminal device 8 for authenticating the IC card 1, and the internal key data (IK) is used by the IC card 1 for authenticating the terminal device 8. Next, the operation of the IC card 1 is explained with reference to Figs. 5A to 5E and Figs. 6 to 11. When the IC card 1 receives a command message shown in Fig. 5A from the terminal device 8, it executes a mutual authentication preparation flowchart for the IC card and terminal device shown in Fig. 6 based on a function code 21 contained therein. The process is executed by the CPU 15 according to the program stored in the program memory 17. First, in step ST1, random number data A is generated in the terminal 8 from which data "EXCH (ALG, KID-03, A)" is transmitted to the IC card 1. The data "ALG" represents a number of times of the algorithm executed by the IC card 1. Then, it is determined in the step ST1 by referring to selection ADF fixed information in the internal RAM (RAM in the CPU 15) whether or not the ADFs 16B to 16D have been selected. At this time, if they have not been selected, that is, if "NO" in the step ST1, a key data number (KID) 22 of the input command message is detected from the CDF 16A in the data memory 16 in the step ST2. If they have already selected, that is, if "YES" in the step ST1, the KID 22 is detected in the CDF 16A and the selected ADF in the step ST3. In the step ST3, the random data A is stored in a RAM of the IC card 1. If it is not detected at this time, an error status is output in the step ST4. If the KID is detected, corresponding key data is internally read in the step ST5 and it is checked whether it is correct or not. At this time, if it is not correct, an error status is output. If it is correct, the next step ST6 is effected to store random number information A in the area 23 of the command message and the corresponding key data into a preset area of the internal RAM of the CPU 15. Next, random number information B is generated in the step ST7 according to a preset algorithm based on the random number information A, a number which is inherent to the card and set when the card is issued and card random number information stored as an initial value in the data memory 16, and the random number information B is stored into the data memory 16 as new card random number information in the step ST8. Next, it is determined in the step ST9 whether the ADFs have been selected or not, and if they have not been selected, a KID in the internal key data is detected by the CDF 16A in the next step ST10 and if they have been selected, a KID is detected in the CDF 16A and the selected ADF in the step ST11 (in this case, ADF is treated in preference to CDF). If the KID is not detected, an error status is output in the step ST12 shown in Fig. 7. If it is detected, corresponding key data is internally read in the next step ST13 and whether the key data is correct or not is checked. At this time, if it is not correct, an error status is output. If the key data is correct, the step ST14 is effected to encrypt the previously generated random number information B by using the detected internal data NNNNN as an encryption key, and the result is stored into a preset area of the internal RAM as authentication information C2X. Then, the data = each (ALG, KID-04, B) including the random number information B and KID of the internal key data are transmitted to the terminal 8 in the step ST15 and this flow control is completed. According to the above flow control, key designation information and random information used for mutual authentication between the terminal device 8 and IC card 1 can be commonly used. Next, when a command message of Fig. 5B is received, the flow control shown in Fig. 8 is selected according to the function code 24 thereof and effected. That is, it is first checked in the step ST21 whether the mutual authentication preparation command described before has been executed or not and if it has not been executed, then an error status is output. In step ST22, an encryption of random data B using key data NNNNN is executed in the terminal 8 to obtain an encrypted data C2C which is then transmitted to the IC card 1. If the mutual authentication preparation command has been executed, authentication information C2C 25 in the subsequently input message and authentication information C2X stored in the internal RAM are compared with each other in the step ST22, and if it is detected in the step ST23 that they coincide with each other, a coincidence flag is set to the ON state in the step ST24. If "NO" is obtained in the step ST23, the coincidence flag is set to the OFF state in the step ST25. At this time, an encryption of the random data A is performed using key data MMMMM in the IC card 1 to obtain encryption data C1 which is transmitted to terminal 8. At this time, the ADF-corresponding coincidence flag or CDF-corresponding coincidence flag is set to the ON or OFF state according to whether the internal key data belongs to the ADF or CDF. Next, in the terminal 8, the random information A 23 previously stored in the internal RAM is encrypted by using the designation key data MMMMM as an encryption key in the step ST26 and the result data C1 is output as authentication information C1 together with the result of the previous coincidence flag in the step ST27 and this flow control is completed. In step ST27, the data C1 is compared with the data C1X to see whether they are coincident or not. By this flow control, the mutual authentication of the IC card with the terminal device 8 can be attained. Next, when a command message of Fig. 5C is received, an ADF selection flow of Fig. 9 is selected according to the function code 26 and effected. That is, it is first checked in the step ST31 whether DFN 27 included in the message is registered in the data memory 16 of the IC card 1, and if it is not registered, an error status is output in the step ST32. If it is registered, the ADF-corresponding coincidence flag among the coincidence flags of the C2/C2X is set to the OFF state in the step ST33. Next, fixed information corresponding to the designated DFN is held in the internal RAM in the step ST34 and a correct completion status is output. Next, a read command message of Fig. 5D or write command message of Fig. 5E is received, the flow control of Fig. 10 is selected according to the function code 28 or 29 and effected. That is, it is first checked in the step ST41 whether the ADF has been selected or not, and if it has not been selected, an area identification number (AID) 30 or 31 in the input message is detected from the CDF 16A in the step ST42. If it has been selected, designated AID is detected in the selected ADF and CDF 16A in the step ST43. At this time, if there is no AID detected, an error status is output in the step ST44. If the designated AID is detected, it is checked in the step ST46 whether or not it is necessary to determine the previous coincidence flag by referring to the attribute information stored in the corresponding designated area in the step ST45. If necessary, it is determined whether it is an ADF-corresponding coincidence flag or CDF-corresponding coincidence flag, or it can be either of them. If the ADF-corresponding coincidence flag is necessary or it can be either of them, the ADF-corresponding coincidence flag is referred to in the step ST47 and it is checked whether it is set in the ON state or not. If it is set in the OFF state, an error status is output. If the CDF-corresponding coincidence flag is necessary or it can be either of them, the CDF-corresponding coincidence flag is referred to and it is checked whether it is set in the ON state or not. If it is set in the OFF state, an error status is output. Then, a corresponding read or write process is effected in the step ST48 according to the function code 28 or 29 in the message and the result of the process is output in the step ST49. Next, the operation of the IC card 1 having the construction of the area and key data shown in Fig. 4 is explained. In Fig. 4, the memory areas are arranged as described before, and in this state, key data of KID01 is used as designating key data and key data of KID02 is used as internal key data for mutual authentication in the case where the ADF selection is not effected. In a case where the ADF 16B is selected by DFN=AAA, key data of KID03 or KID04 or key data of KID01 is used as designating key data and key data of KID02 is used as internal key data. Likewise, in a case where the ADF 16C is selected by DFN=BBB, key data of KID01 is used as specifying key data and key data of KID05 is used as internal key data. In order to make access to the area of AID55 in the ADF16C, the attribute of the area is so determined as to necessitate internal key data in the ADF. As a result, the mutual authentication must be effected after the ADF 16C is selected. This is because the internal key data used for the mutual authentication is the key data of KID02 if the ADF 16C is selected after the mutual authentication is effected. Further, for access to the area of AID56 in the ADF16D, the attribute of the area is so determined as to necessitate internal key data in the CDF 16A. As a result, after the mutual authentication is effected, the ADF must be selected and access will be made to the area. The area of AID57 can be accessed in either case where the ADF 16D is selected before or after the mutual authentication is effected. Further, access to the area of AID57 cannot be made in a case where the ADF 16C is first selected and then the ADF 16D is selected after the mutual authentication is effected. As described above, according to the mutual authentication system of this invention, since the encrypting process is effected when two random number data and two key data are prepared according to the first request and only the authentication information obtained as the result of the process is held, the number of data to be held in the process of receiving the second request after the first request has been effected can be reduced, thereby making it possible to effectively use the memory area for other purposes. In particular, this is effective for the IC card having a small RAM area, for example. The IC card 1 used in the above embodiment is a portable type electronic device capable of simulatively generating random number information for mutual authentication even if it has no battery. That is, the IC card used in the above embodiment is a portable type electronic device which includes at least a memory and a control element such as a CPU for accessing the memory and selectively performs the data transfer with respect to the exterior, and comprises inputting means for inputting first random number data, generating means for encrypting the first random number data to generate second data by using first data and second random number information stored in the memory, rewriting means for setting the second data generated by the generating means as new second random number information, and outputting means for outputting the second data generated by the generating means. Therefore, data which can be used as the basis for generation of the random number information is read out from the internal memory and the newly generated random number information is stored in the memory so as to be used as data for generation of the next random number information. Further, designated data stored in the memory is set as a parameter for generation of random number information when the electronic device is issued, for example. As a result, even when the same random number information items are input to the portable type electronic device, different data can be generated in each time and different data can be generated in different portable type electronic devices. Therefore, the data can be used as random number information in the system. Thus, data used as the basis for generation of the random number information is read out from the data memory of the card and newly generated random number information is stored in the data memory so as to be used as data which can be used as the basis for generation of the next random number information. Further, at the time of issuing the card, designated data such as card inherent number stored in the data memory is set as a parameter for generation of random number information. As a result, even when the same random number information items are input to the IC card, different data can be generated in each time and different data can be generated in different IC cards. Therefore, the data can be used as random number information in the system. Thus, the IC card 1 can be used to simulatively generate random number information for mutual authentication even if it has no battery. As described above, it is possible to provide a portable type electronic device which is capable of simulatively generating random number information for mutual authentication even if it has no battery.

Claims: A mutual authentication method for transmitting authentication data between first and second electronic devices (1, 8) for authenticating with each other, said first electronic device (1) having a data memory (16) storing a plurality of key data designating data and a plurality of associated key data and said second electronic device (8) having storing means (3) storing key data designating data and associated key data identical to those in said data memory (16), said method comprising a first step of transmitting first data (A) and first key data designating data (KID-03) to said first electronic device (1) from said second electronic device (8); a second step (ST7) of generating second data (B) in said first electronic device (1) in response to said received first data (A) transmitted in the first step; a third step of transmitting the second data (B) and second key data designating data (KID-04) to said second electronic device (8) from said first electronic device (1); a fourth step (ST14) of generating first authentication data (C2X) by encrypting said second data (B) with the key data (NNNNN) associated with said second key data designating data (KID-04) in said first electronic device (1), and storing said first authentication data (C2X); a fifth step of generating second authentication data (C2C) by encrypting said second data (B) with the key data (NNNNN) designated by said second key data designating data (KID-04) in said second electronic device (8); and a sixth step of comparing said first authentication data (C2X) with said second authentication data (C2C) transmitted from said second electronic device (8) in said first electronic device (1). A mutual authentication method according to claim 1, characterized by further comprising: a seventh step (ST26) of generating in said first electronic device (1) third authentication data (C1) by encrypting said first data (A) with the key data (MMMMM) designated by said first key data designating data; an eighth step of generating in said second electronic device (8) fourth authentication data (C1X) by encrypting said first data (A) with the key data associated with said first key data designating data; a ninth step (ST27) of transmitting to said second electronic device (8) said third authentication data (C1) generated in said first electronic device (1); and a tenth step of comparing in said second electronic device (8) said fourth authentication data (C1) with said third authentication data (C1) transmitted from said first electronic device (1). A mutual authentication method according to claim 1, wherein said first electronic device (1) comprises storing means (16) including divided memory areas (16A to 16D) corresponding to application objects thereof for storing key data corresponding to the divided areas. A mutual authentication method according to claim 3, characterized by further comprising a step of controlling reading and writing operations with respect to the divided areas of said storing means (16) based on a comparison result of said sixth step. A mutual authentication method according to claim 3, characterized in that said storing means (16) stores first key data and second key data into each memory area. A mutual authentication method according to claim 1, characterized in that said first electronic device (1) comprises storing means (16) for previously storing random data, and that said method further comprises a step of encrypting said first data (A) and said random data to generate the second data (B) as new random data in said first electronic device (1). A mutual authentication method for authenticating a first electronic device (1) and a second electronic device (8) by transmitting authentication data between the first and second electronic devices (1, 8) said first electronic device (1) having a data memory (16) storing a plurality of key data designating data and a plurality of associated key data and said second electronic device (8) having storing means (3) storing key data designating data and associated key data identical to those in said data memory (16), said method, comprising: a first step of transmitting first data (B) and first key data designating data (KID-04) from said first electronic device (1) to said second electronic device (8); a second step of generating first authentication data (C2X) according to the first data (B) and first key data (NNNNN) associated with said first key data designating data (KID-04) in said first electronic device; a third step of generating second authentication data (C2C) based on the first data (B) and first key data (NNNNN) designated by the first key data designating data (KID-04) to transmit the second authentication data (C2C) to said first electronic device (1) from said second electronic device (8); and a fourth step of comparing the first authentication data (C2X) with the second authentication data (C2C) transmitted from the second electronic device (8) to the first electronic device (1), wherein the second step is executed prior to the fourth step to hold the first authentication data. A mutual authentication method according to claim 7, characterized in that said first electronic device (1) comprises storing means (16) including divided memory areas (16A to 16D) corresponding to application objects thereof for storing a plurality of key data corresponding to said key data designating data; and said second step comprises a step of obtaining said first key data from one of said divided memory areas (16A to 16D) corresponding to one of said application objects. A mutual authentication method according to claim 7, wherein said first electronic device (1) comprises storing means (16) including a plurality of divided memory areas (16A to 16D) corresponding to application objects to store key data corresponding to the divided memory areas. A mutual authentication method according to claim 9, characterized by further comprising a step of controlling reading and writing operations with respect to the divided memory areas (16A to 16D) of the storing means (16) according to a comparison result of said fourth step. A mutual authentication system for authenticating a first electronic device (1) and a second electronic device (8) by transmitting authentication data between the first and second electronic devices (1, 8), com-prising: a data memory (16) provided in said first electronic device for storing a plurality of key data designating data and a plurality of associated key data a first means (18) provided in said first electronic device (1) for transmitting first data (B) and first key data designating data (KID-04) to said second electronic device (8); a second means (15, 16) provided in said first electronic device (1) for generating first authentication data (C2X) according to the first data (B) and first key data (NNNNN) associated with said first key data designating data, a third means (3) provided in said second electronic device (8) for storing key data designating data and associated key data identical to those in said data memory (16); a fourth means (3) provided in said second electronic device (8) for generating second authentication data (C2C) according to the first data (B) and the key data (NNNNN) designated by first key data designating data (KID-04); a fifth means (15) provided in said first electronic device (1) for comparing the first authentication data (C2X) with the second authentication data (C2C) generated by said fourth means (3); and a holding means (16) provided in said first electronic device (1) for holding the first authentication data (C2X) generated by said second means prior to an execution of said fifth means (15). A mutual authentication system according to claim 11, characterized by further comprising: a sixth means (2) provided in said second electronic device (8) for transmitting second data (A) and the second key data designating data (KID-03) from said second electronic device (8) to the first electronic device (1); a seventh means (3) provided in said second electronic device (8) for generating third authentication data (C1X) according to the second data (A) and the second key data associated with said second key data designating data, an eighth means (15) provided in said first electronic device (1) for generating fourth authentication data (C1) according to the second data (A) and the key data stored in said data memory (16) which is designated by the second key data designating data (KID-03); a ninth means (18) provided in said first electronic device (1) for transmitting the fourth authentication data (C1) to the second electronic device (8); and a comparing means (3) provided in said second electronic device (8) for comparing the third authentication data (C1X) with the fourth authentication data (C1) transmitted from the first electronic device (1). A mutual authentication system according to claim 12, characterized in that said data memory (16) comprises a plurality of divided memory areas (16A to 16D) corresponding to application objects to store key data corresponding to the divided memory areas. A mutual authentication system according to claim 13 characterized by further comprising a means (15), arranged at first electronic device (1), for controlling reading and writing operations with respect to the divided memory areas (16A to 16D) of the storing means (16) according to a comparison result of said fifth means (15). A mutual authentication system according to claim 12, characterized in that said second electronic device (8) comprises storing means (3) for previously storing first random data, and the system further comprises means for generating, in said first electronic device (1), first data based on the first random data. A mutual authentication system according to claim 15, characterized in that said first electronic device (1) further comprises means (15) for encrypting said second data to generate random data as the first data. A mutual authentication system according to claim 16, characterized by further comprising a means for writing the first data generated by the first data generating means (15) into random data storing means (16).

Inventors: IIJIMA YASUO, IIJIMA, YASUO, IIJIMA, YASUO, C/O INTELLECTUAL PROPERTY DIVISION
Applicants: TOSHIBA KK, KABUSHIKI KAISHA TOSHIBA
Application year: 1991
Main classification: G11B5
IPC codes: G06F21, G07F7