Electronic information storage medium, program addition method, and program
The method allows secure elements to efficiently add new functions by using a command and rewriting unit within a secure channel, addressing memory constraints and processing inefficiencies in secure elements.
Patent Information
- Application Number
- JP2020129227
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2020-07-30
- Publication Date
- 2024-10-02
- Estimated Expiration
- 2040-07-30
AI Technical Summary
Existing secure elements with hardware resource constraints face challenges in efficiently adding new functions due to memory limitations and time-consuming business processes associated with patch program updates.
A method involving a command receiving unit, storage unit, and rewriting unit to add a patch program efficiently, allowing a secure element to call a replacement function instead of an empty function, utilizing a secure channel for authentication and minimizing memory usage.
Enables the addition of new functions to application programs with reduced memory requirements and efficient processing, leveraging a secure channel for authentication.
Smart Images

Figure 0007559404000001 
Figure 0007559404000002 
Figure 0007559404000003
Abstract
Description
[Technical field]
[0001] The present invention relates to a technique such as a method for later adding a function to an application program installed in a secure element. [Background technology]
[0002] A secure element mounted on an embedded device is composed of an IC chip and is used for various purposes such as cryptographic calculation and biometric authentication. However, since a secure element has restrictions on hardware resources such as memory size, it is difficult to mount all functions. Therefore, functions according to the intended use (e.g., cryptographic calculation function and biometric authentication function) must be loaded later into the secure element. For example, Patent Document 1 discloses a technique for modifying an application program using a patch program that executes a process of adding a new file or a process of replacing a file to be modified for various reasons such as adding a new function, improving stability, and improving security. [Prior art documents] [Patent documents]
[0003] [Patent Document 1] JP 2016-197326 A Summary of the Invention [Problem to be solved by the invention]
[0004] However, in the technology of Patent Document 1, when applying a patch program to an application program to be modified, time-consuming processes are required, such as identifying the business process of the business to which the application program belongs and updating management information to associate the application program with the business process of the identified business, and a large memory is required to load the patch program. However, since the above-mentioned secure element has limited hardware resources, it is difficult to apply the technology of Patent Document 1 as it is.
[0005] Therefore, the present invention has been made in consideration of the above points, and has an objective of providing an electronic information storage medium, a program addition method, and a program that enable new functions to be added to an application program later in a memory-saving and efficient manner. [Means for solving the problem]
[0006] In order to solve the above problem, the invention described in claim 1 includes a command receiving unit that receives a command from an external device, a storage unit that stores in advance an application program having a first function whose processing content is not defined or whose dummy processing content is defined, the application program being configured so that the first function is called in response to the first command, and a patch program having a second function whose processing content related to a new function is defined, the patch program being added to the application program in response to a second command, and the patch program being written to the storage unit; When the first command is received after the patch program is written to the storage unit, The application program is characterized by comprising a writing unit that rewrites the application program so that the second function is called instead of the first function, and a response sending unit that sends a response to the command to the external device.
[0007] The invention described in claim 2 is characterized in that, in the electronic information storage medium described in claim 1, the second command is received using a secure channel established by successful authentication in an authentication process performed between the electronic information storage medium and an external device.
[0008] The invention described in claim 3 is the electronic information storage medium described in claim 1 or 2, The first function is stored at a first address in the storage unit, and the second function is stored at a second address different from the first address in the storage unit, and the writing unit changes the first address described in the application program to the second address so that the second function is called in place of the first function by the first command. It is characterized by:
[0009] The invention described in claim 4 is A program adding method executed by a computer contained in an electronic information storage medium, comprising:A method for storing an application program in a storage unit, the application program having a first function whose processing content is not defined or whose dummy processing content is defined, the first function being configured to be called in response to a first command; and a method for adding a patch program having a second function whose processing content is defined relating to a new function to the application program in response to a second command, the method including the steps of: When the first command is received after the patch program is written to the storage unit, and rewriting the application program so that the second function is called instead of the first function.
[0010] The invention described in claim 5 includes a step of storing in a storage unit an application program having a first function whose processing content is not defined or whose dummy processing content is defined, the application program being configured so that the first function is called in response to a first command; and a step of adding a patch program having a second function whose processing content relating to a new function is defined in response to a second command, the patch program being added to the application program and written to the storage unit; When the first command is received after the patch program is written to the storage unit, and rewriting the application program so that the second function is called instead of the first function. Effect of the Invention
[0011] According to the present invention, new functions can be added later to an application program efficiently and with less memory usage. [Brief description of the drawings]
[0012] [Figure 1] 1A is a diagram showing an example of a schematic configuration of an SE1, and FIG. 1B is a diagram showing an example of a memory map of an NVM12. [Diagram 2] FIG. 1A is a diagram showing an example of source code for an empty application program, and FIG. 1B is a diagram showing an example of source code for a patch program. [Diagram 3] 11 is a sequence diagram showing an example of the operation of the SE 1 and the external device 2 when a patch program is added to an empty application program. FIG. [Figure 4] 13 is a flowchart showing an example of a process of SE1 after a patch program is added to an empty application program. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, an embodiment of the present invention will be described in detail with reference to the drawings. The embodiment described below is an embodiment in which the present invention is applied to a secure element (hereinafter, referred to as "SE").
[0014] [1. SE1 configuration and functions] First, the configuration and functions of the SE1 according to the present embodiment will be described with reference to FIG. 1. FIG. 1(A) is a diagram showing an example of a schematic configuration of the SE1. The SE1 is an example of an electronic information storage medium of the present invention. As shown in FIG. 1(A), the SE1 is configured to include a CPU (Central Processing Unit) 10, a RAM (Random Access Memory) 11, an NVM (Nonvolatile Memory) 12 (nonvolatile memory), and an I / O circuit 13 (ROM may also be included). The SE1 is used by being mounted on various cards (e.g., credit cards and debit cards) or terminals such as smartphones. The SE1 may be mounted on the terminal as a small, detachable IC card, or may be mounted on an embedded board (i.e., formed integrally with the terminal) as an eUICC (Embedded Universal Integrated Circuit Card) so that it cannot be easily removed or replaced from the terminal.
[0015] The I / O circuit 13 serves as an interface with the external device 2. Examples of the external device 2 include a host (computer) that provides a patch program described later, and a device that uses the functions of the SE1 (for example, a communication partner of the various cards described above and a controller of the terminal described above). Examples of interfaces include SPI (Serial Peripheral Interface), I 2 C (Inter-Integrated Circuit), and ISO7816 interfaces. The communication between the SE1 and the external device 2 may be performed directly, or indirectly via the wireless communication unit of the terminal. In the latter case, the wireless communication unit of the terminal performs protocol conversion. Note that the communication between the SE1 and the host is preferably performed through a secure channel established by executing mutual authentication.
[0016] Furthermore, a command transmitted from the external device 2 is received via the I / O circuit 13. The received command is composed of an APDU (Application Protocol Data Unit) including at least a header (consisting of a CLA (command class), an INS (command code), P1 and P2 (parameters)). Furthermore, in addition to the above-mentioned header, the command may also include a body having a program (e.g., a patch program) and data. A response to the command is also transmitted to the external device 2 via the I / O circuit 13. Here, the response is composed of at least a SW (status word) indicating the processing result, and may also include data.
[0017] The CPU 10 is a processor (computer) that executes various programs stored in the NVM 12. The RAM 11 is used as a working memory, and has, for example, a stack area having a last-in, first-out structure. For example, local variables, arguments, return values, etc. are written in the stack area on a frame-by-frame basis, and are then retrieved on a frame-by-frame basis. The stack area may be provided in the NVM 12. The NVM 12 is an example of a storage unit, and for example, a flash memory is applied. The NVM 12 may be an "Electrically Erasable Programmable Read-Only Memory". Various programs (including the program of the present invention) are stored in advance in the NVM 12 (for example, stored before shipment of the SE 1). The various programs include an operating system (OS), application programs executed on the operating system, etc. Furthermore, patch programs for realizing new functions such as an encryption calculation function and a biometric authentication function (for example, fingerprint authentication and palm print authentication) are written later in the NVM 12 (for example, written after shipment of the SE 1).
[0018] FIG. 1B is a diagram showing an example of a memory map of the NVM 12. In the example of FIG. 1B, the NVM 12 includes a program storage area 121, a patch storage area 122, and a data storage area 123. The data storage area 123 stores, for example, authentication data used in an authentication process for establishing a secure channel. The authentication data is, for example, a key set including a secure channel encryption key, a secure channel MAC (Message Authentication Code) key, and a data encryption key. The program storage area 121 is an area for storing an operating system and an application program, while the patch storage area 122 is an area for storing a patch program. Here, the application program includes an application program having a minimum function (hereinafter referred to as an "empty application program") and a management application program.
[0019] The empty application program has a first function (hereinafter referred to as "empty function") whose processing contents are not defined or whose dummy processing contents are defined, and is configured to call the empty function in response to a first command (hereinafter referred to as "specific command"). For this reason, the minimum functions include, for example, a command receiving function for receiving a specific command, a command executing function for calling and executing an empty function in response to the specific command, and a response sending function for sending a response to the specific command. The specific command is a command for executing a new function. However, since the processing contents are not defined in the empty function called in response to the specific command (or dummy processing contents are defined), the new function is not executed at this stage. Here, examples of the dummy processing contents include, for example, making an error response (responding only with an error without performing any processing) or making a response of a fixed value (such as a value indicating that a patch has not been applied). The minimum functions of the empty application program may include a memory initialization function at the time of starting up the SE1.
[0020] On the other hand, the management application program has functions as a command receiving unit that receives commands from the external device 2 via the I / O circuit 13 and the operating system, and a response transmitting unit that transmits responses to the commands to the external device 2 via the operating system and the I / O circuit 13, and also has functions as a security domain such as an ISD (Issuer Security Domain).The security domain performs mutual authentication between the SE1 and the external device 2 in accordance with a secure channel protocol, and establishes a secure channel that serves as an encrypted path between the SE1 and the external device 2.
[0021] Furthermore, the management application program has a function as a writing unit that adds a patch program having a second function (hereinafter referred to as a "replacement function") in which processing contents related to a new function are defined to the empty application program in response to a second command (hereinafter referred to as a "patch application command") including the patch program and writes the patch program to the patch storage area 122, and rewrites the empty application program so that the replacement function is called instead of the empty function. In other words, the empty function serves as an application port for adding (in other words, embedding) a patch program to the empty application program. Note that it is preferable that the patch program included in the body of the patch application command is composed of native code (machine language), which makes it possible to avoid the long processing time required by an interpreter.
[0022] Fig. 2(A) is a diagram showing an example of source code of an empty application program. The empty application program shown in Fig. 2(A) is written so that an empty function "patch_entry(int arg1)" stored at address "0x1100" in the program storage area 121 is called. Fig. 2(B) is a diagram showing an example of source code of a patch program. The patch program shown in Fig. 2(B) is written with a replacement function "patch_entry_new(int arg1)" in which processing contents related to a new function are defined.
[0023] Such a patch program is written to address "0x2000" in the patch storage area 122, and is added to the empty application program. Such a patch program is written to address "0x2000" in the patch storage area 122, and patch_entry_new(int arg1) is added to the empty application program by changing the address of the location where patch_entry(testVal) is called. Then, "patch_entry(testVal)" written in the part to be rewritten in the empty application program (for example, part 51 shown in FIG. 2A) is rewritten to "patch_entry_new(testVal)" so that the replacement function "patch_entry_new(int arg1)" is called in response to a specific command (i.e., the replacement function is called in place of the empty function). As a result, the new function is executed in response to a specific command. Although the empty application program shown in FIG. 2(A) and the patch program shown in FIG. 2(B) are each shown in source code, they are written in the NVM 12 in native code.
[0024] [2. SE1 Operation] Next, the operation of the SE1 and the external device 2 when a patch program is added to an empty application program will be described with reference to Fig. 3. Fig. 3 is a sequence diagram showing an example of the operation of the SE1 and the external device 2 when a patch program is added to an empty application program.
[0025] 3, it is assumed that the external device 2 is a host, that an empty application program and a management application program are installed in the SE1, and that authentication data (i.e., a key set including a secure channel encryption key, a secure channel MAC key, and a data encryption key) used for mutual authentication with the host is stored in the SE1. It is also assumed that the external device 2 as a host stores the same authentication data as that stored in the SE1.
[0026] In FIG. 3, an external device 2 serving as a host transmits a SELECT command to the SE1 to select the security domain of the SE1 (step S1).
[0027] Next, upon receiving the SELECT command from the external device 2, the SE 1 selects a security domain (that is, a management application program) (step S2), and transmits a response to the SELECT command (indicating normal completion) to the external device 2 (step S3).
[0028] Next, when the external device 2 receives the response from the SE 1, it generates a host-side random number (Host Challenge) (step S4), and transmits an INITALIZE UPDATE command including the host-side random number and the Key Version Number to the SE 1 (step S5).
[0029] Here, the INITALIZE UPDATE command is a command for notifying the SE 1 of the start of authentication processing for establishing a secure channel that serves as an encrypted path between the SE 1 and the external device 2. Also, the Key Version Number is data used to identify authentication data that is the basis of the encryption operation.
[0030] Next, when the SE1 receives the INITALIZE UPDATE command from the external device 2, it generates an SE side random number (Card Challenge), a session key, and an SE side ciphertext (Card Cryptogram) (i.e., generated by the security domain) (step S6), and sends a response including the SE side random number and the SE side ciphertext to the external device 2 (step S7).
[0031] Here, the session key is an encryption key used in a secure channel, and is generated, for example, based on a host-side random number, an SE-side random number, and authentication data (obtained from data storage area 123 by the Key Version Number). The session key generated in this manner includes, for example, an encryption session key and a MAC session key. The SE-side ciphertext is generated, for example, by encrypting data obtained by concatenating the host-side random number and the SE-side random number in accordance with an SE-side rule, using the encryption session key.
[0032] Next, when the external device 2 receives a response from the SE 1 (that is, a response to the INITALIZE UPDATE command), it generates a session key and an SE-side ciphertext (Card Cryptogram) in the same manner as the SE 1 (step S8).
[0033] Next, the external device 2 verifies the legitimacy of the SE1 by comparing the SE-side ciphertext included in the response received from the SE1 with the SE-side ciphertext generated in step S8 (step S9).
[0034] Next, if the external device 2 successfully verifies the legitimacy of SE1 (i.e., authentication is successful), it generates a host cryptogram by encrypting data obtained by concatenating the host side random number and the SE side random number in accordance with the host side rules using the encryption session key (step S10), and sends an EXTERNAL AUTHENTICATE command including the host side cryptogram to SE1 (step S11).
[0035] Here, the EXTERNAL AUTHENTICATE command is a command used by the SE 1 to authenticate the external device 2 and determine the security level. Note that the EXTERNAL AUTHENTICATE command may include a MAC generated using a MAC session key.
[0036] Next, when the SE1 receives the EXTERNAL AUTHENTICATE command from the external device 2, the SE1 generates a host cryptogram in the same manner as the external device 2 (step S12). Note that in step S12, the SE1 may generate a MAC in the same manner as the external device 2.
[0037] Next, the SE1 verifies the legitimacy of the external device 2 by comparing the host-side ciphertext included in the EXTERNAL AUTHENTICATE command received from the external device 2 with the host-side ciphertext generated in step S12 (i.e., verified by the security domain) (step S13). Note that the SE1 may also verify the legitimacy of the MAC by comparing the MAC included in the EXTERNAL AUTHENTICATE command received from the external device 2 with the MAC generated in step S12.
[0038] Next, if the SE1 succeeds in verifying the validity of the external device 2 (or succeeds in both verifying the validity of the MAC and the validity of the external device 2), the SE1 transmits a response indicating successful authentication to the external device 2 (step S14). Thus, the authentication process for establishing a secure channel is completed, and a secure channel between the SE1 and the external device 2 is established.
[0039] After the authentication is successful and a secure channel is established, a command sent from the external device 2 to the SE 1 is protected using a session key generated in the above authentication process according to the security level specified by the EXTERNAL AUTHENTICATE command. For example, a patch application command sent from the external device 2 to the SE 1 is encrypted using the cryptographic session key. Note that a MAC generated using a MAC session key may be added to the patch application command.
[0040] Next, the external device 2 uses the established secure channel to transmit a patch application command including a patch program having a replacement function in which processing content related to the new function is defined to the SE 1 (step S15). Here, as the patch application command, for example, an UPDATE DATA command can be applied, and the UPDATE DATA command specifies a write destination address of the patch program and a rewrite destination address in the empty application program.
[0041] Next, when the SE1 receives a patch application command from the external device 2, the SE1 adds a patch program to the empty application program by the security domain in response to the patch application command as described above, and writes the patch program to the patch storage area 122 (step S16). For example, the patch program is written to a write destination address specified by the UPDATE DATA command.
[0042] Next, the SE1 rewrites the empty application program so that the replacement function is called instead of the empty function (i.e., rewritten by the security domain) (step S17), and transmits a response (indicating normal completion) to the patch application command to the external device 2 (step S18). For example, the part of the rewrite destination address specified by the UPDATE DATA command is rewritten.
[0043] Next, the operation of SE1 after the patch program is added to the empty application program will be described with reference to Fig. 4. Fig. 4 is a flowchart showing an example of the processing of SE1 after the patch program is added to the empty application program. Note that, as a premise of the operation shown in Fig. 4, it is assumed that the external device 2 is a device that uses the new function of SE1.
[0044] The process shown in FIG. 4 is started when an empty application program (an empty application program to which a patch program has been added) is selected in response to a SELECT command from an external device 2 that is a device that uses a new function of the SE1, and then a command is received from the external device 2. When the process shown in FIG. 4 is started, it is determined whether the received command is the specific command (for example, a command to execute AES or RSA processing) (step S21). If it is determined that the received command is a specific command (step S21: YES), a replacement function in which the processing content related to the new function is defined is called, and the processing related to the new function is executed (step S22), and a response to the specific command is transmitted to the external device 2. On the other hand, if it is determined that the received command is not a specific command (step S21: NO), normal processing is executed (step S23), and a response to a command other than the specific command is transmitted.
[0045] As described above, according to the above embodiment, an empty application program configured to call an empty function in response to a specific command is stored in advance, and in response to a patch application command including a patch program having a replacement function that defines processing content related to a new function, the patch program is added to the empty application program and written to NVM12, and the empty application program is rewritten so that the replacement function is called instead of the empty function. This makes it possible to later add new functions to an application program efficiently and with less memory.
[0046] In the above embodiment, the SE1 has been described as an example of the electronic information storage medium of the present invention, but the present invention can also be applied to embedded microchips and the like. [Explanation of symbols]
[0047] 1 SE 2 External device 10 CPU 11 RAM 12 NVM 13 I / O loop
Claims
1. A command receiving unit that receives a command from an external device; a storage unit that prestores an application program having a first function whose processing content is not defined or whose processing content is dummy, the application program being configured so that the first function is called in response to a first command; a writing unit that adds a patch program to the application program in response to a second command including a patch program having a second function in which processing content related to a new function is defined, and writes the patch program into the storage unit, and rewrites the application program so that, when the first command is received after the patch program has been written into the storage unit, the second function is called in place of the first function in response to the first command; a response transmission unit that transmits a response to the command to the external device; An electronic information storage medium comprising:
2. The electronic information storage medium according to claim 1, characterized in that the second command is received using a secure channel established by successful authentication in an authentication process performed between the electronic information storage medium and an external device.
3. the first function is stored at a first address in the storage unit, and the second function is stored at a second address in the storage unit that is different from the first address; The electronic information storage medium according to claim 1 or 2, characterized in that the writing unit changes the first address written in the application program to the second address so that the second function is called instead of the first function by the first command.
4. A program adding method executed by a computer contained in an electronic information storage medium, comprising: Storing in a storage unit an application program having a first function whose processing content is not defined or whose processing content is dummy, the application program being configured so that the first function is called in response to a first command; adding a patch program to the application program in response to a second command including a patch program having a second function that defines processing content related to a new function, and writing the patch program to the storage unit, and rewriting the application program so that, when the first command is received after the patch program has been written to the storage unit, the second function is called in place of the first function in response to the first command; A program adding method comprising:
5. Storing in a storage unit an application program having a first function whose processing content is not defined or whose processing content is dummy, the application program being configured so that the first function is called in response to a first command; adding a patch program to the application program in response to a second command including a patch program having a second function that defines processing content related to a new function, and writing the patch program to the storage unit, and rewriting the application program so that, when the first command is received after the patch program has been written to the storage unit, the second function is called in place of the first function in response to the first command; A program characterized by causing a computer to execute the above.
Citation Information
Patent Citations
Electronic equipment programming system and programming method
JP2002244875A
Portable information recording medium and its program
JP2007011419A
Program correcting system for IC card, program, and IC card
JP2007206902A
IC card and method for execution of patch code
JP2010113549A
Program, update control method, and update control device
JP2016197326A
