Method for managing security for card-type storage medium, and a card-type storage medium and a transaction apparatus therefor

Abstract: An apparatus and method for managing security of an IC card such as a cashless payment card, an ID card, a medical health management card, a local government service card, etc., in each transaction with an object to improve a level of the security. The method comprises the steps of generating a unique identifier for a transaction in said card-type storage medium (11) when the transaction is started between said card-type storage medium (11) and a transaction apparatus (21) accessing to said card-type storage medium to execute the transaction therewith and the data file that is an object of an access of said transaction apparatus (21), notifying said unique identifier to said transaction apparatus (21); giving said unique identifier to an access command of said transaction apparatus (21) to said card-type storage medium (11) until an end of said transaction; and comparing said unique identifier given to the access command from said transaction apparatus (21) with another unique identifier generated for said transaction in said card-type storage medium (11), and performing a process according to the access command from said transaction apparatus (21) if these unique identifiers are in agreement.

Description: BACKGROUND OF THE INVENTION 1) Field of the Invention The present invention is applicable to a card-type storage medium such as an IC card used as a cashless payment card, an ID card, a medical health management card, a local government service card, etc. More specifically, the present invention relates to a method for managing and strengthening security at the time of file access to such card-type storage medium, and a card-type storage medium and a transaction apparatus therefore realizing said method. As represented by forgery of prepayment cards such as telephone cards, crimes of forgery of cards and fabrication of data in cards tend to increase in recent years. Therefore, there is a requirement on a more sophisticated and more complex security function to a system using such card therein. Particularly, the card-type storage medium such as an IC card, which will spread more widely in the future, keeps therein data more than hundred times those kept in a magnetic card. To prevent leak of information, or forgery or fabrication of the information, consideration on the security of the system using such card-type storage medium is very important. 2) Description of the Related Art As shown in FIGS. 5 and 6, an IC card (a card-type storage medium) 100 has, in general, a microprocessor unit (MPU) 101 and a storage (file area, for example, an EPROM or an EEPROM) 102, and is connected to a transaction apparatus (an external apparatus) not shown via a terminal unit 103. The storage 102 has a data area in which data files are kept and a directory area in which control information (pointers, etc.) for the data files in the data area. The MPU 101 manages the data files in the data area in the storage 102 on the basis of the control information in the directory area. For instance, when receiving an access command from the external transaction apparatus via the terminal unit 103, the MPU 101 performs a reading process (a read access), a writing process (a write access), an erasing process (an erase access), a rewriting process (a rewrite access) or the like, on the storage 102 in response to the access command. The MPU 101 has a RAM 101B used as a work area upon a control operation along with a ROM 101A keeping a program for the control operation therein. In the case of the IC card 100 of an ISO type, the terminal unit 103 is provided with eight contacts (VCC, RST, CLS, RFU, GND, VPP, I/O and RFU). In such the IC card 100, the storage 102 keeps data more than 100 times those kept in a magnetic card. To prevent leakage, forgery and fabrication of the data kept in the storage, there are generally set an access capability (a capability for access) and an access right corresponding to the access capability to carry out a security check. For instance, the storage 102 in the IC card 100 keeps in advance an access capability and an access right as fundamental information for security. The access capability is to verify a capability of a person such as a card issuer, a card holder, an application provider, a service executor, a service provider and the like, who issues a command to the IC card 100. The access right (read right, write right, etc.) is set correspondingly to the above-mentioned access capability for each file kept in the storage 102, which defines an access process that a person having an access capability for each data file can perform. As shown in FIG. 7, when a data file stored in the storage 102 of the IC card 100 is accessed from the external transaction apparatus (an application A) 110, a select command is issued to select and determine a data file that is an object of the access among the data files stored in the storage 102 in the IC card 100, a verify command is then issued to authenticate an access capability to get an access to that data file. This authentication process is performed on the basis of an authentication code sent from the transaction apparatus 110. After that, when receiving an access command (read record or write record) from the transaction apparatus 110, the IC card 100 verifies whether the access command is of an access type (read, write or the like) which has been permitted beforehand as an access right corresponding to the authenticated access capability. The security check with the access capability and the access right as stated above will be next described in more detail referring to FIG. 8. Assuming that "OK", "OK", "NG" and "NG" are set to a service provider, a card issuer, a service executor and a card holder, respectively, as a read right (an access right) for a data file stored in a storage 102 of an IC card, as shown in FIG. 8. In other words, the service provider and the card issuer can perform a reading process on that data file. Under such circumstances where the read right is set, if an application operable with an access capability of the service provider issues a read command (READ) as shown in FIG. 8, the IC card permits the read access to a data file since "OK" is set to the access right in terms of READ of the service provider for that data file in the IC card 100. On the other hand, when an application operable with an access capability of the service executor issues a read command, the IC card 100 rejects the read access to a data file since "NG" is set to the access right in terms of READ of the service executor for that data file in the IC card 100. As stated above, the security at the time of access to a data file stored in a conventional IC card (a card-type storage medium) is ensured with two points, that is, the access capability and the access right. However, if information about a relation between the access capability and the access right leaks outside, an unrightful application can easily access to data files in an IC card. For this, there is a requirement to improve a security function upon accessing files in the IC card in order to prevent an access from an unrightful application if the information about the relation between the access capability and the access right leaks outside, or if another person unrightfully obtains the information about the access capability and the access right. In a typical IC card system, a transaction is done between the IC card and the application in one-by-one correspondence. With an increase of more diversified, sophisticated needs of the users, there appears a system operable in a mode where a plurality of applications can simultaneously use the same one IC card. In such system, the security function attached to the present IC card is insufficient. Such the system requires a security function which can manage applications in an IC card, where simultaneous accesses from a plurality of applications should be taken into consideration. As described by reference to FIG. 7, in the conventional command process based on an assumption that each command is issued from the same application (the application A in FIG. 7), a security check is made with only the access capability and the access right. It is therefore impossible to specify an application that has issued the command. In a system in which a plurality of applications are simultaneously accessible to the same one IC card, if, after an application has issued a select command and a verify command to select and determine a data file that is an object of the access and has authenticated the access capacity, a different application B issues an access command to that data file, the IC card 100 accepts the access command from the application B since the IC card 100 mistakenly takes that access command is taken as an access command issued from the same application in the conventional command process. As a result, the application B can get an unrightful access to that data file. Problems on the security function of the conventional IC card are summarized as follows : (a) If an unrightful application gets unrightfully security information (an access capability, an access right), the present security function allows an unrightful access to a data file : (b) In a system in which a plurality of applications are simultaneously accessible to the same one IC card, if, after a data file that is an object of an access has been determined, a different application tries to get an access to that data file, the system allows that unrightful access. Document US-5068894 discloses a method of generating a unique number for a smart card and its use for the cooperation of the card with a host system. US-4786790 discloses a data exchange system with authentication code cooperation. EP-330404 discloses an integrated circuit card which includes an internal data memory and a central processing unit and incorporates at a surface of the card an auxiliary memory having a larger storage capacity than that of the internal memory. Access to information in the auxiliary memory, by an external card acceptance device, is only possible using address data stored in the internal memory of the card, and supplied to that external card acceptance device under the control of the card's central processing unit, thereby affording a high degree of security. SUMMARY OF THE INVENTION An object of this invention is to provide a method for managing security for a card-type storage medium, and a card-type storage medium and a transaction apparatus therefor, in which security management in each transaction is realized to improve a level of the security at the time of a file access, and it is possible to specify an application issuing a command so as to prevent accesses to the same one data file from different applications. This invention provides a method for managing security of a card-type storage medium having a storage unit keeping a data file therein comprising the steps of generating a unique identifier for a transaction in said card-type storage medium when the transaction is started between said card-type storage medium and a transaction apparatus accessing to said card-type storage medium to execute the transaction therewith and the data file that is an object of an access of said transaction apparatus, notifying said unique identifier to said transaction apparatus, giving said unique identifier to an access command of said transaction apparatus to said card-type storage medium until an end of said transaction, and comparing said unique identifier given to the access command from said transaction apparatus with the unique identifier generated for said transaction in said card-type storage medium, and performing a process according to the access command from said transaction apparatus if these unique identifiers are in agreement. In a card-type storage medium according to this invention comprising a storage unit having a data area keeping a data file therein and a directory area keeping control information about the data file in said data area therein and a control unit managing the data file in said data area in said storage unit on the basis of the control information in said directory area in said storage unit, in which said control unit comprises a unique identifier generating means for generating a unique identifier for a transaction when the transaction is started with an external apparatus and the data file that is an object of an access from said external apparatus is determined, a unique identifier notifying means for notifying the unique identifier generated by said unique identifier generating unit to said external apparatus, a first comparing means for comparing a unique identifier given to an access command from said external apparatus with the unique identifier generated by said unique identifier generating means for said transaction, and a first judging means judging that the access command from said external apparatus is for said transaction if these unique identifiers are found to be in agreement as a result of comparison by said first comparing means and performing a process according to the access command from said external apparatus. This invention also.provide a transaction apparatus for a card-type storage medium, which accesses to said card-type storage medium having a storage unit keeping a data file therein to execute a transaction therewith comprising a notifying means notifying an access command given a unique identifier thereto until an end of a transaction, when the data file that is an object of the access is determined in said card-type storage medium and said transaction apparatus is informed of said unique identifier for said transaction from said card-type storage medium. In a method for managing security of a card-type storage medium, a card-type storage medium and a transaction apparatus therefor according to this invention, a unique identifier for a transaction is any time given to an access command issued from a transaction apparatus during said transaction, thereby specifying a transaction apparatus accessing to said card-type storage medium by referring to said unique identifier so as to prevent, with certainty, an access from different applications to the same data file and improve largely a level of the security. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a block diagram showing an aspect of this invention; FIG. 2 is a block diagram of a card-type storage medium and a transaction apparatus according to one embodiment of this invention; FIG. 3 is a flowchart showing operations of the card-type storage medium and the transaction apparatus according to one embodiment of this invention; FIG. 4 is an illustration showing signal sequences between the card-type storage medium and the transaction apparatus according to one embodiment of the invention in order to illustrate more concretely the operations of the card-type storage medium and the transaction apparatus; FIG. 5 is a plan view showing an appearance of a typical IC card; FIG. 6 is a block diagram showing a hardwear structure of a typical IC card; . FIG. 7 is an illustration for illustrating a file access procedure to a conventional IC card; FIG. 8 is an illustration for illustrating a concept of security when a file in a conventional IC card is accessed; and FIG. 9 is an illustration showing an unrightful access that may occur when a file in a conventional IC card is accessed. DESCRIPTION OF THE PREFERRED EMBODIMENT (a) Description of Aspects of the Invention FIG. 1 is a block diagram showing an aspect of this invention. A card-type storage medium 11 shown in FIG. 1 has a storage unit 12 and a control unit 13. The storage unit 12 includes a data area in which data files are kept and a directory area in which control information for the data files in the data area is kept. The control unit 13 manages the data files in the data area in the storage unit 12 on the basis of the control information kept in the directory area in the storage unit 12. Reference numeral 21 denotes a transaction apparatus which accesses to the card-type storage medium 11 to do a transaction therewith. According to this invention, the control unit 13 of the card-type storage medium 11 is provided with a unique identifier generating means 14, a unique identifier notifying means 15, a first comparing means 16 and a first judging means 17. The unique identifier generating means 14 generates an unique identifier for a transaction when the transaction is started with the transaction apparatus (an external apparatus) and a data file that is an object of an access from the transaction apparatus 21 is determined. The unique identifier notifying means 15 notifies the unique identifier generated by the unique identifier generating means 14 to the transaction apparatus 21. The first comparing means 16 compares a unique identifier given to an access command issued by the transaction apparatus 21 with the unique identifier. generated for this transaction by the unique identifier generating means 14. The first judging means 17 judges that the access command fed from the transaction apparatus 21 is for this transaction if these unique identifiers are found to be in agreement by the first comparing means 16, and performs a process according to the access command from the transaction apparatus. On the other hand, the transaction apparatus 21 has a notifying means 22. When a data file that is an object of an access is determined in the card-type storage medium 11 and a unique identifier for a transaction is informed from the card-type storage medium 11, the notifying means 22 notifies an access command given a unique identifier thereto to the card-type storage medium 11 until the end of the transaction. The control unit 13 of the card-type storage medium 11 may also have an enciphering means enciphering a unique identifier generated for a transaction by the unique identifier generating means 14 with the first encipherment key. The unique identifier notifying means 15 may then notify a ciphertext unique identifier obtained by enciphering the unique identifier by the enciphering means to the transaction apparatus 21. In this case, the transaction apparatus 21 has a deciphering means deciphering the ciphertext unique identifier with the first encipherment key. The unique identifier notifying means 15 may notify a plaintext unique identifier before the encipherment along with the ciphertext unique identifier obtained by enciphering the unique identifier by the enciphering means to the transaction apparatus. In this case, the transaction apparatus 21 has a comparing means which compares a deciphered unique identifier obtained in decipherment by the deciphering means with the plaintext unique identifier supplied from the card-type storage medium 11, and a judging means which judges that the card-type storage medium 11 is rightful if the unique identifiers are found to be in agreement with each other as a result of comparison by the comparing means and proceeds the access process on the card-type storage medium. The transaction apparatus 21 may further has an enciphering means which enciphers a unique identifier fed from the card-type storage medium 11 with a second encipherment key. The notifying means 22 may give a ciphertext unique identifier obtained by enciphering the unique identifier in the enciphering means to an access command, and notifies it to the card-type storage medium 11. In this case, the control unit 13 of the card-type storage medium 11 has a deciphering means deciphering the ciphertext unique identifier with the second encipherment key. The first comparing means 16 compares a deciphered text unique identifier obtained by deciphering the ciphertext unique identifier with a unique identifier generated for this transaction by the unique identifier generating means. The notifying means 22 in the transaction apparatus 21 may notify a plaintext unique identifier along with the ciphertext unique identifier obtained by enciphering the unique identifier by the enciphering means to the card-type storage medium 11. In this case, the control unit 13 of the card-type storage medium 11 further has a second comparing means which compares a deciphered text unique identifier obtained in decipherment by the deciphering means with the plaintext unique identifier supplied from the external apparatus, and a second judging means which judges that an access command supplied from the transaction apparatus 21 is rightful if these unique identifiers are found to be in agreement with each other as a result of comparison by the second comparing means, and proceeds the process. The control unit 13 of the card-type storage medium 11 may further has an error notifying means which notifies an error as a response to an access command from the transaction apparatus 21 if the unique identifiers are found to be in disagreement as a result of comparison by the first comparing means 15 or the second comparing means. In the above-mentioned card-type storage medium 11 and transaction apparatus 21 according to this invention shown in FIG. 1, when a transaction is started between the card-type storage medium 11 and the transaction apparatus 21 and a data file that is an object of an access from the transaction apparatus 21 is determined, the unique identifier generating means 14 of the card-type storage medium 11 generates a unique identifier for this transaction, and the unique identifier notifying means 15 notifies the unique identifier to the transaction apparatus 21. The notifying means 22 in the transaction apparatus 21 having informed of that unique identifier notifies an access command in a state where that unique identifier is given thereto to the card-type storage medium until the end of the transaction. On the side of the card-type storage medium 11, the first comparing means 16 compares the unique identifier given to the access command fed from the transaction apparatus with an unique identifier generated for this transaction. The first judging means 17 judges that the access command from the transaction apparatus 21 is for this transaction if these unique identifiers are found to be in agreement with each other as a result of comparison by the first comparing means 16, and performs a process according to the access command fed from the transaction apparatus 21. The unique identifier generated when the data file is determined can be known to only the transaction apparatus having performed the data file determining process. In addition, the unique identifier is given to the access command fed from the transaction apparatus 21 any time during one transaction. Accordingly, it is possible to specify the transaction apparatus 21 having accessed to the card-type storage medium 11 by referring to that unique identifier. The unique identifier is first enciphered with the first encipherment key, the unique identifier notifying means 15 then notifies the ciphertext unique identifier to the transaction apparatus 21. On the side of the transaction apparatus 21, the ciphertext unique identifier fed from the card-type storage medium 11 is deciphered with the first encipherment key. This manner is effective to prevent the unique identifier from leaking as it is while the unique identifier is being informed from the card-type storage medium 11 to the transaction apparatus 21. In addition, it is possible to inhibit an access to the card-type storage medium 11 from another apparatus excepting the transaction apparatus that has the first encipherment key identical to that of the card-type storage medium 11 until the end of the transaction. The card-type storage medium 11 notifies a plaintext unique identifier before the encipherment along with a ciphertext unique identifier enciphered . with the first encipherment key to the transaction apparatus 21. The transaction apparatus 21 deciphers the ciphertext unique identifier fed from the card-type storage medium 11, and compares a deciphered unique identified obtained by deciphering the ciphertext unique identifier with the plaintext unique identifier to judge whether the card-type storage medium 11 having informed the transaction apparatus of the unique identifier is rightful or not. Only if these unique identifiers are in agreement with each other, the transaction apparatus 21 is allowed to proceed an access process on the card-type storage medium 11. On the side of the transaction apparatus 21, the unique identifier fed from the card-type storage medium 11 is enciphered with the second encipherment key, then a ciphertext unique identifier obtained by enciphering the unique identifier is given to an access command issued from the transaction apparatus 21 to the card-type storage medium 11. On the side of the card-type storage medium 11, the ciphertext unique identifier fed from the transaction apparatus 21 is deciphered with the second encipherment key, and the deciphered text unique identifier obtained by deciphering the ciphertext unique identifier is compared with a unique identifier generated for this transaction. This manner is effective to prevent the unique identifier from leaking as it is while the unique identifier is being notified from the transaction apparatus 21 to the card-type storage medium 11, and to inhibit an access to the card-type storage medium 11 from another apparatus excepting the transaction apparatus 21 that has the second encipherment key identical to that of the card-type storage medium 11. Next, the transaction apparatus 21 notifies a plaintext unique identifier before the encipherment along with the ciphertext unique identifier having been enciphered with the second encipherment key to the card-type storage medium 11. The card-type storage medium 11 deciphers the ciphertext unique identifier with the second encipherment key, and compares a deciphered text unique identifier obtained in decipherment with the plaintext unique identifier fed from the transaction apparatus 21 to judge whether an access command fed from the transaction apparatus 21 having informed of the unique identifier from the card-type storage medium 11 is rightful or not. Only if these unique identifiers are in agreement with each other; the transaction apparatus 21 is permitted to proceed the access process on the card-type storage medium 11. At that time, if these unique identifiers are found to be in disagreement as a result of comparison made in the card-type storage medium 11, an error is notified as a response to the access command from the transaction apparatus 21. Accordingly, the transaction apparatus 21 that has accessed to the card-type storage medium 11 may be informed of occurrence of error so as to display an error or perform another process similar to that. According to the above-mentioned card-type storage medium 11 and the transaction apparatus 21 according to this invention shown in FIG. 1 a unique identifier is given to an access command issued from the transaction apparatus 21 every time in each transaction. By referring to the identifier, it is possible to specify the transaction apparatus 21 that has accessed to the card-type storage medium 11, and to prevent accesses from different applications to one data file with certainty. This may largely improve the level of the security. In this occasion, by enciphering the unique identifier with the first encipherment key, then notifying the ciphertext unique identifier to the transaction apparatus 21, it is possible to prevent the unique identifier from leaking as it is. It is also possible to inhibit an access to the card-type storage medium 11 from another apparatus excepting the transaction apparatus 21 that has the first encipherment key, thereby further improving the security function. By notifying the plaintext unique identifier along with the ciphertext unique identifier enciphered with the first encipherment key to the transaction apparatus 21 from the card-type storage medium, and, in the transaction apparatus 21, comparing a plaintext unique identifier obtained in decipherment with the plaintext unique identifier fed from the card-type storage medium 11, it is possible to judge whether the card-type storage medium 11 having notified the unique identifier to the transaction apparatus 21 is rightful or not, thereby further improving the security function. Further, the transaction apparatus 21 gives the unique identifier enciphered with the second encipherment key to an access command and notifies it to the card-type storage medium 11, it is possible to prevent the unique identifier from leaking as it is, and to inhibit an access to the card-type storage medium 11 from another apparatus excepting the transaction apparatus that has the second encipherment key, thereby further improving the security function. Moreover, the transaction apparatus 21 notifies the plaintext unique identifier before the encipherment along with the ciphertext unique identifier enciphered with the second encipherment key to the card-type storage medium 11. The card-type storage medium 11 then compares a plaintext unique identifier obtained any decipherment with the plaintext unique identifier fed from the transaction apparatus to judge whether an access command from the transaction apparatus 21 is rightful or not, thereby further improving the security function. At that time, if these unique identifiers are found to be in disagreement as a result of the comparison in the card-type storage medium 11, an error is notified to the transaction apparatus 21. The transaction apparatus 21 having accessed to the card-type storage medium 11 may display an error or perform another process similar to that so as to immediately deal with the error. FIG. 2 is a block diagram of a card-type. storage medium and a transaction apparatus according to this invention. In FIG. 2, reference numeral 60 denotes an IC card (a card-type storage medium). The IC card 60 has a microprocessor unit (MPU) 61 as a control unit and a storage (a file area; an EPROM or an EEPROM, for example) 62 as a storage unit. The IC card 60 is connected to a transaction apparatus 80, which has been hereinbefore described by reference to FIGS. 5 and 6, via the terminal unit (not shown in FIG. 2). The storage 62 includes a data area in which a plurality of data files 62C are kept and a directory area 62B in which control information about each of the data files 62C in the data area 62A is kept. The MPU 61 manages each of the data files 62C in the data area 62A in the storage 62 on the basis of the control information in the directory area 62B. The MPU 61 has a function to perform a process according to an access command when receiving the access command from an external apparatus. The MPU 61 has a ROM 63 keeping a program therein to carry out a control operation and a RAM 64 used as a work area when the control operation is carried out. The MPU 62 also has another functional elements as shown in FIG. 2, that is, a node ID generating unit (a unique identifier generating means) 65, an enciphering unit 66, a node ID notifying unit (a unique identifier notifying means) 67, a deciphering unit 68, a first comparing unit 69, a first judging unit 70, a second comparing unit 71, a second judging unit 72 and an error notifying unit 73. When a transaction is started between the IC card 60 and a transaction apparatus (an external apparatus) 80, which will be described later, and a file that is an object of an access from the transaction apparatus is determined, the node ID generating unit 65 generates a node ID (a node identifier; a unique identifier) for this transaction. There is no specific rule to generate the node ID by the node ID generating unit 65. It is, for example, possible to use a function generating pseudo-random numbers or the like (that is, a function generating numbers dynamically and randomly) and use the generated pseudo-random numbers or the like as a node ID. The enciphering unit 66 enciphers the node ID generated for the transaction by the node ID generating unit 65 with a first encipherment key using an encipherment function. Hereinafter, a ciphertext will be described as E (a plaintext) and a deciphered text will be described as D (a plaintext), occasionally. Here, "E" is the first letter of a term "encipher" that means enciphering, and "D" is the first letter of a term of "decipher" that means deciphering. The node ID notifying unit 67 notifies, to the transaction apparatus 80, a ciphertext node ID obtained in encipherment by the enciphering unit 66 as response information when the file is determined along with a plaintext node ID before the encipherment. More specifically, the node ID being notified to the transaction apparatus 80 from the IC card 60 is in a form of "(a plaintext) + E (a plaintext)" in this embodiment. When informed of a file access command in which a node ID in a form of "(a plaintext) + E (a plaintext)" is given as a parameter from the transaction apparatus 80, the deciphering unit 68 deciphers a ciphertext node ID [E (a plaintext)] with a second encipherment key using an encipherment function to obtain a deciphered text D (a plaintext) of the node ID. The second encipherment key and the encipherment function used in the deciphering unit 68 are identical to a second encipherment key and an encipherment function used to encipher in an enciphering unit 84 in the transaction apparatus 80 if the IC card 60 or the transaction 80, which will be described in detail later, are rightful. The second comparing unit 71 compares the deciphered text node ID [D (a plaintext) obtained in decipherment by the deciphering unit 68 with the plaintext node ID supplied from the transaction apparatus 80. The second judging unit 72 judges that the access command issued from the transaction apparatus 80 is rightful if the deciphered text ID is in agreement with the plaintext node ID as a result of the comparison by the second comparing unit 71. If the second judging unit 72 judges that the access command issued from the transaction apparatus 80 is rightful, the procedure proceeds to the next step conducted in the first comparing unit 69. The first comparing unit 69 compares the node ID (either the plaintext node ID or the deciphered text node ID) given to the access command fed from the transaction apparatus 80 with a node ID generated by the node ID generating unit 65 for this transaction. The first judging unit 70 judges that the access command fed from the transaction apparatus 80 is for this transaction if these node IDs are in agreement with each other as a result of comparison by the first comparing unit 69. If the first judging unit 70 judges that the access command fed from the transaction apparatus 80 is for this transaction, the IC card 60 performs a process according to the access command fed from the transaction apparatus 80. If the node IDs are in disagreement as a result of the comparison by the first comparing unit 69 or the second comparing unit 71, in other words, the first judging unit 70 judges that the access command from the transaction apparatus 80 is not for this transaction, or if the second judging unit 72 judges that the access command fed from the transaction apparatus 80 is unrightful, the error notifying unit 73 notifies an error (an error response) as a response to the access command from the transaction apparatus 80. Meanwhile, the transaction apparatus 80 according to this embodiment accesses to the IC card 60 to execute a transaction therewith. The transaction apparatus 80 is provided with a deciphering unit 81, a comparing unit 82, a judging unit 83, a ciphering unit 84 and a notifying unit 85. When informed of a node ID in the form of "(a plaintext) + E (a plaintext)" from the IC card 60 when a transaction with the IC card 60 is started, the deciphering unit 81 deciphers the ciphertext node ID [E (a plaintext)] with a first encipherment key using an encipherment function to obtain a deciphered text D (a plaintext) of the node ID. The first encipherment key and the encipherment function used in the deciphering unit 81 are identical to the first encipherment key and the encipherment function used in encipherment by the ciphering unit 66 in the IC card 60 if this transaction apparatus 80 or the above-mentioned IC card 60 is rightful. The comparing unit 82 compares the deciphered text node ID [D (a plaintext)] obtained in decipherment by the deciphering unit 81 with a plaintext node ID supplied from the IC card 60. If the deciphered text node ID is in agreement with the plaintext node ID as a result of the comparison by the comparing unit 82, the judging unit 83 judges that the IC card 60 is rightful to this transaction apparatus 80. If the judging unit 83 judges that the IC card 60 is rightful, the procedure proceeds to the next step conducted in the enciphering unit 84. The enciphering unit 84 enciphers the node ID (either a plaintext node ID or the enciphers text node ID) fed from the IC card 60 with the second encipherment key using the encipherment function. The second encipherment key and the encipherment function used in the enciphering unit 84 are identical to the second encipherment key and the encipherment function used to decipherment in the deciphering unit 68 in the IC card 60 if this transaction apparatus 80 or the above-mentioned IC card 60 is rightful. The notifying unit 85 notifies an access command in which a node ID in the form of "(a plaintext) + E (a plaintext)" is given as a parameter to the IC card 60 until this transaction with the IC card 60 ends up. The ciphertext node ID [E (a plaintext)] given to the access command by the notifying unit 85 is what has been ciphered by the ciphering unit 84. An operation at the time of file access in the process of the IC card 60 and the transaction apparatus 80 with the above structures according to this embodiment will be next described by reference to a flowchart (Step S21 through S30) shown in FIG. 3. When the IC card 60 is inserted to the transaction apparatus 80 (a reader/writer), the transaction apparatus notifies a file open direction and the like to the IC card 60 to make a security check as, for example, described in the first embodiment. If a result of the security check is OK, the transaction apparatus 80 notifies a file determining command to the IC card 60 so that the IC card 60 performs a file determining process (Step S21). If a file that is an object of an access is determined in compliance to a request from the transaction apparatus 80 to determine the file of the IC card 60, the node ID generating unit 65 in the IC card 60 generates a node ID for this transaction (Step S22). The node ID generated by the node ID generating unit 65 is retained in the storage 62 in the IC card 60 until the hardware is reset when the IC card 60 is inserted into the transaction apparatus or the like next time. The node ID at the preceding time is erased from the storage 32 so that the node ID may become unique for each transaction. The node ID generated by the node ID generating unit 65 is notified to the transaction apparatus 80 from the node ID notifying unit 67. At this time, it is possible to notify the node ID in a form of a plaintext or in a form of a ciphertext obtained by ciphering the node ID. It is further possible to notify the node ID in the form of "(a plaintext) + (a ciphertext)" [(a plaintext) + E (a plaintext)] where both of the plaintext node ID and the ciphertext node ID are notified. Referring now to FIG. 3, or FIG. 4 showing an practical example which will be described later, description will be made of a case where the node ID in the form of "(a plaintext) + E (a plaintext), that is, in the last form at the highest-security level, is exchanged between the IC card 60 and the transaction apparatus 80. According to the second embodiment, as shown in FIG. 3, anode ID generated by the node ID generating unit 65 is enciphered with a first encipherment key using an encipherment function in the enciphering unit 66 (Step S23). The node ID notifying unit 67 then notifies a ciphertext node ID [E (a plaintext)] obtained in the enciphering unit 66 and a plaintext node ID before the encipherment to the transaction apparatus 80. In the transaction apparatus 80 that has been informed of the node ID, the deciphering unit 81 first deciphers the ciphertext node ID [E (a plaintext)] with a first encipherment key using an encipherment function (Step S24). The comparing unit 82 then compares and collates a deciphered text node ID [D (a plaintext)] obtained in the deciphering unit 81 with the plaintext node ID informed from the IC card 60 (Step S25). If the deciphered text node ID and the plaintext node ID are in agreement with each other as a result of the comparison, the judging unit 83 judges that the IC card 60 is rightful to the transaction apparatus 80, and the procedure proceeds to the next process. If the deciphered text node ID and the plaintext node ID are in disagreement, the judging unit 83 judges that data were altered when the IC card 60 notified the node ID to the transaction apparatus 80, or this IC card 60 is not an object of an application of the transaction apparatus 80 since the encipherment key and the encipherment function in the IC card 60 differ from those in the transaction apparatus 80. As a result, the judging unit 83 interrupts the transaction, then discharges the IC card 60. If the deciphered text node ID coincides with the plaintext node ID, after that, the node ID is enciphered with a second encipherment key using an encipherment function in the enciphering unit 84 when the transaction apparatus 80 issues a file access command to the IC card 60 (Step S26). The notifying unit 85 notifies the ciphertext node ID [E (a plaintext)] obtained by the enciphering unit 84 and the plaintext node ID before the encipherment in a state where they are given as a parameter to the file access command to the IC card 60. In the IC card 60 informed of the node ID in the form of "(a plaintext) + E (plaintext)" as the parameter for the file access command, the deciphering unit 68 deciphers the ciphertext node ID [E (a plaintext)] with a second encipherment key using an encipherment function (Step S27). The second comparing unit 71 compares and collates the deciphered text node ID [D (a plaintext)] obtained in the deciphering unit 68 with the plaintext node ID informed from the transaction apparatus 80 (Step S28). If the deciphered text node ID is in agreement with the plaintext node ID as a result of the comparison, the second judging unit 72 judges that the access command from the transaction apparatus 80 is rightful. The first comparing unit 69 then compares and collates the node ID (the deciphered node ID or the plaintext node ID) with a node ID generated by the node ID generating unit 65 for this transaction and kept in the storage 62 (Step S29). If these node IDs are in agreement with each other as a result of the comparison, the first judging unit 70 judges that the file access command from the transaction apparatus 80 is for this transaction, in other words, the application (the transaction apparatus 80) having issued the file access command is identical to the application having performed the file determining process, defines the application to perform an actual file access process (Step S30), and notifies that result as a response to the transaction apparatus 80. It is considered that if the node ID designated by the parameter of the file access command is identical to the node ID kept in the IC card 60, the node ID generated in the IC card 60 is known to the application. It is therefore possible to judge that the application trying to get an access to the file is rightful since that node ID can be known to only the application that has performed the file determining process. If the node IDs are in disagreement as a result of the comparison at the Step S28 (by the second comparing unit 71), the second judging unit 72 judges that any alteration was done on the data when the node ID was notified to the transaction apparatus 80 from the IC card 60, or the IC card 60 is not an object of the application of the transaction apparatus 80 since the encipherment key and the encipherment function in the IC card 60 differ from those in the transaction apparatus 80. The error notifying unit 73 then notifies an error as a response to the access command. If the node IDs are in disagreement as a result of the comparison at the Step S29 (by the first comparing unit 69), the first judging unit 70 judges that the transaction apparatus 80 (the application) having issued the access command has not performed the file determining process. The error notifying unit 73 then notifies an error as a response to the access command. As above, the error is informed to the transaction apparatus (the upper apparatus) as a response. The transaction apparatus 80 having tried an access to the IC card 60 interrupts the transaction. After that, the transaction apparatus 80 displays the error, discharges the IC card, etc., or performs a process similar to that so as to immediately deal with that error. More concrete example will be next described referring to FIG. 4. This example is on the supposition that in a medical institution an application A for writing diagnostic information and another application B for settling a result of the diagnosis try to get accesses simultaneously to the same IC card 60. Namely, a plurality of applications can get accesses simultaneously to the same IC card 60 in this system. Here, the diagnostic information writing application A A accesses to a diagnostic information file F A and a medical treatment fee settling application A B accesses to a money sum information file F B . The IC card 60 must accept commands from a plurality of applications, so it is necessary for the IC card 60 to accept an access from only an application having performed a determining process on a file that is an object of the access. When the IC card 60 according to this embodiment receives a file determining command for the diagnostic information file F A from the diagnostic information. writing application A A [refer to (1) in FIG. 4, the IC card 60 generates a node ID = "01" for the command, as stated above. This node ID is not specifically limited to "01" since it is generated randomly. The IC card 60 notifies this node ID to the application A A . The node ID = "01" is an ID that can be known to only the application A A . If the IC card 60 enciphers the node ID with a cipher key A common to that of the application A A [refer to (2) in FIG. 13), and notifies the node ID in the form of "a plaintext + E A (node ID = "01")" [refer to (3) in FIG. 4, only the application can decipher that node ID, whereby the security may be more strengthened. More specifically, the application A A having been informed of the node ID in the form of "a plaintext + E A (node ID = "01")" from the IC card 60 judges whether the deciphered node ID [D A (node ID = "01")] obtained by deciphering the ciphertext node ID [E A (node ID = "01")] is in agreement with the plaintext node ID or not [refer to (4) in FIG. 4]. If the node IDs are in agreement as a result of the judgement, after that, the IC card 60 accepts an access command from the application A A by designating this node ID = "01" since the access to the file F A is identical to that of the application having performed the file determination. The application A B may become accessible to the file F B by performing the same process on the file F B [refer to (1) through (5) in FIG. 4. In the process between the application A B and the file F B , there is used, for example, "02" generated randomly as the node ID. In the above manner, the management of the applications with the node IDs makes it possible to manage accesses to the same application from a plurality of applications. For instance, if the diagnostic information application A A tries to get an access unrightfully to the money sum information file F B , the application A A cannot access to the file F B since the node ID notified to the application F B is unknown to the application A A . Accordingly, it is possible to prevent the money sum information or the like in the money sum information file F B from being operated unrightfully. According to the second embodiment of this invention, the node ID is generated dynamically in the IC card 60 and notified to the application (the transaction apparatus 80) so as to realize a unique node ID for each transaction. Further, the node ID is enciphered and the encipherment key is held commonly in the IC card 60 and the upper apparatus (the transaction apparatus 80) so as to prevent data tapping when the node ID is notified. This node ID is what can be known to only the rightful application, so only the rightful application may encipher or decipher this node ID. An unrightful application cannot encipher or decipher this node ID since it is impossible for the unrightful application to get information about the encipherment key and the like. The management of the applications issuing commands in the above manner makes it possible to specify an application accessing to the IC card 60 so as to strengthen the security. Even in a system in which a plurality of applications operate in parallel, while an application is accessing to a certain file in the IC card to do a transaction therewith, it is possible, with certainty, to prevent an unrightful different application from accessing to that file in the same IC card to do an unfair act thereon. If occurrence of an error is found in the above various checks, the transaction apparatus 80 is informed of an error as a response. The transaction apparatus 80 having accessed to the IC card 60 may display an error or other process similar to that so as to immediately deal with the error. Employment of the IC card 60 and the transaction apparatus 80 above-mentioned according to this embodiment to a system including a terminal apparatus incorporated a reader/writer for IC card therein, a terminal apparatus connected to an independent reader/writer for IC card or an upper apparatus having such terminal may improve the security of the entire system. This embodiment is helpful to ensure sufficient security of a system in which a plurality of applications may access to one IC card 60, and to cope with various needs of the users that may occur in the future. According to this embodiment, it is possible to enhance the security to a sophisticated level as compared with the convention security system. In the case of an access from a sole application, it is, of course, possible to ensure sufficient security and contribute to an improvement of the security of a system (a cash card, a credit card, etc.) that requires a high-level security. In the second embodiment described above, the node ID in the form of "(a plaintext) + E (a plaintext)" is exchanged between the IC card 60 and the transaction apparatus 80. It is, however, possible to notify a node ID in the form of a plaintext or a node ID in the form of a ciphertext [only E (a plaintext)]. If a node ID in the form of a plaintext is notified, the enciphering unit 66, deciphering unit 68, the second comparing unit 71, the second judging unit 72, the deciphering unit 81, the comparing unit 82, the judging unit 83 and the enciphering unit 84 shown in FIG. 11 become unnecessary. Further, the Steps S23, S24, S25, S26, S27 and S28 are omitted in FIG. 3. If a node ID in the form of a ciphertext [only E (a plaintext)] is notified, the second comparing unit 71, the second judging unit 72, the comparing unit 82 and the judging unit 83 in FIG. 2 become unnecessary. Further, the Steps S25 and S28 in FIG. 3 are omitted. In the case where the transaction apparatus 80 gives the ciphertext node ID having been informed from the IC card 60 to the access command as it is, the deciphering unit 81 and the enciphering unit 84 in FIG. 2 become unnecessary. Further, the Steps S24 and S26 in FIG. 3 are omitted. In which case, the deciphering unit 68 in the IC card 60 deciphers the ciphertext node ID with the first encipherment key using the encipherment function. In the second embodiment described above, the first encipherment key may be identical to the second encipherment key. The first comparing unit 70 in the IC card 60 may compare and collate the node ID with the node ID kept in the IC card 60 by enciphering the node ID in the IC card 60 with the second encipherment key. The second embodiment may be carried out after the security checks on the basis of the security basic information and the security additional information according to the first embodiment and file determination. In which case, it is possible to more enhance the security function of the IC card. As having been described the first and second embodiments where the card-type storage medium is an IC card, this invention should not be limited to the above example. If this invention is applied to a card-type storage medium of another type, for example, an optical card, the same functions and effects as the above embodiments are available.

