Application Activation Method and Device Based on Trusted Execution Environment
By deploying a trusted execution environment in the terminal device, generating and storing encrypted trusted identity, trusted key and activation code, the problem of easy cracking and misappropriation of registration codes in existing software activation solutions is solved, and higher software protection and security are achieved.
Patent Information
- Application Number
- CN201910145498.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-02-27
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2039-02-27
AI Technical Summary
The existing software activation solution has problems such as unencrypted storage of registration code files, not bound to the device, and unencrypted content during server transmission, resulting in the software being easily cracked and stolen.
Using an activation method based on a trusted execution environment, by deploying a trusted execution environment in a terminal device, encrypted trusted identity, trusted key and activation code are generated and stored to ensure that these information is only decrypted and used in a trusted environment.
Effectively prevent the registration code from being illegally copied and tampered, ensure the security and uniqueness of the software activation process, and improve the strength of software protection.
Smart Images

Figure CN111625829B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of application security technology, and in particular, to an application activation method and device based on a trusted execution environment. Background Art
[0002] After software is released, a way is needed to prevent the software from being cracked and pirated to ensure the interests of software developers themselves. Currently, the registration code method is usually used to protect software, that is, users first download and install the trial version of the software, and then activate the software by applying for a registration code from the server. After that, when the user uses the software, the software will read the registration code file and determine whether the software is available according to the registration code file.
[0003] The above software activation scheme has some problems:
[0004] 1. The registration code file is not encrypted and stored in the device, resulting in it being able to be copied in plain text to other devices, enabling the software installed on other devices to be illegally cracked. In addition, the content of the registration code file may be tampered with by users to illegally extend the usage times or validity period of the software.
[0005] 2. The registration code file is not bound to the device, resulting in the registration code file being able to be used on different devices, enabling the software installed on other devices to be illegally cracked.
[0006] 3. During the process of the server transmitting the registration code to the device, the content of the registration code file is not encrypted, resulting in the registration code file being easily eavesdropped or forged.
[0007] Therefore, a more secure software activation method is needed. Summary of the Invention
[0008] For this reason, the present invention provides an application activation method and device based on a trusted execution environment to try to solve or at least alleviate the problems existing above.
[0009] According to the first aspect of the present invention, an activation method for a trusted execution environment is provided. The trusted execution environment is deployed in a terminal device. The method includes: sending a terminal device identifier to a server; receiving activation information returned by the server, where the activation information includes an encrypted trusted identity identifier, a trusted key, and an activation code, the trusted identity identifier and the trusted key correspond to the terminal device identifier, and the activation code is generated according to the terminal device identifier; decrypting the activation information to obtain the trusted identity identifier, the trusted key, and the activation code; and encrypting and storing the trusted identity identifier, the trusted key, and the activation code in a secure storage space.
[0010] According to a second aspect of the present invention, there is provided a method for activating a trusted execution environment deployed in a terminal device, the method comprising: receiving a terminal device identifier sent by the terminal device; generating a trusted identity identifier and a trusted key corresponding to the terminal device identifier, and generating an activation code according to the terminal device identifier; encrypting the trusted identity identifier, the trusted key and the activation code to generate activation information; and sending the activation information to the terminal device so that the terminal device: decrypts the activation information to obtain the trusted identity identifier, the trusted key and the activation code, and encrypts and stores the trusted identity identifier, the trusted key and the activation code in a secure storage space.
[0011] According to a third aspect of the present invention, there is provided a method for activating and verifying a trusted execution environment, which is executed in the trusted execution environment of a terminal device, the method comprising: obtaining a trusted identity identifier, a trusted key and an activation code of the trusted execution environment, the activation code including usage permission information and verification information of the trusted execution environment, and the verification information including ciphertext generated by encrypting the trusted identity identifier, the usage permission information and the terminal device identifier with the trusted key; obtaining the terminal device identifier, encrypting the trusted identity identifier, the usage permission information and the terminal device identifier with the trusted key to generate a first ciphertext; and if the first ciphertext is consistent with the verification information and the current usage environment of the terminal device matches the usage permission information, the trusted execution environment is successfully activated.
[0012] According to a fourth aspect of the present invention, there is provided a method for activating an application based on a trusted execution environment deployed in a terminal device, the method comprising: sending the trusted identity identifier of the terminal device to a server; receiving registration information returned by the server, the registration information including a registration code encrypted with the trusted key corresponding to the trusted identity identifier, the registration code being generated according to the trusted identity identifier; decrypting the registration information with the trusted key to obtain the registration code; and encrypting and storing the registration code in a secure storage space.
[0013] According to a fifth aspect of the present invention, there is provided a method for activating an application based on a trusted execution environment deployed in a terminal device, the method comprising: receiving the trusted identity identifier sent by the terminal device; generating a registration code according to the trusted identity identifier; encrypting the registration code with the trusted key corresponding to the trusted identity identifier to generate registration information; and sending the registration information to the terminal device so that the terminal device: decrypts the registration information with the trusted key to obtain the registration code; and encrypts and stores the registration code in a secure storage space.
[0014] According to a sixth aspect of the present invention, there is provided an application activation verification method based on a trusted execution environment, which is executed in the trusted execution environment of a terminal device. The method includes: obtaining a trusted identity identifier, a trusted key, and a registration code of an application to be verified, where the registration code includes usage permission information and verification information, and the verification information is a ciphertext generated by encrypting the trusted identity identifier and the usage permission information with the trusted key; encrypting the trusted identity identifier and the usage permission information with the trusted key to generate a first ciphertext; if the first ciphertext is consistent with the verification information, sending the registration code to the application to be verified, so that the application determines whether it is successfully activated according to whether the current usage environment matches the usage permission information.
[0015] According to a seventh aspect of the present invention, there is provided a terminal device on which a trusted execution environment is deployed. The trusted execution environment includes an activation management application, and the activation management application is adapted to execute the activation method of the trusted execution environment, the activation verification method of the trusted execution environment, the application activation method based on the trusted execution environment, and the application activation verification method based on the trusted execution environment as described above.
[0016] According to an eighth aspect of the present invention, there is provided a server, including: at least one processor; and a memory storing program instructions, where the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the activation method of the trusted execution environment and the application activation method based on the trusted execution environment as described above.
[0017] According to a ninth aspect of the present invention, there is provided an application activation system based on a trusted execution environment, including: the terminal device as described above; and the server as described above.
[0018] The present invention provides an application activation solution based on a trusted execution environment. The trusted execution environment is an independent and trusted environment with an isolated hardware environment and an independent operating system, and can be used to store, process, and protect sensitive data. In the technical solution of the present invention, first, the trusted execution environment in the terminal device is activated. On the basis that the trusted execution environment has been activated, the trusted execution environment can provide trusted application activation and activation verification services to other applications of the terminal device, thereby ensuring the security of other applications. The activation code of the trusted execution environment and the registration code of the application are encrypted and stored in the secure storage space through the trusted execution environment. The data in the secure storage space can only be read by the activation management application in the trusted execution environment, ensuring that it cannot be illegally obtained and tampered with.
[0019] During the process of activating the trusted execution environment, the server generates a trusted identity identifier and a trusted key for the terminal device. Subsequently, the trusted key is applied to the encrypted transmission process of the activation code of the trusted execution environment and the registration code of the application. The trusted key is only transmitted once between the terminal device and the server, that is, during and only during the process of activating the trusted execution environment, the server encrypts and transmits the generated trusted key to the terminal device. During the subsequent process of activating the application based on the trusted execution environment, the trusted key is no longer transmitted. Therefore, the trusted key is only stored in the terminal device and the server. Even if other devices eavesdrop on the registration information transmitted between the terminal device and the server, since they cannot obtain the trusted key, they cannot decrypt the registration information to obtain the registration code, thereby further improving the transmission security of the application registration code.
[0020] The activation code of the trusted execution environment and the registration code of the application both embed the trusted identity identifier of the terminal device, thus ensuring the uniqueness and non-replicability of the activation code and registration code of each terminal device. If the activation code or registration code is maliciously tampered with, the activation verification of the trusted execution environment of the terminal device and the application will fail. In addition, even if the activation code or registration code is copied to other terminal devices, it cannot be used to activate the trusted execution environment or application of other terminal devices.
[0021] The above description is only an overview of the technical solution of the present invention. In order to be able to more clearly understand the technical means of the present invention, it can be implemented in accordance with the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention are specifically given below. Brief Description of the Drawings
[0022] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalent aspects are intended to fall within the scope of the claimed subject matter. By reading the following detailed description in conjunction with the drawings, the above and other purposes, features and advantages of the present disclosure will become more apparent. Throughout the present disclosure, like reference numerals generally refer to like components or elements.
[0023] Figure 1 Shows a schematic diagram of an activation system 100 for a trusted execution environment according to an embodiment of the present invention;
[0024] Figure 2 Shows a schematic diagram of an application activation system 200 based on a trusted execution environment according to an embodiment of the present invention;
[0025] Figure 3 Shows a flowchart of an activation method 300 (on the terminal device side) for a trusted execution environment according to an embodiment of the present invention;
[0026] Figure 4 Shows a schematic diagram of the activation process of a trusted execution environment according to an embodiment of the present invention;
[0027] Figure 5 Shows a flowchart of a method 500 (server side) for activating a trusted execution environment according to an embodiment of the present invention;
[0028] Figure 6 Shows a flowchart of a method 600 for verifying the activation of a trusted execution environment according to an embodiment of the present invention;
[0029] Figure 7 Shows a schematic diagram of the activation verification process of a trusted execution environment according to an embodiment of the present invention;
[0030] Figure 8 Shows a flowchart of a method 800 (terminal device side) for activating an application based on a trusted execution environment according to an embodiment of the present invention;
[0031] Figure 9 Shows a schematic diagram of the activation process of an application based on a trusted execution environment according to an embodiment of the present invention;
[0032] Figure 10 Shows a flowchart of a method 1000 (server side) for activating an application based on a trusted execution environment according to an embodiment of the present invention;
[0033] Figure 11 Shows a flowchart of a method 1100 for verifying the activation of an application based on a trusted execution environment according to an embodiment of the present invention; and
[0034] Figure 12 Shows a schematic diagram of the activation verification process of an application based on a trusted execution environment according to an embodiment of the present invention. Detailed implementation manners
[0035] Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be completely conveyed to those skilled in the art.
[0036] The present invention provides an application activation solution based on a trusted execution environment. In the technical solution of the present invention, first, the trusted execution environment in the terminal device is activated. On the basis that the trusted execution environment has been activated, the trusted execution environment can provide trusted application activation and activation verification services to other applications in the terminal device, thereby ensuring the security of other applications.
[0037] Figure 1 FIG. 4 shows a schematic diagram of an activation system 100 of a trusted execution environment according to an embodiment of the present invention. As Figure 1 shown, the system 100 includes a terminal device 110 and a server 120. It should be noted that although Figure 1 the shown system 100 only includes one terminal device 110 and one server 120, however, those skilled in the art can understand that in practice, the system 100 can include any number of terminal devices 110 and servers 120, and the present invention does not limit the number of terminal devices 110 and servers 120 included in the system 100.
[0038] The terminal device 110 can be specifically implemented as any device, such as a mobile phone, a tablet computer, a smart wearable device, a smart home appliance, a car computer, a drone, etc., but not limited thereto. As Figure 1 shown, a trusted execution environment (abbreviated as TEE) and a rich execution environment (abbreviated as REE) are deployed in the terminal device 110. The trusted execution environment and the rich execution environment have mutually isolated hardware and independent operating systems, which are used to meet the running requirements of applications with different security levels. The hardware isolation between the trusted execution environment and the rich execution environment can be implemented, for example, by ARM TrustZone or the security extension technology of C-SKY, but not limited thereto.
[0039] The operating system of the rich execution environment can be a general operating system such as Android, iOS, RTOS real-time operating system, etc. Ordinary applications with low security requirements can run on this operating system, such as instant messaging, taking pictures, weather query, etc. The operating system of the trusted execution environment is usually a closed and relatively simple security operating system. Trusted applications with high security requirements run on this operating system, such as fingerprint recognition, identity authentication, electronic payment, smart lock, etc. The trusted applications in the trusted execution environment can be called by ordinary applications in the rich execution environment to implement corresponding functions. The trusted applications cannot directly communicate with the outside (such as servers, other terminal devices, users, etc.), but need to use ordinary applications in the rich execution environment as communication relays, that is, the trusted applications in the trusted execution environment communicate with the outside through ordinary applications in the rich execution environment.
[0040] The server 120 can be any device for providing an online activation service for the trusted execution environment to the terminal device 110, such as a physical server, or a computing instance deployed in a physical server, etc., but not limited thereto. The server 120 is used to provide an online activation service for the trusted execution environment to the terminal device 110. After the trusted execution environment is activated, the terminal device 110 can use the trusted execution environment to process and protect sensitive data.
[0041] In an embodiment of the present invention, the trusted execution environment includes an activation management application 112. The activation management application 112 communicates with the server 120 via an interface application 113 deployed in the rich execution environment and is used to activate the trusted execution environment. Specifically, the activation management application 112 reads the terminal device identifier and sends the terminal device identifier to the server 120 via the interface application 113. The server 120 generates an activation code based on the terminal device identifier, and generates a trusted identity identifier and a trusted key for the terminal device, and stores the trusted identity identifier and the trusted key in association with the terminal device identifier. The trusted identity identifier is a string that can represent the uniqueness of the device. It is used to uniquely identify the terminal device 110 and has the security attributes of being tamper-proof, forgery-proof, and globally unique. The trusted key is a string derived from the trusted identity identifier through a specific algorithm and is used to encrypt key information related to the terminal device 110. The server 120 encrypts the trusted identity identifier, the trusted key, and the activation code to generate activation information, and sends the activation information to the activation management application 112 via the interface application 113. After decrypting the activation information to obtain the trusted identity identifier, the trusted key, and the activation code, the activation management application 112 encrypts and stores the trusted identity identifier, the trusted key, and the activation code in the secure storage space 111. The secure storage space 111 is a designated space for storing files, and the files are encrypted with the trusted key and stored at this location. In an embodiment of the present invention, the secure storage space 111 can be accessed only by the activation management application 112. After encrypting and storing the trusted identity identifier, the trusted key, and the activation code in the secure storage space 111, the activation of the trusted execution environment of the terminal device 110 is completed.
[0042] An ordinary application in the rich execution environment can call a trusted application in the trusted execution environment. When the trusted application is called, the called trusted application will further call the activation management application 112 to trigger the activation verification of the trusted execution environment. The activation management application 112 reads the trusted identity identifier, the trusted key, and the activation code from the secure storage space 111, and verifies whether the trusted execution environment is successfully activated based on the trusted identity identifier, the trusted key, and the activation code. Subsequently, the verification result is returned to the trusted application called by the ordinary application. If the activation is verified to be successful, the called trusted application executes the call of the ordinary application and returns the call result to the ordinary application.
[0043] For example, as Figure 1 shown, the first general application 114 in the rich execution environment is a shopping application, and the first trusted application 115 is an electronic payment application. When a user selects certain goods in the first general application 114 and needs to make a payment for purchase, the first general application 114 invokes the first trusted application 115 to implement the electronic payment function. After the first trusted application 115 is invoked, it triggers the activation management application 112 to perform activation verification of the trusted execution environment. The activation management application 112 reads the trusted identity identifier, trusted key, and activation code from the secure storage space 111, verifies whether the trusted execution environment is successfully activated based on the trusted identity identifier, trusted key, and activation code, and returns the verification result to the first trusted application. If the activation verification is successful, the first trusted application 115 executes the invocation of the first general application 114 to implement the electronic payment function, and returns the invocation result (whether the payment is successful) to the first general application 114.
[0044] On the basis that the trusted execution environment has been activated, the trusted execution environment can provide application activation and activation verification services to other applications of the terminal device 110, thereby ensuring the security of other applications. Figure 2 shows a schematic diagram of an application activation system 200 based on a trusted execution environment according to an embodiment of the present invention. As Figure 2 shown, the system 200 includes a terminal device 110 and a server 120. A trusted execution environment and a rich execution environment are deployed in the terminal device 110, and a second general application 116 is deployed in the rich execution environment. On the basis that the trusted execution environment in the terminal device 110 has been activated, the second general application 116 can be activated based on the trusted execution environment.
[0045] The server 120 further includes an application server 122 and an authentication server 124. The application server 122 is a server that provides method and data invocation to the second general application 116, and it can generate usage permission information (such as effective time, expiration time, available times, etc.) for activating the second general application 116. The authentication server 124 is used to verify the identity of the terminal device 110, generate verification information according to the usage permission information, and encrypt the usage permission information and the verification information, etc.
[0046] Specifically, the second general application 116 triggers the activation management application 112 to verify whether the trusted execution environment is successfully activated. When the trusted execution environment is successfully activated, the trusted identity identifier of the terminal device is sent to the application server 122. The application server 122 sends the trusted identity identifier to the authentication server 124. The authentication server 124 verifies the identity of the terminal device 110 and returns the verification result to the application server 122. When the authentication server 124 passes the verification, the application server 122 generates the usage permission information of the second general application 116 and sends the usage permission information to the authentication server 124. The authentication server 124 generates verification information based on the usage permission information and the trusted identity identifier, combines the usage permission information and the verification information into a registration code, obtains the trusted key corresponding to the trusted identity identifier, encrypts the registration code with the trusted key to generate registration information, and sequentially sends the encrypted registration information to the activation management application 112 via the application server 122 and the second general application 116. The activation management application 112 obtains the trusted key from the secure storage space 111, decrypts the registration information with the trusted key to obtain the registration code, and encrypts and stores the registration code in the secure storage space 111. After encrypting and storing the registration code in the secure storage space 111, the activation of the second general application 116 is completed.
[0047] Figure 3 FIG. 4 shows a flowchart of a method 300 for activating a trusted execution environment according to an embodiment of the present invention. The method 300 is executed in the trusted execution environment of a terminal device (such as the aforementioned terminal device 110), for example, by the activation management application 112 in the trusted execution environment. As Figure 3 shown, the method 300 begins with step S310.
[0048] In step S310, the terminal device identifier is sent to the server.
[0049] The terminal device identifier is used to uniquely identify a terminal device. Since the terminal device identifier is unique, it can also be referred to as a device fingerprint. The terminal device identifier can be, for example, information such as the MAC (Media Access Control) address, CPU serial number, hard disk serial number of the terminal device, or a calculation result obtained by processing information such as the MAC address and CPU serial number of the terminal device, but is not limited thereto. The present invention does not limit the specific content of the terminal device identifier. According to one embodiment, the terminal device identifier is obtained by calling a corresponding data interface, which is usually provided by the manufacturer of the terminal device.
[0050] Specifically, step S310 is executed by the activation management application in the trusted execution environment. The activation management application 112 cannot directly communicate with the server, but instead sends the terminal device identifier to the server via the interface application 113 in the rich execution environment.
[0051] According to one embodiment, in addition to sending the terminal device identifier to the server, an authentication code can be generated based on the terminal device identifier and sent to the server together, so that the server can verify the authentication code. After the authentication code is verified successfully, an activation code is generated based on the terminal device identifier.
[0052] According to one embodiment, the authentication code includes a preset key, a first ciphertext, and a first mapping value. Among them, the first ciphertext is the ciphertext generated by encrypting the session key and the terminal device identifier using the preset key, and the first mapping value is the value obtained by mapping the session key and the terminal device identifier using a preset mapping function. According to one embodiment, the preset key is one of the configuration information of the activation management application 112. Correspondingly, the value of the preset key can be read from the configuration information of the activation management application. The session key is generated by the terminal device. For example, it is generated by the activation management application 112. According to one embodiment, when the activation management application 112 communicates with the server, the activation management application 112 generates a token for this communication. The token includes the preset key read from the configuration information and the generated session key. Based on the preset key and the session key in the token, the first ciphertext can be determined, and then the authentication code can be generated. Those skilled in the art can understand that in addition to the preset key and the session key, the token can also include other information, such as the application identifier of the activation management application 112, the version number of the activation management application 112, the use of the preset key, the type of the preset key, etc. The present invention does not limit the specific information included in the token.
[0053] In addition, it should be noted that the encryption algorithm used to generate the first ciphertext and the mapping function used to generate the first mapping value can both be set by those skilled in the art, and the present invention does not limit this. For example, the encryption algorithm used to generate the first ciphertext can be the AES encryption algorithm, and the mapping function used to generate the first mapping value can be the hash algorithm, but it is not limited to this.
[0054] After generating the authentication code, the authentication code and the terminal device identifier are sent to the server together, so that the server can verify the authentication code, recover the session key from it, and ensure that the authentication code and the terminal device identifier are not intercepted or maliciously tampered with during the transmission process. According to one embodiment, the server can verify the authentication code according to the following method:
[0055] Read the pre - set key from the authentication code, and use the pre - set key to decrypt the first ciphertext in the authentication code to obtain the session key and the terminal device identifier. Subsequently, use a preset mapping function to calculate the second mapping value of the session key and the terminal device identifier. If the second mapping value is consistent with the first mapping value in the authentication code, the authentication code is verified successfully.
[0056] Those skilled in the art can understand that in order for the server to verify the authentication code, it is necessary to disclose some algorithm parameters between the terminal device and the server, such as the encryption algorithm used to generate the first ciphertext, the mapping function used to generate the first mapping value, etc. These parameters can be agreed upon in advance between the terminal device and the server before the terminal device transmits the terminal device identifier and the authentication code to the server; or these parameters can be used as fields of the authentication code and transmitted to the server together with the authentication code; etc. The present invention does not limit the specific method for the terminal device and the server to synchronize the algorithm parameters.
[0057] Table 1 shows an example of the authentication code AuthCode1 during the activation process of the trusted execution environment:
[0058] Table 1
[0059]
[0060] In Table 1, the pre - set key is Provisioning Key1, and the first ciphertext is Provisioning_Key_Encrypt(Session Key + Dev_FP), that is, the first ciphertext is the ciphertext obtained by encrypting the session key Session Key and the terminal device identifier Dev_FP using the pre - set key Provisioning Key1. The first mapping value is Hash_Sha256(Session Key + Dev_FP), that is, the first mapping value is the hash value of the session key Session Key and the terminal device identifier Dev_FP calculated using the SHA256 algorithm.
[0061] Those skilled in the art can understand that in practice, in addition to the fields listed in Table 1, the authentication code AuthCode1 can also include other fields, such as the application identifier of the activation management application 112, the version number of the activation management application 112, the purpose of the pre - set key, the type of the pre - set key, etc. The present invention does not limit the number and types of fields included in the authentication code.
[0062] After sending the authentication code AuthCode1 and the terminal device identifier Dev_FP shown in Table 1 to the server, the server will verify the authentication code: First, read the pre-set key Provisioning Key1 from the authentication code AuthCode1. Subsequently, use Provisioning Key1 to decrypt the first ciphertext Provisioning_Key_Encrypt(Session Key+Dev_FP) to recover the session key Session Key. Finally, use the SHA256 algorithm to calculate the hash value of the recovered session key Session Key and the terminal device identifier Dev_FP. If the hash value is consistent with the first mapped value in AuthCode1, the verification of AuthCode1 is successful.
[0063] Subsequently, in step S320, receive the activation information returned by the server. The activation information includes the encrypted trusted identity identifier, the trusted key, and the activation code. Among them, the trusted identity identifier and the trusted key correspond to the terminal device identifier, and the activation code is generated according to the terminal device identifier.
[0064] The trusted identity identifier and the trusted key are generated by the server. The server generates the trusted identity identifier and the trusted key and stores them associated with the terminal device identifier. The trusted identity identifier is a string that can represent the uniqueness of the device, used to uniquely identify a terminal device, and it has the security attributes of being tamper-proof, non-forgeable, and globally unique. The trusted key is a string derived from the trusted identity identifier through a specific algorithm, and it is used to encrypt the key information related to the terminal device corresponding to the trusted identity identifier.
[0065] The activation code is generated according to the terminal device identifier and is used to activate the trusted execution environment of the terminal device. According to one embodiment, the activation code includes the usage permission information and the verification information of the trusted execution environment.
[0066] The usage permission information of the trusted execution environment is used to mark the usage permissions of the trusted execution environment. The usage permission information may include, for example, an effective time, an expiration time, the number of available uses, etc., but is not limited thereto. When the usage permission information includes an effective time and an expiration time, the terminal device can only normally use the trusted execution environment within the time range from the effective time to the expiration time. Outside the time range from the effective time to the expiration time, the trusted execution environment of the terminal device is in an inactive state and the trusted execution environment is unavailable. When the usage permission information includes the number of available uses, the terminal device can only call the trusted execution environment within the number of available uses. If the number of times the terminal device calls the trusted execution environment reaches the number of available uses, the trusted execution environment will be in an inactive state and the trusted execution environment is unavailable. Those skilled in the art can understand that the usage permission information can be configured, which may include at least one of an effective time, an expiration time, and the number of available uses, or may also include other information other than the effective time, the expiration time, and the number of available uses. The present invention does not limit the specific content included in the usage permission information.
[0067] The verification information is used to verify the activation code to ensure that the activation code has not been illegally tampered with. According to one embodiment, the verification information includes a ciphertext generated by encrypting the trusted identity identifier, the usage permission information, and the terminal device identifier using a trusted key. The present invention does not limit the specific encryption algorithm used to generate the verification information. For example, the encryption algorithm used to generate the verification information may be, for example, the HMAC (Hash-based Message Authentication Code) algorithm, but is not limited thereto.
[0068] Table 2 shows an example of the activation code ActiCode:
[0069] Table 2
[0070]
[0071] In Table 2, the usage permission information includes an effective time Stime1, an expiration time Etime1, and the number of available uses Times1. The verification information is HMAC(IDkey,Dev_FP+ID+Stime1+Etime1+Times1), that is, the verification information is a message digest generated by encrypting the terminal device identifier Dev_FP, the trusted identity identifier ID, the effective time Stime1, the expiration time Etime1, and the number of available uses Times1 using the trusted key IDkey based on the HMAC algorithm.
[0072] Those skilled in the art can understand that, in practice, in addition to the fields listed in Table 2, the activation code ActiCode may also include other fields, such as the algorithm used to encrypt the activation code ActiCode using the trusted key IDkey, the key checksum value KCV (Key Checksum Value) used to verify whether the trusted key IDkey has been tampered with, and the algorithm for generating the key checksum value KCV, etc. The present invention does not limit the number and types of fields included in the activation code.
[0073] In step S320, the activation information includes the encrypted trusted identity, trusted key and activation code. According to one embodiment, the activation information can be generated according to the following steps: encrypting the activation code with a trusted key to generate an activation code ciphertext; encrypting the trusted identity, trusted key and activation code ciphertext with a session key to generate activation information. The session key is determined in advance by the terminal device and the server. For example, the session key can be agreed upon in advance by the terminal device and the server before the terminal device transmits the terminal device identification and authentication code to the server; for another example, referring to Table 1, the session key Session Key can be implicit in the authentication code AuthCode1 and passed to the server; etc. The present invention does not limit the generation of the session key and the method of transmitting the session key between the terminal device and the server. In addition, the encryption algorithm used to generate the activation code ciphertext and generate the activation information can be any encryption algorithm, and the present invention does not limit this.
[0074] Taking Table 1 and Table 2 as examples, the steps for generating activation information are as follows: First, the activation code ActiCode is encrypted using the trusted key IDkey to generate the activation code ciphertext ActiCode'. Subsequently, the session key Session Key determined from the authentication code AuthCode1 is used to encrypt the trusted identity ID, the trusted key IDkey, and the activation code ciphertext ActiCode' to generate activation information.
[0075] After receiving the activation information in step S320, step S330 is executed.
[0076] In step S330, the activation information is decrypted to obtain a trusted identity, a trusted key and an activation code.
[0077] The process of decrypting the activation information is the opposite of the process of encrypting and generating the activation information on the server side. According to one embodiment, the activation information is decrypted in the following steps: first, the activation information is decrypted using the session key to obtain the trusted identity, the trusted key, and the activation code ciphertext; then, the activation code ciphertext is decrypted using the trusted key to obtain the activation code.
[0078] Taking Table 2 as an example, the decryption process of the activation information is as follows: First, the session key Session Key is used to decrypt the activation information to obtain the trusted identity identifier ID, the trusted key IDkey, and the activation code ciphertext ActiCode’. Subsequently, the trusted key IDkey is used to decrypt the activation code ciphertext ActiCode’ to obtain the activation code ActiCode.
[0079] After obtaining the trusted identity identifier, the trusted key, and the activation code in step S330, step S340 is executed.
[0080] In step 340, the trusted identity identifier, the trusted key, and the activation code are encrypted and stored in the secure storage space. The data in the secure storage space can only be read by the activation management application 112 in the trusted execution environment, ensuring that the data therein cannot be illegally obtained or tampered with.
[0081] According to one embodiment, after obtaining the trusted identity identifier, the trusted key, and the activation code in step S330, instead of directly encrypting and storing the trusted identity identifier, the trusted key, and the activation code in the secure storage space, the activation code is first verified according to the terminal device identifier to ensure that the activation information has not been illegally tampered with during the transmission between the server and the terminal device. After the activation code is verified to be passed, the trusted identity identifier, the trusted key, and the activation code are encrypted and stored in the secure storage space.
[0082] According to one embodiment, the activation code can be verified according to the following steps: The trusted key is used to encrypt the trusted identity identifier, the usage permission information, and the terminal device identifier to generate a second ciphertext; if the second ciphertext is consistent with the verification information in the activation code, the activation code is verified to be passed.
[0083] Taking Table 2 as an example, the verification process of the activation code ActiCode is as follows: The terminal device identifier Dev_FP is obtained (for example, through the data interface provided by the terminal device manufacturer). Based on the HMAC algorithm, the trusted key IDkey is used to encrypt the terminal device identifier Dev_FP, the trusted identity identifier ID, the effective time Stime1, the expiration time Etime1, and the available times Times1 to generate a second ciphertext. If the second ciphertext is consistent with the verification information in the activation code, the activation code is verified to be passed. Otherwise, the verification fails.
[0084] After the trusted identity identifier, the trusted key, and the activation code are encrypted and stored in the secure storage space 111, the activation of the trusted execution environment of the terminal device is completed. The trusted identity identifier, the trusted key, and the activation code in the secure storage space 111 can only be read by the activation management application 112 in the trusted execution environment.
[0085] Figure 4The figure shows a schematic diagram of the activation process of a trusted execution environment according to an embodiment of the present invention. Figure 4 In this, the secure storage space 111, the activation management application 112, and the interface application 113 are all located in the terminal device 110. The activation management application 112 is a trusted application in the trusted execution environment, and the interface application 113 is an ordinary application in the rich execution environment.
[0086] In step S401, the user triggers the activation management application 112 through the interface application 113 to perform activation verification of the trusted execution environment.
[0087] In steps S402 and S403, the activation management application 112 reads the activation code ActiCode of the trusted execution environment from the secure storage space 111, verifies ActiCode, and sends the verification result to the interface application 113 in step S404. If ActiCode is not stored in the secure storage space 111 or the activation management application 112 fails to verify ActiCode, then in step S404, the activation management application 112 will return the result that the trusted execution environment is not activated to the interface application 113. Subsequently, step S405 is executed.
[0088] In step S405, the interface application 113 triggers the activation management application 112 to activate the trusted execution environment.
[0089] In step S406, the activation management application 112 obtains the terminal device identifier Dev_FP through the interface provided by the terminal device manufacturer, obtains the preset key Provisioning Key1, and generates the session key Session Key.
[0090] In step S407, the activation management application 112 generates the authentication code AuthCode1 according to the terminal device identifier Dev_FP. As shown in Table 1 above, AuthCode1 includes the preset key Provisioning Key1, the first ciphertext Provisioning_Key_Encrypt(Session Key + Dev_FP), and the first mapping value Hash_Sha256(Session Key + Dev_FP).
[0091] In step S408, the activation management application 112 sends the terminal device identifier Dev_FP and the authentication code AuthCode1 to the interface application 113.
[0092] In step S409, the interface application 113 sends the terminal device identifier Dev_FP and the authentication code AuthCode1 to the server 120.
[0093] In step S410, the server 120 verifies the authentication code AuthCode1: First, the pre - set key Provisioning Key1 is read from the authentication code AuthCode1. Subsequently, the first ciphertext Provisioning_Key_Encrypt(Session Key + Dev_FP) is decrypted using Provisioning Key1 to recover the session key SessionKey. Finally, the SHA256 algorithm is used to calculate the hash value of the recovered session key Session Key and the terminal device identifier Dev_FP. If the hash value is consistent with the first mapping value in AuthCode1, the verification of AuthCode1 is successful. Subsequently, step S411 is executed.
[0094] In step S411, the server 120 generates a trusted identity identifier ID and a trusted key IDkey, and stores the trusted identity identifier ID and the trusted key IDkey in an associated manner with the terminal device identifier Dev_FP.
[0095] In step S412, the server 120 generates an activation code ActiCode according to the terminal device identifier Dev_FP. As shown in Table 2, ActiCode includes an effective time Stime1, an expiration time Etime1, the number of available times Times1, and verification information HMAC(IDkey, Dev_FP + ID + Stime1 + Etime1 + Times1). The activation code ActiCode is encrypted using the trusted key IDkey to generate an activation code ciphertext ActiCode'; the trusted identity identifier ID, the trusted key IDkey, and the activation code ciphertext ActiCode' are encrypted using the session key Session Key to generate activation information.
[0096] In step S413, the server 120 sends the activation information to the interface application 113.
[0097] In step S414, the interface application 113 sends the activation information to the activation management application 112.
[0098] In step S415, the activation management application 112 decrypts the activation information using the session key Session Key to obtain the trusted identity identifier ID, the trusted key IDkey, and the activation code ciphertext ActiCode'. Subsequently, the activation code ciphertext ActiCode' is decrypted using the trusted key IDkey to obtain the activation code ActiCode.
[0099] In step S416, the activation management application 112 obtains the terminal device identifier Dev_FP through the data interface provided by the manufacturer of the terminal device. Based on the HMAC algorithm, the trusted key IDkey is used to encrypt the terminal device identifier Dev_FP, the trusted identity identifier ID, the effective time Stime1, the expiration time Etime1, and the available times Times1 to generate a second ciphertext. If the second ciphertext is consistent with the verification information in the activation code, the activation code verification passes, and step S417 is executed.
[0100] In steps S417 and S418, the activation management application 112 encrypts and stores the trusted identity identifier ID, the trusted key IDkey, and the activation code ActiCode in the secure storage space 111, and the trusted execution environment is successfully activated.
[0101] In step S419, the activation management application 112 feeds back the result of successful activation of the trusted execution environment to the interface application 113.
[0102] Figure 5 The flowchart of the activation method 500 of the trusted execution environment according to an embodiment of the present invention is shown. The method 500 is executed in a server (such as Figure 1 the server 120 shown), corresponding to the method 300 executed in the terminal device described above. As Figure 5 shown, the method 500 starts from step S510.
[0103] In step S510, the server receives the terminal device identifier sent by the terminal device.
[0104] Since the activation management application 112 cannot directly communicate with the server and needs to communicate with the server via the interface application 113 in the rich execution environment, in step S510, the server receives the terminal device identifier from the interface application 113.
[0105] According to one embodiment, in step S510, in addition to receiving the terminal device identifier, the server also receives the authentication code sent by the terminal device, and the authentication code is generated according to the terminal device identifier. The authentication code is verified, and after the authentication code verification passes, step S520 is executed to generate the activation code according to the terminal device identifier.
[0106] According to an embodiment, the authentication code includes a preset key, a first ciphertext, and a first mapping value. The first ciphertext is a ciphertext generated by encrypting the session key and the terminal device identifier using the preset key, and the first mapping value is a value obtained by mapping the session key and the terminal device identifier using a preset mapping function. Correspondingly, the server can verify the authentication code according to the following method: read the preset key from the authentication code, and use the preset key to decrypt the first ciphertext in the authentication code to obtain the session key and the terminal device identifier. Subsequently, use the preset mapping function to calculate the second mapping value of the session key and the terminal device identifier. If the second mapping value is consistent with the first mapping value in the authentication code, the authentication code is verified successfully.
[0107] For the specific implementation steps of generating and verifying the authentication code, reference can be made to the relevant description of step S310 above, which will not be elaborated here.
[0108] Subsequently, in step S520, a trusted identity identifier and a trusted key corresponding to the terminal device identifier are generated, and an activation code is generated according to the terminal device identifier.
[0109] The trusted identity identifier is used to uniquely identify a terminal device, and it has security attributes such as non-tamperable, non-forgeable, and globally unique. The trusted key is a key corresponding to the trusted identity identifier, which is used to encrypt critical information. The server can generate the trusted identity identifier and the trusted key according to any algorithm, and the present invention does not limit the specific algorithm used to generate the trusted identity identifier and the trusted key. After generating the trusted identity identifier and the trusted key, they are stored in an associated manner.
[0110] The activation code is generated according to the terminal device identifier and is used to activate the trusted execution environment of the terminal device. According to an embodiment, the activation code includes usage permission information and verification information of the trusted execution environment.
[0111] The usage permission information of the trusted execution environment is used to mark the usage permission of the trusted execution environment. The usage permission information may include, for example, an effective time, an expiration time, the number of available times, etc., but is not limited thereto.
[0112] The verification information is used to verify the activation code to ensure that the activation code has not been illegally tampered with. According to an embodiment, the verification information includes a ciphertext generated by encrypting the trusted identity identifier, the usage permission information, and the terminal device identifier using the trusted key. The present invention does not limit the specific encryption algorithm used to generate the verification information. For example, the encryption algorithm used to generate the verification information may be the HMAC algorithm, but is not limited thereto. An example of the activation code ActiCode can be referred to the aforementioned Table 2, which will not be elaborated here.
[0113] Subsequently, in step S530, the trusted identity identifier, the trusted key, and the activation code are encrypted to generate activation information.
[0114] According to one embodiment, the activation code is encrypted using the trusted key to generate an activation code ciphertext; the trusted identity identifier, the trusted key, and the activation code ciphertext are encrypted using the session key to generate the activation information. The specific generation steps of the activation information can refer to the relevant description of step S320 above and will not be elaborated here.
[0115] Subsequently, in step S540, the activation information is sent to the terminal device so that the terminal device: decrypts the activation information to obtain the trusted identity identifier, the trusted key, and the activation code, and encrypts and stores the trusted identity identifier, the trusted key, and the activation code in the secure storage space.
[0116] The specific implementation process of step S540 can refer to the relevant descriptions of steps S330 and 340 above and will not be elaborated here.
[0117] An ordinary application in the rich execution environment can call a trusted application in the trusted execution environment. When the trusted application is called, the called trusted application will further call the activation management application 112 to trigger the activation verification of the trusted execution environment.
[0118] Figure 6 The flowchart of the activation verification method 600 of the trusted execution environment according to an embodiment of the present invention is shown. The method 600 is executed in the trusted execution environment of the terminal device. For example, it is executed by the activation management application 112 in the trusted execution environment. As Figure 6 shown, the method 600 starts from step S610.
[0119] In step S610, the trusted identity identifier, the trusted key, and the activation code of the trusted execution environment are obtained. The activation code includes the usage permission information and the verification information of the trusted execution environment. The verification information includes the ciphertext generated by encrypting the trusted identity identifier, the usage permission information, and the terminal device identifier using the trusted key.
[0120] According to an embodiment, the activation management application 112 reads the trusted identity ID, the trusted key IDkey, and the activation code ActiCode of the trusted execution environment from the secure storage space 111. The activation code ActiCode further includes usage permission information. For example, as shown in Table 2, the activation code ActiCode includes three items of usage permission information: the effective time Stime1, the expiration time Etime1, and the available times Times1, as well as the verification information HMAC(IDkey, Dev_FP + ID + Stime1 + Etime1 + Times1). The verification information is a message digest generated by encrypting the terminal device identifier Dev_FP, the trusted identity ID, the effective time Stime1, the expiration time Etime1, and the available times Times1 using the trusted key IDkey based on the HMAC algorithm.
[0121] Subsequently, in step S620, the terminal device identifier is obtained, and the trusted identity, the usage permission information, and the terminal device identifier are encrypted using the trusted key to generate a third ciphertext.
[0122] According to an embodiment, the terminal device identifier Dev_FP is obtained through the data interface provided by the manufacturer of the terminal device. Based on the HMAC algorithm, the trusted identity ID, the effective time Stime1, the expiration time Etime1, the available times Times1, and the terminal device identifier Dev_FP are encrypted using the trusted key IDkey to generate a third ciphertext.
[0123] Subsequently, in step S630, if the third ciphertext is consistent with the verification information and the current usage environment of the terminal device matches the usage permission information, the activation of the trusted execution environment is successful.
[0124] For example, the usage permission information includes the effective time, the expiration time, and the available times. Correspondingly, the current usage environment of the terminal device includes information such as time and the used times. If the current time of the terminal device is within the range of the effective time to the expiration time and the used times are less than or equal to the available times, the current usage environment of the terminal device matches the usage permission information.
[0125] Figure 7 Shows a schematic diagram of the activation verification process of the trusted execution environment according to an embodiment of the present invention. Figure 7 In, the secure storage space 111, the activation management application 112, the first trusted application 115, and the first ordinary application 114 are all located in the terminal device 110. The activation management application 112 and the first trusted application 115 are trusted applications in the trusted execution environment, and the first ordinary application 114 is an ordinary application in the rich execution environment.
[0126] In step S701, the first ordinary application 114 initiates a call request to the first trusted application 115.
[0127] In step S702, the first trusted application 115 triggers the activation management application 112 to perform activation verification of the trusted execution environment.
[0128] In steps S703 and S704, the activation management application 112 reads the trusted identity ID, the trusted key IDkey, and the activation code ActiCode of the trusted execution environment from the secure storage space 111. As shown in Table 2, ActiCode includes the effective time Stime1, the expiration time Etime1, the available times Times1, and the verification information HMAC(IDkey, Dev_FP + ID + Stime1 + Etime1 + Times1).
[0129] In step S705, the activation management application 112 obtains the terminal device identifier Dev_FP through the data interface provided by the manufacturer of the terminal device. Based on the HMAC algorithm, the trusted key IDkey is used to encrypt the trusted identity ID, the effective time Stime1, the expiration time Etime1, the available times Times1, and the terminal device identifier Dev_FP to generate the third ciphertext. If the third ciphertext is consistent with the verification information in the activation code, the activation code verification passes, and the trusted execution environment has been activated.
[0130] In step S706, the activation management application 112 sends the result that the trusted execution environment has been activated to the first trusted application 115.
[0131] In step S707, the first trusted application 115 executes the call requested by the first ordinary application 114.
[0132] In step S708, the first trusted application 115 returns the call result to the first ordinary application 114.
[0133] Based on the activation of the trusted execution environment, the trusted execution environment can provide application activation and activation verification services to other applications of the terminal device 110, thereby ensuring the security of other applications.
[0134] Figure 8 The flowchart of an application activation method 800 based on a trusted execution environment according to an embodiment of the present invention is shown. The method 800 is executed in the trusted execution environment of the terminal device. For example, it is executed by the activation management application 112 in the trusted execution environment. The method 200 can be used to activate ordinary applications in the rich execution environment, such as Figure 2 the second ordinary application 116 shown in Figure 8 As shown, the method 800 starts from step S810.
[0135] In step S810, the trusted identity identifier of the terminal device is sent to the server.
[0136] The trusted identity identifier is stored in the secure storage space 111 of the terminal device and can only be read by specific trusted applications in the trusted execution environment, such as the activation management application 112. After the activation management application 112 obtains the trusted identity identifier, it sends the trusted identity identifier to the server 120 through the application to be activated in the rich execution environment (such as Figure 2 the second ordinary application 116 in).
[0137] According to one embodiment, before sending the trusted identity identifier to the server, it is necessary to first verify whether the trusted execution environment is successfully activated; in the case where the trusted execution environment is successfully activated, the trusted identity identifier of the terminal device is then sent to the server.
[0138] Specifically, the steps shown in the foregoing method 600 can be used to verify whether the trusted execution environment is successfully activated. If the trusted execution environment is successfully activated, the trusted execution environment is available, and the application to be activated can be activated based on the trusted execution environment. If the trusted execution environment fails to be activated, the trusted execution environment is unavailable. At this time, it is necessary to first execute the foregoing method 300 to activate the trusted execution environment, and only after the trusted execution environment is activated can the method 800 of the present invention be executed.
[0139] According to one embodiment, in addition to sending the trusted identity identifier to the server in step S810, an authentication code is generated according to the trusted identity identifier, and the authentication code and the trusted identity identifier are sent to the server together, so that the server can verify the authentication code. After the authentication code is verified, a registration code is generated according to the trusted identity identifier.
[0140] According to one embodiment, the authentication code includes a preset key, a fourth ciphertext, and a third mapping value. Among them, the fourth ciphertext is the ciphertext generated by encrypting the trusted identity identifier with the preset key, and the third mapping value is the value obtained by mapping the trusted identity identifier using a preset mapping function. According to one embodiment, the preset key is one of the configuration information for activating the management application 112. Correspondingly, the value of the preset key can be read from the configuration information of the activation management application. According to one embodiment, when the activation management application 112 communicates with the server, the activation management application 112 generates a token for this communication, and the token includes the preset key read from the configuration information. Based on the preset key in the token, the fourth ciphertext can be determined, and then the authentication code can be generated. Those skilled in the art can understand that in addition to the preset key and the session key, the token may also include other information, such as the application identifier of the activation management application 112, the version number of the activation management application 112, the use of the preset key, the type of the preset key, etc. The present invention does not limit the specific information included in the token.
[0141] In addition, it should be noted that the encryption algorithm used to generate the fourth ciphertext and the mapping function used to generate the third mapping value can both be set by those skilled in the art themselves, and the present invention does not limit this. For example, the encryption algorithm used to generate the fourth ciphertext can be the AES encryption algorithm, and the mapping function used to generate the third mapping value can be the hash algorithm, but it is not limited to this.
[0142] After generating the authentication code, the authentication code and the trusted identity identifier are sent to the server together, so that the server can verify the authentication code to ensure that the authentication code and the trusted identity identifier have not been tampered with during the transmission process. According to one embodiment, the server can verify the authentication code according to the following method:
[0143] Read the preset key from the authentication code, decrypt the fourth ciphertext with the preset key to obtain the trusted identity identifier, use the preset mapping function to calculate the fourth mapping value of the trusted identity identifier. If the fourth mapping value is consistent with the third mapping value in the authentication code, the authentication code verification passes.
[0144] Table 3 shows an example of the authentication code AuthCode2 during the application activation process based on the trusted execution environment:
[0145] Table 3
[0146] Provisioning Key Fourth Ciphertext Third Mapping Value Provisioning Key2 Provisioning_Key_Encrypt(ID) Hash_Sha256(ID)
[0147] In Table 3, the pre - set key is Provisioning Key2, and the fourth ciphertext is Provisioning_Key_Encrypt(ID). That is, the fourth ciphertext is the ciphertext obtained by encrypting the trusted identity identifier ID with the pre - set key Provisioning Key2. The third mapping value is Hash_Sha256(ID). That is, the third mapping value is the hash value of the trusted identity identifier ID calculated using the SHA256 algorithm.
[0148] Those skilled in the art can understand that in practice, in addition to the fields listed in Table 3, the authentication code AuthCode2 may also include other fields, such as the application identifier for activating the management application 112, the version number of the activation management application 112, the purpose of the pre - set key, the type of the pre - set key, etc. The present invention places no restrictions on the number and types of fields included in the authentication code.
[0149] After sending the authentication code AuthCode2 shown in Table 3 to the server, the server will verify the authentication code: First, read the pre - set key Provisioning Key2 from the authentication code AuthCode2. Subsequently, use Provisioning Key2 to decrypt the fourth ciphertext Provisioning_Key_Encrypt(ID) to obtain the trusted identity identifier ID. Finally, use the SHA256 algorithm to calculate the hash value of the trusted identity identifier ID. If the hash value is consistent with the third mapping value in AuthCode2, then the AuthCode2 verification is successful.
[0150] Subsequently, in step S820, receive the registration information returned by the server. The registration information includes the registration code encrypted with the trusted key corresponding to the trusted identity identifier, and the registration code is generated according to the trusted identity identifier.
[0151] The registration code is generated according to the trusted identity identifier and is used to activate the application to be activated. According to one embodiment, the registration code includes the usage permission information and verification information of the application to be activated.
[0152] The usage permission information of the application is used to mark the usage permissions of the application. The usage permission information may include, for example, an effective time, an expiration time, the number of available uses, etc., but is not limited thereto. When the usage permission information includes an effective time and an expiration time, the user can only normally use the application within the time range from the effective time to the expiration time. Outside the time range from the effective time to the expiration time, the application is unavailable. When the usage permission information includes the number of available uses, the user can only use the application within the number of available uses. If the number of times the user uses the application reaches the number of available uses, the application is no longer available. Those skilled in the art can understand that the usage permission information can be configured, which may include at least one of an effective time, an expiration time, and the number of available uses, or may include other information other than an effective time, an expiration time, and the number of available uses. The present invention does not limit the specific content included in the usage permission information of the application.
[0153] The verification information is used to verify the registration code to ensure that the registration code has not been illegally tampered with. According to one embodiment, the verification information includes a ciphertext generated by encrypting a trusted identity identifier and usage permission information using a trusted key. The present invention does not limit the specific encryption algorithm used to generate the verification information. For example, the encryption algorithm used to generate the verification information may be, for example, the HMAC (Hash-based Message Authentication Code) algorithm, but is not limited thereto.
[0154] Table 4 shows an example of the registration code License:
[0155] Table 4
[0156]
[0157] In Table 4, the usage permission information of the application includes an effective time Stime2, an expiration time Etime2, and the number of available uses Times2. The verification information is HMAC(IDkey, ID + Stime2 + Etime2 + Times2), that is, the verification information is a message digest generated by encrypting the trusted identity identifier ID, the effective time Stime2, the expiration time Etime2, and the number of available uses Times2 using the trusted key IDkey based on the HMAC algorithm.
[0158] In step S820, the registration information includes a registration code encrypted using the trusted key corresponding to the trusted identity identifier. That is, the server first determines the trusted key corresponding to the trusted identity identifier, and then encrypts the registration code using the trusted key to generate the registration information.
[0159] It should be noted that the process of encrypting the registration code to generate the registration information in method 800 is slightly different from the process of encrypting the activation code to generate the activation information in method 300. In method 300, the activation code is encrypted twice with the trusted key and the session key; in method 800, the registration code is only encrypted once with the trusted key. This is because in method 300, the trusted key is generated for the first time, and the trusted key needs to be sent to the terminal device together with the activation code. In order to ensure that the trusted key is not intercepted or tampered with, after encrypting the activation code with the trusted key, the session key is also used to encrypt the trusted key to make the trusted key invisible to the outside. In method 800, the trusted key is not transmitted, but only stored in the terminal device and the server respectively. Even if other devices eavesdrop on the registration information transmitted between the terminal device and the server, since they cannot obtain the trusted key, they cannot decrypt the registration information to obtain the registration code. Therefore, in method 800, only encrypting the registration code with the trusted key once can ensure the security of the registration code, and there is no need to use the session key for secondary encryption.
[0160] Subsequently, in step S830, the trusted key is used to decrypt the registration information to obtain the registration code.
[0161] Subsequently, in step S840, the registration code is encrypted and stored in the secure storage space. The data in the secure storage space can only be read by the activation management application 112 in the trusted execution environment, ensuring that the data therein cannot be illegally obtained or tampered with.
[0162] According to an embodiment, after obtaining the registration code in step S830, instead of directly encrypting and storing the registration code in the secure storage space, the registration code is first verified according to the trusted identity identifier to ensure that the registration information has not been illegally tampered with during the transmission process between the server and the terminal device. After the registration code is verified, it is encrypted and stored in the secure storage space.
[0163] According to an embodiment, the registration code can be verified according to the following steps: the trusted key is used to encrypt the trusted identity identifier and the usage permission information to generate the fifth ciphertext; if the fifth ciphertext is consistent with the verification information in the registration code, the registration code is verified.
[0164] Taking Table 4 as an example, the verification process of the registration code License is as follows: obtain the trusted key IDkey, and based on the HMAC algorithm, use the trusted key IDkey to encrypt the trusted identity identifier ID, the effective time Stime2, the expiration time Etime2, and the available times Times2 to generate the fifth ciphertext. If the fifth ciphertext is consistent with the verification information in the registration code, the registration code is verified. Otherwise, the verification fails.
[0165] After the registration code of the application to be activated is encrypted and stored in the secure storage space 111, the activation of the application to be activated is completed. The registration code in the secure storage space 111 can only be read by the activation management application 112 in the trusted execution environment.
[0166] Figure 9 The figure shows a schematic diagram of an application activation process based on a trusted execution environment according to an embodiment of the present invention. Figure 9 In it, the secure storage space 111, the activation management application 112, and the second ordinary application 116 are located in the terminal device. The activation management application 112 is a trusted application in the trusted execution environment, and the second ordinary application 116 is the application to be activated in the rich execution environment. The application server 122 and the authentication server 124 are located on the server side. The application server 122 is used to provide method and data calls to the second ordinary application 116 and generate usage permission information (such as effective time, expiration time, available times, etc.) of the second ordinary application 116. The authentication server 124 is used to verify the identity of the terminal device 110 and encrypt relevant data, etc.
[0167] In step S901, the second ordinary application 116 sends a request to initialize the trusted execution environment to the activation management application 112. Based on this request, the activation management application 112 performs activation verification on the trusted execution environment. If the activation verification of the trusted execution environment is successful, step S902 is executed.
[0168] In steps S902 and S903, the activation management application 112 reads the trusted identity ID and the trusted key IDkey from the secure storage space 111.
[0169] In step S904, the activation management application 112 generates an authentication code AuthCode2 according to the trusted identity ID. As shown in Table 3 above, AuthCode2 includes a preset key Provisioning Key2, a fourth ciphertext Provisioning_Key_Encrypt(ID), and a third mapping value Hash_Sha256(ID).
[0170] In step S905, the activation management application 112 sends the trusted identity ID and the authentication code AuthCode2 to the second ordinary application 116.
[0171] In step S906, the second ordinary application 116 sends the trusted identity ID and the authentication code AuthCode2 to the application server 122.
[0172] In step S907, the application server 122 sends the trusted identity ID and the authentication code AuthCode2 to the authentication server 124.
[0173] In step S908, the authentication server 124 verifies the authentication code AuthCode2: First, the pre - set key Provisioning Key2 is read from the authentication code AuthCode2. Subsequently, the fourth ciphertext Provisioning_Key_Encrypt(ID) is decrypted using Provisioning Key2 to obtain the trusted identity identifier ID. Finally, the SHA256 algorithm is used to calculate the hash value of the trusted identity identifier ID. If the hash value is consistent with the third mapping value in AuthCode2, then the verification of AuthCode2 is successful.
[0174] In step S909, the authentication server 124 returns the result that the verification of the authentication code AuthCode2 is successful to the application server 122.
[0175] In step S910, the application server 122 generates the usage permission information for the second ordinary application 116. Refer to Table 4. The usage permission information includes the effective time Stime2, the expiration time Etime2, and the available times Times2.
[0176] In step S911, the application server 122 sends the generated usage permission information to the authentication server 124.
[0177] In step S912, the authentication server 124 generates the verification information. Refer to Table 4. The verification information is HMAC(IDkey, ID + Stime2 + Etime2 + Times2). Subsequently, the usage permission information and the verification information are combined to form the registration code License. The trusted key IDkey corresponding to the trusted identity identifier ID is found, and License is encrypted using IDkey to generate the registration information.
[0178] In steps S913 - S915, the authentication server 124 sends the registration information to the activation management application 112 through the application server 122 and the second ordinary application 116 in sequence.
[0179] In step S916, the activation management application 112 decrypts the registration information using the trusted key IDkey to obtain the registration code License. The trusted identity identifier ID, the effective time Stime2, the expiration time Etime2, and the available times Times2 are encrypted using the trusted key IDkey to generate the fifth ciphertext. If the fifth ciphertext is consistent with the verification information in License, then the registration code verification passes, and step S917 is executed.
[0180] In steps S917 and S918, the activation management application 112 encrypts and stores the registration code License in the secure storage space 111, and the second general application 116 is successfully activated.
[0181] In step S919, the activation management application 112 feeds back the result of successfully activating the second general application 116 to the second general application 116.
[0182] Figure 10 The flowchart of an application activation method 1000 based on a trusted execution environment according to an embodiment of the present invention is shown. The method 100 is executed in a server (such as Figure 2 the server 120 shown), corresponding to the method 800 executed in the terminal device described above, and is suitable for activating an application to be activated (such as Figure 2 the second general application 116 shown).
[0183] According to an embodiment, the server further includes an application server (such as Figure 2 the application server 122 shown) and an authentication server (such as Figure 2 the authentication server 124 shown). The application server and the authentication server cooperate with each other to realize the activation of the application based on the trusted execution environment. The application server can communicate directly with the application to be activated, be used to provide methods and data calls to the application to be activated, and generate usage permission information (such as effective time, expiration time, available times, etc.) of the application to be activated. The authentication server generally does not communicate directly with the application to be activated, and is used to verify the identity of the terminal device 110 and encrypt relevant data, etc.
[0184] As Figure 10 shown, the method 1000 starts from step S1010.
[0185] In step S1010, a trusted identity identifier sent by the terminal device is received.
[0186] The trusted identity identifier is stored in the secure storage space 111 of the terminal device, and it can only be read by a specific trusted application in the trusted execution environment, such as the activation management application 112. After obtaining the trusted identity identifier, the activation management application 112 sends it to the application server through the application to be activated. Correspondingly, the application server receives the trusted identity identifier sent by the application to be activated.
[0187] According to an embodiment, in step S1010, in addition to receiving the trusted identity identifier, an authentication code sent by the terminal device is also received. The authentication code is generated according to the trusted identity identifier. The authentication code is verified, and after the authentication code is verified, step S520 is executed to generate a registration code according to the trusted identity identifier.
[0188] According to an embodiment, after receiving the trusted identity identifier and the authentication code sent by the second ordinary application 116, the application server 122 forwards the trusted identity identifier and the authentication code to the authentication server 124, and the authentication server 124 verifies the authentication code. The specific verification process of the authentication code can refer to the relevant description of the foregoing step S810, which will not be elaborated here.
[0189] Subsequently, in step S1020, a registration code is generated according to the trusted identity identifier.
[0190] According to an embodiment, the registration code includes usage permission information and verification information of the application to be activated. Among them, the usage permission information is used to mark the usage permission of the application, which may include, for example, the effective time, the expiration time, the available number of times, etc., but is not limited thereto. The verification information is used to verify the registration code to ensure that the registration code has not been illegally tampered with. According to an embodiment, the verification information includes the ciphertext generated by encrypting the trusted identity identifier and the usage permission information with the trusted key.
[0191] According to an embodiment, the usage permission information in the registration code is generated by the application server 122. After the application server 122 generates the usage permission information, it sends the usage permission information to the authentication server 124, and the authentication server 124 generates the verification information. The specific generation processes of the usage permission information and the verification information can refer to the relevant description of the foregoing step S820, which will not be elaborated here.
[0192] Subsequently, in step S1030, the registration code is encrypted with the trusted key corresponding to the trusted identity identifier to generate registration information.
[0193] According to an embodiment, step S1030 is executed by the authentication server 124.
[0194] Subsequently, in step S1040, the registration information is sent to the terminal device so that the terminal device: decrypts the registration information with the trusted key to obtain the registration code; and encrypts and stores the registration code in the secure storage space.
[0195] In step S1040, the authentication server 124 sends the registration information to the activation management application 112 in the terminal device through the application 122 and the application to be activated in sequence. The activation management application 112 decrypts the registration information with the trusted key to obtain the registration code; and encrypts and stores the registration code in the secure storage space.
[0196] The specific implementation process of step S1040 can refer to the relevant descriptions of the foregoing steps S830 and S840, which will not be elaborated here.
[0197] When a user uses an application, the activation verification of the application will be triggered. Only when the verification of the application activation is successful, the user can use the application; if the verification of the application activation fails, the application is unavailable to the user.
[0198] Figure 11 1 shows a flow chart of a method 1100 for application activation verification based on a trusted execution environment according to an embodiment of the present invention. The method 1100 is executed in a trusted execution environment of a terminal device, for example, by an activation management application 112 in the trusted execution environment. Figure 11 As shown, method 1100 starts at step S1110.
[0199] In step S1110, a trusted identity, a trusted key and a registration code of the application to be verified are obtained. The registration code includes usage permission information and verification information. The verification information is a ciphertext generated by encrypting the trusted identity and usage permission information with the trusted key.
[0200] According to an embodiment, the activation verification application 112 obtains the trusted identity, the trusted key, and the registration code of the application to be verified from the secure storage space 111 .
[0201] Then, in step S1120, the trusted identity and usage permission information are encrypted using a trusted key to generate a sixth ciphertext.
[0202] Then, in step S1130, if the sixth ciphertext is consistent with the verification information, the registration code is sent to the application to be verified, so that the application can determine whether it is activated successfully according to whether the current usage environment matches the usage permission information.
[0203] For example, the usage permission information includes the effective time, expiration time and available times, and accordingly, the current usage environment of the application includes information such as time, used times, etc. If the current time is within the range of the effective time to the expiration time, and the used times of the application are less than or equal to the available times, then the current usage environment matches the usage permission information, and the application is activated successfully.
[0204] Figure 12 A schematic diagram of an application activation verification process based on a trusted execution environment according to an embodiment of the present invention is shown. Figure 12 In the embodiment, the secure storage space 111, the activation management application 112, and the second common application 116 are all located in the terminal device 110, the activation management application 112 is a trusted application in the trusted execution environment, and the second common application 116 is a common application in the rich execution environment.
[0205] In step S1201 , when a user uses the second general application 116 , the second general application 116 initiates an activation verification request to the activation management application 112 .
[0206] In steps S1202 and S1203, the activation management application 112 obtains the trusted identity identifier ID, the trusted key IDkey, and the activation code ActiCode of the trusted execution environment from the secure storage space 111.
[0207] In step S1204, the activation management application 112 verifies whether the trusted execution environment is successfully activated according to the trusted identity identifier ID, the trusted key IDkey, and the activation code ActiCode. If the trusted execution environment is successfully activated, step S1205 is continued.
[0208] In steps S1205 and S1206, the activation management application 112 obtains the registration code License from the secure storage space 111. Referring to Table 4, License includes the effective time Stime2, the expiration time Etime2, the available times Times2, and the verification information HMAC(IDkey, ID + Stime2 + Etime2 + Times2).
[0209] In step S1207, the activation management application 112 encrypts the trusted identity identifier ID, the effective time Stime2, the expiration time Etime2, and the available times Times2 using the trusted key IDkey to generate the sixth ciphertext. If the sixth ciphertext is consistent with the verification information in License, step S1208 is executed.
[0210] In step S1208, the activation management application 112 sends the registration code to the second general application 116.
[0211] In step S1209, the second general application 116 obtains the current usage environment, which includes the current time and the used times of the second general application 116. The effective time Stime2, the expiration time Etime2, and the available times Times2 in the registration code are read. It is judged whether the current time is within the time range from the effective time Stime2 to the expiration time Etime2, and whether the used times is less than or equal to the available times Times2. If the current time is within the time range from the effective time Stime2 to the expiration time Etime2, and the used times is less than or equal to the available times Times2, the second general application 116 is successfully activated.
[0212] The various technologies described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the methods and apparatuses of the present invention, or certain aspects or portions of the methods and apparatuses of the present invention, may take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into and executed by a machine such as a computer, the machine becomes an apparatus for practicing the present invention.
[0213] In the case where the program code is executed on a programmable computer, the computing device generally includes a processor, a processor-readable storage medium (including volatile and non-volatile memories and / or storage elements), at least one input device, and at least one output device. Among them, the memory is configured to store the program code; the processor is configured to execute the application activation method based on the trusted execution environment of the present invention according to the instructions in the program code stored in the memory.
[0214] By way of example and not limitation, the readable medium includes a readable storage medium and a communication medium. The readable storage medium stores information such as computer-readable instructions, data structures, program modules, or other data. The communication medium generally embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and includes any information delivery medium. A combination of any of the above is also included within the scope of the readable medium.
[0215] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. A variety of general-purpose systems can also be used in conjunction with the examples of the present invention. Based on the above description, the structure required to construct such systems is obvious. In addition, the present invention is not directed to any particular programming language. It should be understood that the content of the present invention described herein can be implemented using a variety of programming languages, and the description of a particular language above is for the purpose of disclosing the best mode of the present invention.
[0216] In the specification provided herein, a large number of specific details are set forth. However, it can be understood that the embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0217] Similarly, it should be understood that, in order to streamline the present disclosure and assist in understanding one or more of the various inventive aspects, in the foregoing description of the exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, the disclosed method should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, the inventive aspects lie in less than all the features of the single foregoing embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate embodiment of the present invention.
[0218] Those skilled in the art should understand that the modules or units or components of the devices in the examples disclosed herein may be arranged in the devices as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or further divided into multiple sub-modules.
[0219] Those skilled in the art can understand that the modules in the devices of the embodiments can be adaptively changed and arranged in one or more devices different from this embodiment. The modules or units or components in the embodiments can be combined into one module or unit or component, and furthermore can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all the features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all the processes or units of any method or device so disclosed. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) can be replaced by an alternative feature that provides the same, equivalent, or similar purpose.
[0220] In addition, those skilled in the art can understand that, although some of the embodiments described herein include certain features included in other embodiments rather than other features, the combination of the features of different embodiments means that it is within the scope of the present invention and forms different embodiments. For example, in the following claims, any one of the claimed embodiments can be used in any combination.
[0221] In addition, some of the embodiments described herein are described as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices performing the functions. Accordingly, a processor having the necessary instructions for implementing the method or method elements forms an apparatus for implementing the method or method elements. In addition, the elements described herein of the apparatus embodiments are examples of apparatuses for performing the functions performed by the elements for the purpose of implementing the invention.
[0222] As used herein, unless otherwise specified, the use of ordinal numbers "first", "second", "third", etc. to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects so described must have a given order in terms of time, space, ranking, or in any other manner.
[0223] Although the invention has been described in terms of a limited number of embodiments, those skilled in the art in this technical field will appreciate that other embodiments can be envisioned within the scope of the invention as thus described. In addition, it should be noted that the language used in this specification has been principally selected for readability and instructional purposes and not for the purpose of explaining or limiting the subject matter of the invention. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. For the scope of the invention, the disclosure of the invention is illustrative and not restrictive, and the scope of the invention is defined by the appended claims.
Claims
1. A method for activating a trusted execution environment, which is executed by an activation management application in the trusted execution environment. The trusted execution environment is deployed in a terminal device. The method includes: Sending the terminal device identifier to the server; Receiving activation information returned by the server. The activation information includes an encrypted trusted identity identifier, a trusted key, and an activation code. The trusted identity identifier and the trusted key correspond to the terminal device identifier, and the activation code is generated based on the terminal device identifier; Decrypting the activation information to obtain the trusted identity identifier, the trusted key, and the activation code; Verifying the activation code according to the terminal device identifier. After the activation code is verified, encrypt and store the trusted identity identifier, the trusted key, and the activation code in a secure storage space. The secure storage space can only be accessed by the activation management application; Wherein, the activation code includes usage permission information and verification information of the trusted execution environment. The verification information includes ciphertext generated by encrypting the trusted identity identifier, the usage permission information, and the terminal device identifier using the trusted key. The usage permission information includes an effective time, an expiration time, and the number of available times; The step of verifying the activation code according to the terminal device identifier includes: Encrypting the trusted identity identifier, the usage permission information, and the terminal device identifier using the trusted key to generate a first ciphertext; If the first ciphertext is consistent with the verification information, the activation code is verified.
2. The method according to claim 1, wherein, The activation information includes ciphertext generated by encrypting the trusted identity identifier, the trusted key, and the activation code ciphertext using a session key. The activation code ciphertext is ciphertext generated by encrypting the activation code using the trusted key.
3. The method according to claim 2, wherein, The step of decrypting the activation information to obtain the trusted identity identifier, the trusted key, and the activation code includes: Decrypting the activation information using the session key to obtain the trusted identity identifier, the trusted key, and the activation code ciphertext; Decrypting the activation code ciphertext using the trusted key to obtain the activation code.
4. The method according to claim 1, further includes: Generating an authentication code according to the terminal device identifier; Sending the authentication code to the server so that the server verifies the authentication code and generates an activation code according to the terminal device identifier after the authentication code is verified.
5. The method according to claim 4, wherein, The authentication code includes a preset key, a second ciphertext, and a first mapping value. The second ciphertext is ciphertext generated by encrypting the session key and the terminal device identifier using the preset key. The first mapping value is a value obtained by mapping the session key and the terminal device identifier using a preset mapping function; The server is adapted to verify the authentication code according to the following method: Use the preset key to decrypt the second ciphertext to obtain the session key and the terminal device identifier, and use the preset mapping function to calculate the second mapping value of the session key and the terminal device identifier. If the second mapping value is the same as the first mapping value, the authentication code verification passes.
6. The method according to claim 1, wherein, the activation management application communicates with the server via an interface application located in the rich execution environment.
7. An activation method for a trusted execution environment, executed by an activation management application in the trusted execution environment, the trusted execution environment being deployed in a terminal device, the method comprises: Receiving a terminal device identifier sent by the terminal device; Generating a trusted identity identifier and a trusted key corresponding to the terminal device identifier, and generating an activation code according to the terminal device identifier; Encrypting the trusted identity identifier, the trusted key and the activation code to generate activation information; Sending the activation information to the terminal device so that the terminal device: decrypts the activation information to obtain the trusted identity identifier, the trusted key and the activation code, and encrypts and stores the trusted identity identifier, the trusted key and the activation code in a secure storage space; The secure storage space can only be accessed by the activation management application; After the step of decrypting the activation information, it further comprises: Verifying the activation code according to the terminal device identifier, and after the activation code verification passes, encrypting and storing the trusted identity identifier, the trusted key and the activation code in a secure storage space; wherein, the activation code includes usage permission information and verification information of the trusted execution environment, the verification information includes ciphertext generated by encrypting the trusted identity identifier, the usage permission information and the terminal device identifier with the trusted key; the usage permission information includes an effective time, an expiration time, and the number of available times; The step of verifying the activation code according to the terminal device identifier includes: Encrypting the trusted identity identifier, the usage permission information and the terminal device identifier with the trusted key to generate a first ciphertext; If the first ciphertext is the same as the verification information, the activation code verification passes.
8. The method according to claim 7, wherein, the activation information is generated according to the following steps: Encrypting the activation code with the trusted key to generate an activation code ciphertext; Encrypting the trusted identity identifier, the trusted key and the activation code ciphertext with a session key to generate activation information.
9. The method according to claim 7, further comprises: Receiving an authentication code sent by the terminal device, the authentication code being generated according to the terminal device identifier; Verifying the authentication code; After the authentication code verification passes, generating an activation code according to the terminal device identifier.
10. The method according to claim 9, wherein, the authentication code includes a preset key, a first ciphertext and a first mapping value, the first ciphertext is ciphertext generated by encrypting the session key and the terminal device identifier with the preset key, and the first mapping value is a value obtained by mapping the session key and the terminal device identifier with a preset mapping function; The steps for verifying the authentication code include: Decrypt the first ciphertext using the preset key to obtain the session key and the terminal device identifier; Use the preset mapping function to calculate the second mapping value of the session key and the terminal device identifier; If the second mapping value is consistent with the first mapping value, the authentication code is verified successfully.
11. An application activation method based on a trusted execution environment, which is executed by an activation management application in the trusted execution environment, and the trusted execution environment is deployed in a terminal device. The method includes: Send the trusted identity identifier of the terminal device to the server; Receive the registration information returned by the server, where the registration information includes a registration code encrypted using the trusted key corresponding to the trusted identity identifier, and the registration code is generated based on the trusted identity identifier; Decrypt the registration information using the trusted key to obtain the registration code; Verify the registration code according to the trusted identity identifier. After the registration code is verified successfully, encrypt and store the registration code in a secure storage space; the secure storage space can only be accessed by the activation management application; wherein, the registration code includes usage permission information and verification information of the application to be activated, and the verification information includes a ciphertext generated by encrypting the trusted identity identifier and the usage permission information using the trusted key; the usage permission information includes an effective time, an expiration time, and the number of available uses; The steps for verifying the registration code according to the trusted identity identifier include: Encrypt the trusted identity identifier and the usage permission information using the trusted key to generate a first ciphertext; If the first ciphertext is consistent with the verification information, the registration code is verified successfully.
12. The method according to claim 11, further includes: Verify whether the trusted execution environment is activated successfully; When the trusted execution environment is activated successfully, send the trusted identity identifier of the terminal device to the server.
13. The method according to claim 11, further includes: Generate an authentication code according to the trusted identity identifier; Send the authentication code to the server so that the server verifies the authentication code, and after the authentication code is verified successfully, generate a registration code according to the trusted identity identifier.
14. The method according to claim 13, wherein, The authentication code includes a preset key, a second ciphertext, and a first mapping value. The second ciphertext is a ciphertext generated by encrypting the trusted identity identifier using the preset key, and the first mapping value is a value obtained by mapping the trusted identity identifier using a preset mapping function; The server is adapted to verify the authentication code according to the following method: Decrypt the second ciphertext using the preset key to obtain the trusted identity identifier, use the preset mapping function to calculate the second mapping value of the trusted identity identifier, and if the second mapping value is consistent with the first mapping value, the authentication code is verified successfully.
15. The method according to claim 11, wherein, The activation management application communicates with the server via the application to be activated.
16. An application activation method based on a trusted execution environment, which is executed by an activation management application in the trusted execution environment. The trusted execution environment is deployed in a terminal device, and the method includes: Receiving a trusted identity identifier sent by the terminal device; Generating a registration code according to the trusted identity identifier; Encrypting the registration code with the trusted key corresponding to the trusted identity identifier to generate registration information; Sending the registration information to the terminal device so that the terminal device: decrypts the registration information with the trusted key to obtain the registration code; And verifying the registration code according to the trusted identity identifier, and encrypting and storing the registration code in a secure storage space after the registration code is verified; the secure storage space can only be accessed by the activation management application; Wherein, the registration code includes usage permission information and verification information of the application to be activated, and the verification information includes ciphertext generated by encrypting the trusted identity identifier and the usage permission information with the trusted key; The usage permission information includes an effective time, an expiration time, and the number of available times; The verifying the registration code includes the terminal device: encrypting the trusted identity identifier and the usage permission information with the trusted key to generate a fifth ciphertext; If the fifth ciphertext is consistent with the verification information in the registration code, the registration code is verified.
17. The method according to claim 16, wherein, The server includes an application server and an authentication server. The usage permission information is generated by the application server, and the verification information is generated by the authentication server.
18. The method according to claim 16, further includes: Receiving an authentication code sent by the terminal device, the authentication code being generated according to the trusted identity identifier; Verifying the authentication code; Generating a registration code according to the trusted identity identifier after the authentication code is verified.
19. The method according to claim 18, wherein, The authentication code includes a preset key, a first ciphertext, and a first mapping value. The first ciphertext is ciphertext generated by encrypting the trusted identity identifier with the preset key, and the first mapping value is a value obtained by mapping the trusted identity identifier with a preset mapping function; The step of verifying the authentication code includes: Decrypting the first ciphertext with the preset key to obtain the trusted identity identifier; Calculating a second mapping value of the trusted identity identifier with the preset mapping function; If the second mapping value is consistent with the first mapping value, the authentication code is verified.
20. A terminal device, on which a trusted execution environment is deployed, The trusted execution environment includes an activation management application, and the activation management application is adapted to execute the method according to any one of claims 1-6, 11-15.
21. A server, including: At least one processor; and A memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, and the program instructions include instructions for executing the method according to any one of claims 7-10, 16-19.
22. An application activation system based on a trusted execution environment, comprising: the terminal device according to claim 20; and the server according to claim 21.
Citation Information
Patent Citations
Authorization management method, server, customer equipment and system
CN106503492A
Terminal identity verification method and system based on dispersed key encryption
CN107508791A
Software license control method and apparatus, computer device and readable storage medium
CN107679371A