Secure element, electronic device, public key processing method, public key acquisition method, and program
The secure element addresses the challenge of encoding public keys by encoding them according to ASN.1 rules within the secure element itself, simplifying the process for applications and reducing their encoding burdens.
Patent Information
- Application Number
- JP2023205306
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-12-05
- Publication Date
- 2025-06-17
AI Technical Summary
Devices using secure elements face challenges in handling public keys, as they need to be encoded according to ASN.1 encoding rules, which can be cumbersome for applications operating on these devices.
A secure element that includes a storage unit for storing public keys and a control unit that encodes the public key according to ASN.1 rules upon request, allowing the encoded public key to be returned to the application.
This solution eliminates the need for applications to manually encode public key parameters according to ASN.1 rules, simplifying the process and reducing the complexity for applications using secure elements.
Smart Images

Figure 2025090211000001_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a secure element, an electronic device, a public key processing method, a public key acquisition method, and a program.
Background Art
[0002] In devices such as IoT (Internet of Things) devices, mobile terminals, and personal computers, secure elements such as tamper-resistant IC (Integrated Circuit) chips, IC cards, and USIM (Universal Subscriber Identity Module) cards are used. When handling an asymmetric key pair such as RSA encryption or EC (Elliptic Curve) encryption with these secure elements, the private key is used only within the secure element, but the public key may be taken out from the secure element and used. For example, Patent Document 1 discloses that an IC card storing a public key is attached to an information processing device, and the information processing device transmits the public key to another information processing device.
[0003] When a public key is requested from an application (applet) in a secure element to the JavaCard API in JavaCardOS generally used in secure elements, parameters constituting the public key are responded. For example, in the case of RSA encryption, the public exponent and modulus, which are parameters constituting the public key, are responded, and in the case of EC encryption, the X and Y of the public coordinates, which are parameters constituting the public key, are responded.
Prior Art Documents
Patent Documents
[0004]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0005] However, in the input to a general cryptographic library (e.g., OpenSSL) in a device that uses a public key extracted from a secure element, since a public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One) (e.g., DER (Distinguish Encoding Rules), PEM (Packed Encoding Rules), etc.) is used, each of the applications operating on the device may have a problem that the parameters constituting the public key must be encoded according to the encoding rules of ASN.1.
[0006] The present invention has been made in view of such circumstances, and provides a secure element, an electronic device, a public key processing method, a public key acquisition method, and a program in which, in an application of a device using a secure element, it is not necessary to encode the parameters constituting the public key according to the encoding rules of ASN.1.
Means for Solving the Problems
[0007] This invention has been made to solve the above-described problems, and one aspect of the present invention is a secure element including a storage unit that stores a public key, and a control unit that, when receiving a request for the public key, returns the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One).
[0008] Further, another aspect of the present invention is the above-described secure element, wherein the control unit generates the public key encoded according to the encoding rules of ASN.1 by performing encoding according to the encoding rules of ASN.1 on the public key stored in the storage unit.
[0009] Another aspect of the present invention is an electronic device including a control unit that requests the public key from a secure element storing the public key and obtains the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One) as a response to the request.
[0010] Another aspect of the present invention is a method for processing a public key of a secure element including a storage unit storing the public key, the method including the step of returning the public key encoded according to the encoding rules of ASN.1 when receiving a request for the public key.
[0011] Another aspect of the present invention is a method for obtaining a public key, including the step of requesting the public key from a secure element storing the public key and the step of obtaining the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One) as a response to the request in the step.
[0012] Another aspect of the present invention is a program for causing a computer of a secure element including a storage unit storing the public key to function as a control unit that returns the public key encoded according to the encoding rules of ASN.1 when receiving a request for the public key.
[0013] Another aspect of the present invention is a program for causing a computer to function as a control unit that requests the public key from a secure element storing the public key and obtains the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One) as a response to the request.
Advantages of the Invention
[0014] According to this invention, in an application of a device using a secure element, it is not necessary to encode parameters constituting the public key according to the encoding rules of ASN.1.
Brief Description of the Drawings
[0015]
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Embodiments for Carrying Out the Invention
[0016] Hereinafter, embodiments of the present invention will be described with reference to the drawings. FIG. 1 is a schematic block diagram showing the configuration of the electronic device 10 and the secure element 20 according to an embodiment of the present invention. The electronic device 10 is an IoT device, a mobile terminal, a personal computer, etc., and includes a first control unit 11 and a first storage unit 12. The secure element 20 is an IC chip, an IC card, a USIM card, etc. having higher tamper resistance than the electronic device 10, and includes a second control unit 21 and a second storage unit 22.
[0017] The first control unit 11 and the second control unit 21 are communicably connected. The first control unit 11 and the second control unit 21 may be communicably connected, for example, by inserting the secure element 20 into a socket provided in the electronic device 10, or may be communicably connected by wireless communication when the secure element 20 is disposed in the vicinity of the electronic device 10. Also, in FIG. 1, the secure element 20 is disposed outside the electronic device 10, but the electronic device 10 may include the secure element 20, and the first control unit 11 and the second control unit 21 may be communicably connected via an I2C bus or the like.
[0018] The first control unit 11 requests a public key from the secure element 20 that stores the public key, and as a response to the request, obtains a public key (encoded public key) encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One). The ASN.1 encoding rules used in this embodiment are, for example, DER (Distinguish Encoding Rules) and PEM (Packed Encoding Rules). The first control unit 11 stores the obtained encoded public key in the first storage unit 12. The first control unit 11 includes a general-purpose processor such as a CPU (Central Processing Unit) and a communication interface with the second control unit 21 (for example, I2C (Inter-Integrated Circuit), SPI (Serial Peripheral Interface), etc.), and reads and executes a program from the first storage unit 12.
[0019] The first control unit 11 may function as the first application (application) unit 111 and the second application unit 112 by executing programs corresponding to the first application unit 111 and the second application unit 112 respectively. The first application unit 111 makes a request for the above-mentioned public key, acquires the encoded public key, and saves the encoded public key in the first storage unit 12. The second application unit 112 reads out and uses the encoded public key from the first storage unit 12. Note that the first application unit 111 may also serve as the second application unit 112, or the first control unit 11 may further function as more application units, and these application units may read out and use the encoded public key from the first storage unit 12.
[0020] The first storage unit 12 is composed of a non-volatile memory such as a hard disk device, a solid state drive, a flash memory, a magneto-optical disk device, a storage medium that can only be read such as a ROM (Read Only Memory), a CD-ROM, a DVD-ROM, a volatile memory such as a RAM (Random Access Memory), or a combination thereof. The first storage unit 12 stores the program executed by the first control unit 11 and the data used during the execution of the program. The data includes the encoded public key saved by the first application unit 111.
[0021] When the second control unit 21 receives a request for a public key from the first control unit 11, it returns an encoded public key. The second control unit 21 may generate an encoded public key by performing encoding according to the encoding rules of ASN.1 on the public key stored in the second storage unit 22. The second control unit 21 includes a general-purpose processor such as a CPU and a communication interface with the first control unit 11, and reads and executes a program from the second storage unit 22. The second control unit 21 may function as the applet unit 211 and the OS (Operating System) unit 212 by executing programs corresponding to the applet unit 211 and the OS unit 212 respectively.
[0022] When the applet unit 211 receives a public key request from the first control unit 11, it acquires the public key using the interface provided by the OS unit 212, encodes the acquired public key according to the ASN.1 encoding rule to generate an encoded public key, and returns the encoded public key to the first control unit 11. The OS unit 212 has an interface that provides the public key stored in the second storage unit 22 to the applet unit 211.
[0023] Hereinafter, an operation example in the case where the OS unit 212 is JavaCardOS, the applet unit 211 is an applet operating on JavaCardOS, and DER is used as the encoding rule will be described. FIG. 2 is a sequence diagram showing an operation example (part 1) of the electronic device 10 and the secure element 20 in the present embodiment. The first application unit 111 transmits an RSA public key request Sa1 for requesting an RSA public key to the applet unit 211.
[0024] When the applet unit 211 receives the RSA public key request Sa1 from the first application unit 111, it calls the modulus acquisition Sa2 (RSAPublicKey.getModulus() API) to request the OS unit 212 to acquire a modulus, which is one of the parameters of the RSA public key. When the modulus acquisition Sa2 is called, the OS unit 212 reads a modulus Sa3, which is one of the parameters of the public key, from the second storage unit 22 and returns the modulus Sa3 to the applet unit 211 as a response to the modulus acquisition Sa2.
[0025] When the applet unit 211 acquires the modulus Sa3, it calls the public exponent acquisition Sa4 (RSAPublicKey.getExponent() API) to request the OS unit 212 to acquire a public exponent, which is one of the parameters of the RSA public key. When the modulus acquisition Sa2 is called, the OS unit 212 reads a public exponent Sa5, which is one of the parameters of the public key, from the second storage unit 22 and returns the public exponent Sa5 to the applet unit 211 as a response to the public exponent acquisition Sa4.
[0026] When the applet unit 211 obtains the modulus Sa3 and the public exponent Sa5, it performs encoding Sa6 on them according to the DER, which is the encoding rule of ASN.1, to generate an encoded RSA public key. As a response to the RSA public key request Sa1, the applet unit 211 returns the encoded RSA public key Sa7 to the first application unit 111.
[0027] When the first application unit 111 receives the encoded RSA public key Sa7 from the applet unit 211, it saves Sa8 the encoded RSA public key Sa7 to the first storage unit 12. The second application unit 112 obtains Sa9 the encoded RSA public key Sa7 from the first storage unit 12 and uses it in a cryptographic library such as OpenSSL.
[0028] Figure 3 is a sequence diagram showing an operation example (part 2) of the electronic device 10 and the secure element 20 in the present embodiment. The first application unit 111 transmits an EC public key request Sb1 for requesting an EC public key to the applet unit 211.
[0029] When the applet unit 211 receives the EC public key request Sb1 from the first application unit 111, it calls the public coordinate acquisition Sb2 (ECPublicKey.getW() API) to request the OS unit 212 to acquire the public coordinates, which are the parameters of the EC public key. When the public coordinate acquisition Sb2 is called, the OS unit 212 reads the public coordinates Sb3, which are the parameters of the public key, from the second storage unit 22 and returns the public coordinates Sb3 to the applet unit 211 as a response to the public coordinate acquisition Sb2.
[0030] When the applet unit 211 obtains the public coordinates Sb3, it performs encoding Sb4 on the public coordinates Sb3 according to the DER, which is the encoding rule of ASN.1, to generate an encoded EC public key Sb5. As a response to the EC public key request Sb1, the applet unit 211 returns the encoded EC public key Sb5 to the first application unit 111.
[0031] When the first application part 111 receives the encoded EC public key Sb5 from the applet part 211, it saves Sb6 the encoded EC public key Sb5 to the first storage part 12. The second application part 112 retrieves Sb7 the encoded EC public key Sb5 from the first storage part 12 and uses it in a cryptographic library such as OpenSSL.
[0032] In FIGS. 2 and 3, the case of using DER as the ASN.1 encoding rule was described as an example, but other encoding rules such as PEM may also be used. Further, the first application part 111 includes information indicating the ASN.1 encoding rule in the RSA public key request Sa1 and the EC public key request Sb1 in FIGS. 2 and 3. In the encodings Sa6 and Sb4, the applet part 211 may encode using the encoding rule indicated by the information.
[0033] FIG. 4 is a diagram showing an example of the RSA public key stored in the second storage part 22 in the present embodiment. In FIG. 4, the characters within the shaded parentheses are information names. As shown in FIG. 4, the second storage part 22 stores the raw data of the public exponent of the 3-byte RSA public key represented by 6-digit hexadecimal numbers and the raw data of the public modulus of the 65-byte RSA public key represented by 65 two-digit hexadecimal numbers.
[0034] FIG. 5 is a diagram showing an example of the encoded RSA public key in the present embodiment. In FIG. 5, the characters within the shaded parentheses are information names. To the right of the colon is an explanation regarding the syntax. The data composed of a plurality of two-digit hexadecimal numbers is the encoded RSA public key. As shown in FIG. 5, the encoded RSA public key is encoded by ASN.1 DER and includes values indicating syntax such as SEQUENCE and OBJECT, values indicating their lengths, the public modulus of the 65-byte RSA public key, and the public exponent of the 3-byte RSA public key.
[0035] FIG. 6 is a diagram showing an example of an EC public key stored in the second storage unit 22 in the present embodiment. In FIG. 6, the characters within the shaded parentheses are information names. To the right of the colon is an explanation of the information. As shown in FIG. 6, the second storage unit 22 stores the hexadecimal "04" indicating non-compressed encoding, the 32-byte X coordinate constituting the EC public key, and the 32-byte Y coordinate.
[0036] FIG. 7 is a diagram showing an example of an encoded EC public key in the present embodiment. In FIG. 7, the characters within the shaded parentheses are information names. To the right of the colon is an explanation of the syntax. Data composed of a plurality of two-digit hexadecimal numbers is the encoded EC public key. As shown in FIG. 7, the encoded EC public key is encoded by DER of ASN.1 and includes values indicating syntax such as SEQUENCE and OBJECT, values indicating their lengths, and 66-byte public coordinates.
[0037] Note that in the above-described embodiment, the second control unit 21 encodes the public key stored in the second storage unit 22 every time a public key is requested from the first control unit 11, but the present invention is not limited to this. For example, the second storage unit 22 may store the encoded public key, and when the second control unit 21 receives a request for a public key from the first control unit 11, the second control unit 21 may return the encoded public key stored in the second storage unit 22 as a response.
[0038] Note that the present invention may also be the following embodiments. (1) One embodiment of the present invention is a secure element including a storage unit that stores a public key and a control unit that, when receiving a request for the public key, returns the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One).
[0039] Thereby, in an application of a device using the secure element, it is not necessary to encode the parameters constituting the public key according to the encoding rules of ASN.1.
[0040] (2) Further, another embodiment of the present invention is the secure element described in (1), wherein the control unit performs encoding according to the encoding rules of the ASN.1 on the public key stored in the storage unit, thereby generating the public key encoded according to the encoding rules of the ASN.1.
[0041] Thereby, the number of bytes of the public key stored in the secure element can be suppressed.
[0042] (3) Further, another embodiment of the present invention is an electronic device including a control unit that requests the public key from a secure element that stores the public key and acquires the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One) as a response to the request.
[0043] (4) Further, another embodiment of the present invention is a public key processing method for a secure element including a storage unit that stores a public key, the method including the step of returning the public key encoded according to the encoding rules of ASN.1 when a request for the public key is received.
[0044] (5) Further, another embodiment of the present invention is a public key acquisition method including the step of requesting the public key from a secure element that stores the public key and the step of acquiring the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One) as a response to the request in the step.
[0045] (6) Further, another embodiment of the present invention is a program for causing a computer of a secure element including a storage unit that stores a public key to function as a control unit that returns the public key encoded according to the encoding rules of ASN.1 when a request for the public key is received.
[0046] (7) Further, another embodiment of the present invention is a program for causing a computer to function as a control unit that requests the public key from a secure element storing the public key and obtains the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One) as a response to the request.
[0047] Further, a program for realizing the functions of the electronic device 10 and the secure element 20 in FIG. 1 may be recorded on a computer-readable recording medium, and the program recorded on this recording medium may be read into a computer system and executed to implement the electronic device 10 and the secure element 20. Here, the "computer system" is assumed to include hardware such as an OS and peripheral devices.
[0048] Further, the "computer-readable recording medium" refers to a portable medium such as a flexible disk, a magneto-optical disk, a ROM, a CD-ROM, etc., and a storage device such as a hard disk built into a computer system. Furthermore, the "computer-readable recording medium" also includes those that dynamically hold a program for a short time, such as a communication line when transmitting a program via a network such as the Internet or a communication line such as a telephone line, and those that hold a program for a certain period of time, such as a volatile memory inside a computer system serving as a server or a client in that case. Also, the above program may be for realizing a part of the aforementioned functions, and may also be for realizing the aforementioned functions in combination with a program already recorded in the computer system.
[0049] As described above, the embodiments of the present invention have been described in detail with reference to the drawings. However, the specific configuration is not limited to this embodiment, and design changes and the like within the scope not departing from the gist of the present invention are also included.
Explanation of Reference Numerals
[0050] 10 Electronic device 11 First control unit 111 First application part 112 Second application part 12 First storage part 20 Secure element 21 Second control part 211 Applet part 212 OS part 22 Second storage part
Claims
1. A storage unit that stores a public key, and a control unit that, upon receiving a request for the public key, returns the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One). A secure element comprising the above.
2. The control unit generates the public key encoded according to the encoding rules of ASN.1 by performing encoding according to the encoding rules of ASN.1 on the public key stored in the storage unit. The secure element according to Claim 1.
3. A control unit that requests the public key from a secure element that stores the public key and obtains the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One) as a response to the request. An electronic device comprising the above.
4. A public key processing method for a secure element comprising a storage unit that stores a public key, the step of returning the public key encoded according to the encoding rules of ASN.1 upon receiving a request for the public key. A public key processing method having the above.
5. The step of requesting the public key from a secure element that stores the public key, and the step of obtaining the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One) as a response to the request in the above step. A public key acquisition method having the above.
6. A program for causing a computer of a secure element comprising a storage unit that stores a public key to function as a control unit that returns the public key encoded according to the encoding rules of ASN.1 upon receiving a request for the public key.
7. A computer, request the public key from a secure element storing the public key, and as a response to the request, obtain the public key encoded according to the encoding rules of ASN.1 (Abstract Syntax Notation One), a control unit A program for causing the computer to function as such.
Citation Information
Patent Citations
Information processing device and communication system
JP2023135195A