Claims: A method for managing security of a card-type storage medium (11) having a storage unit (12) keeping a data file therein comprising the steps of: generating a unique identifier for a transaction in said card-type storage medium (11) when the transaction is started between said card-type storage medium (11) and a transaction apparatus (21) accessing to said card-type storage medium to execute the transaction therewith and the data file that is an object of an access of said transaction apparatus (21), notifying said unique identifier to said transaction apparatus (21); giving said unique identifier to an access command of said transaction apparatus (21) to said card-type storage medium (11) until an end of said transaction; and comparing said unique identifier given to the access command from said transaction apparatus (21) with the unique identifier generated for said transaction in said card-type storage medium (11), and performing a process according to the access command from said transaction apparatus (21) if these unique identifiers are in agreement. A method for managing security of a card-type storage medium according to claim 1, wherein the unique identifier generated for said transaction is enciphered with a first encipherment key in said card-type storage medium (11), a first ciphertext of said unique identifier is notified to said transaction apparatus (21), and the first ciphertext of said unique identifier from said card-type storage medium (11), is deciphered with said first encipherment key in said transaction apparatus (21). A method for managing security of a card-type storage medium according to claim 2, wherein a plaintext of the unique identifier before the encipherment is notified along with said first ciphertext of said unique identifier obtained by encipherment with said first encipherment key to said transaction apparatus (21) from said card-type storage medium (11), said first ciphertext of said unique identifier from said card-type storage medium (11) is deciphered with said first encipherment key in said transaction apparatus (21), a deciphered text of the unique identifier obtained by decipherment is compared with the plaintext unique identifier from said card-type storage medium (11), and an access process on said card-type storage medium (11) is proceeded if these unique identifiers are in agreement. A method for managing security of a card-type storage medium according to any one of claims 2 or 3, wherein the unique identifier from said card-type storage medium (11) is enciphered with a second encipherment key, thus producing a second ciphertext unique identifier which is then given to the access command from said transaction apparatus (21) to said card-type storage medium (11), and which is deciphered with said second encipherment key, the deciphered text unique identifier thus obtained being compared with the unique identifier generated for said transaction. A method for managing security of a card-type storage medium according to claim 4, wherein a plaintext unique identifier before the encipherment is notified along with the second ciphertext unique identifier obtained by the encipherment with the second encipherment key to said card-type storage medium (11) from said transaction apparatus (21), the second ciphertext unique identifier from said card-type storage medium (11) is deciphered with said second encipherment key in said card-type storage medium (11), thus producing a deciphered text unique identifier, which is compared with the plaintext unique identifier from said transaction apparatus (21), and if these unique identifiers are in agreement a process is proceeded. A method for managing security of a card-type storage medium according to any one of claims 1 to 5, wherein if the unique identifiers are found to be in disagreement as a result of the comparison in said card-type storage medium (11), an error is notified as a response to the access command from said transaction apparatus (21). A card-type storage medium comprising a storage unit (12) having a data area keeping a data file therein and a directory area keeping control information about the data file in said data area therein and a control unit (13) managing the data file in said data area in said storage unit (12) on the basis of the control information in said directory area in said storage unit (12), characterized in that : said control unit (13) further comprises : a unique identifier generating means (14) for generating a unique identifier for a transaction when the transaction is started with an external apparatus (21) and the data file that is an object of an access from said external apparatus (21) is determined; a unique identifier notifying means (15) for notifying the unique identifier generated by said unique identifier generating means (14) to said external apparatus (21); a first comparing means (16) for comparing a unique identifier given to an access command from said external apparatus (21) with the unique identifier generated by said unique identifier generating means (14) for said transaction; and a first judging means (17) for judging that the access command from said external apparatus (21) is for said transaction if these unique identifiers are found to be in agreement as a result of comparison by said first comparing means (16) and performing a process according to the access command from said external apparatus (21). A card-type storage medium according to claim 7, wherein said control unit (13) further comprises an enciphering means for enciphering the unique identifier generated for said transaction by said unique identifier generating means (14) with a first encipherment key, and said unique identifier notifying means (15) is arranged to notify a ciphertext unique identifier obtained in encipherment by said enciphering means to said external apparatus (21). A card-type storage medium according to claim 8, wherein said unique identifier notifying means (15) is arranged to notify the ciphertext unique identifier obtained in encipherment by said enciphering means along with a plaintext of the unique identifier before the encipherment to said external apparatus (21). A card-type storage medium according to any one of claims 7 to 9, wherein said control unit (13) further comprises a deciphering means for deciphering a ciphertext unique identifier with a second encipherment key if said ciphertext unique identifier obtained by encipherment with said second encipherment key is given to the access command from said external apparatus (21), said first comparing means (16) being for comparing a deciphered text unique identifier obtained in decipherment by said deciphering means with the unique identifier generated for said transaction by said unique identifier generating means (14). A card-type storage medium according to claim 10, wherein said control unit (13) further comprises: a second comparing means for comparing the deciphered text unique identifier obtained in decipherment by said deciphering means with the plaintext unique identifier from said external apparatus (21) if the plaintext unique identifier is given to the access command from said external apparatus (21) along with the ciphertext unique identifier obtained by encipherment with said second encipherment key; and a second judging means for judging that the access command from said external apparatus (21) is rightful if these unique identifiers are found to be in agreement as a result of comparison by said second comparing means. A card-type storage medium according to claim 11, wherein said control unit (13) still further comprises an error notifying means for notifying an error as a response to the access command from said external apparatus (21) if the unique identifiers are found to be in disagreement as a result of comparison by said second comparing means. A card-type storage medium according to any one of claims 7 to 12, wherein said control unit (13) still further comprises an error notifying means for notifying an error as a response to the access command from said external apparatus (21) if the unique identifiers are found to be in disagreement as a result of comparison by said first comparing means (16). A transaction apparatus for a card-type storage medium (11), which is arranged to said card-type storage medium having a storage unit (12) keeping a data file therein to execute a transaction therewith characterized in that it comprises: a notifying means (22) for notifying to said card-type storage medium (11) an access command given a unique identifier thereto until an end of a transaction, when the data file that is an object of the access in said card-type storage medium (11) is determined in said card-type storage medium (11) and said transaction apparatus is informed of said unique identifier for said transaction from said card-type storage medium (11). A transaction apparatus for a card-type storage medium according to claim 14 further comprising: a deciphering means for deciphering a ciphertext of the unique identifier with a first encipherment key if the unique identifier from said card-type storage medium (11) is enciphered with said first encipherment key. A transaction apparatus for a card-type storage medium according to claim 15, still further comprising: a comparing means for comparing a deciphered text of the unique identifier obtained in decipherment by said deciphering means with a plaintext unique identifier from said card-type storage medium (11) if the plaintext unique identifier before the encipherment is notified from said card-type storage medium (11) along with said ciphertext unique identifier; and a judging means for judging that said card-type storage medium (11) is rightful if these unique identifiers are in agreement as a result of comparison by said comparing means and proceeding an access process on said card-type storage medium (11). A transaction apparatus for a card-type storage medium according to any one of claims 14 to 16 still further comprising an enciphering means for enciphering the unique identifier from said card-type storage medium (11) with a second encipherment key, and wherein said notifying means (22) is arranged to give a ciphertext of the unique identifier obtained in encipherment by said enciphering means to the access command and to notify it to said card-type storage medium (11). A transaction apparatus for a card-type storage medium according to claim 17 wherein said notifying means (22) is arranged to notify the plaintext unique identifier before the encipherment along with the ciphertext unique identifier obtained in encipherment by said enciphering means to said card-type storage medium (11).

Inventors: TANAKA HIROSHI, TANAKA, HIROSHI, Tanaka, Hiroshi, Fujitsu Limited
Applicants: FUJITSU LTD, FUJITSU LIMITED
Application year: 1995
Main classification: G06K19
IPC codes: G07F7