A security authentication method, electronic device and storage medium
By obtaining the configuration file of the target object and generating a digital signature based on asymmetric encryption, and sending it to the second device to perform security authentication, the security problem caused by arbitrary call of the TEE application API is solved, and the security of data protection is improved.
Patent Information
- Application Number
- CN202210537257.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-13
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2042-05-13
AI Technical Summary
In an open environment of mobile devices, the API of TEE applications is arbitrarily called to lead to privacy and security issues, and malicious attackers can steal TEE-protected data.
By obtaining the configuration file of the target object to be protected, obtaining a digital signature based on asymmetric encryption, and sending the configuration file and digital signature to the second device, triggering the second device to perform security authentication to limit the API call and ensure that only the constraints are met Only by requesting the TEE application API is called.
Improves security, prevents arbitrary calls to the TEE application API by the non-secure world, avoids confidential data leakage, and enhances protection of TEE-protected data.
Smart Images

Figure CN114969711B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to the fields of deep learning, cloud computing, and security authentication. Background Art
[0002] Security issues are increasingly being addressed in the open environment of mobile devices, not only for end users, but also for service providers, mobile operators, and chip manufacturers. In response, a Trusted Execution Environment (TEE) is provided. TEE can be: an operating environment that coexists with the operating system on the terminal device. TEE has its own execution space, which has a higher security level than the operating system. It can be called by the outside world through specific entrances, such as the Application Programming Interface (API) of the TEE application.
[0003] However, if the API of the TEE application is called arbitrarily, it will cause security issues such as privacy leakage, resulting in the data protected by the TEE application being maliciously stolen by outsiders. Summary of the invention
[0004] The present disclosure provides a security authentication method, an electronic device, and a storage medium.
[0005] According to one aspect of the present disclosure, there is provided a security authentication method, comprising:
[0006] The first device obtains a target object to be protected;
[0007] The first device obtains a first configuration file corresponding to the target object according to the target object, wherein the first configuration file is used to constrain an interface call of an application programming interface API called by the target object;
[0008] The first device obtains a digital signature for authenticating the first configuration file based on asymmetric encryption;
[0009] The first device sends the first configuration file and the digital signature to the second device, triggering the second device to perform security authentication.
[0010] According to another aspect of the present disclosure, there is provided a security authentication method, comprising:
[0011] The second device receives the first configuration file and the digital signature sent by the first device;
[0012] When the second device successfully verifies the digital signature, the TEE file in the trusted execution environment TEE is initialized according to the first configuration file, and the interface call constraints are imposed on the application programming interface API called by the target object in the TEE file;
[0013] The second device responds to the first request to call the TEE application API, and security authentication succeeds if the first request meets the constraints of the interface call.
[0014] According to another aspect of the present disclosure, there is provided a first device, comprising:
[0015] An acquisition module is used to acquire the target object to be protected;
[0016] A configuration module, configured to obtain a first configuration file corresponding to the target object according to the target object, wherein the first configuration file is used to constrain an interface call of an application programming interface API called by the target object;
[0017] A first encryption module, configured to obtain a digital signature for authenticating the first configuration file based on asymmetric encryption;
[0018] The sending module is used to send the first configuration file and the digital signature to the second device, triggering the second device to perform security authentication.
[0019] According to another aspect of the present disclosure, there is provided a second device, including:
[0020] A receiving module, configured to receive a first configuration file and a digital signature sent by a first device;
[0021] An initialization module, configured to initialize a TEE file in a trusted execution environment TEE according to the first configuration file when the digital signature verification succeeds, and to constrain an interface call of an application programming interface API called by the target object in the TEE file;
[0022] The security authentication module is used to respond to a first request for calling the TEE application API, and the security authentication is successful when the first request meets the constraints of the interface call.
[0023] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[0024] at least one processor; and
[0025] a memory communicatively connected to the at least one processor; wherein,
[0026] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method provided by any embodiment of the present disclosure.
[0027] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method provided by any embodiment of the present disclosure.
[0028] According to another aspect of the present disclosure, a computer program product is provided, including computer instructions, which implement the method provided by any embodiment of the present disclosure when executed by a processor.
[0029] With the present disclosure, the first device can obtain the target object to be protected, and obtain the first configuration file corresponding to the target object according to the target object, and the first configuration file is used to constrain the interface call of the application programming interface called by the target object. The first device can obtain a digital signature for authenticating the first configuration file based on asymmetric encryption, so as to send the first configuration file and the digital signature to the second device, triggering the second device to perform security authentication, thereby improving security.
[0030] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0032] Figure 1 is a schematic diagram of an application scenario according to an embodiment of the present disclosure;
[0033] Figure 2 is a flowchart of a security authentication method according to an embodiment of the present disclosure;
[0034] Figure 3 is a schematic diagram of model operator operations in an application example according to an embodiment of the present disclosure;
[0035] Figure 4 is a schematic diagram of data interaction for security authentication in an application example according to an embodiment of the present disclosure;
[0036] Figure 5 is a flowchart of a security authentication method according to an embodiment of the present disclosure;
[0037] Figure 6 is a schematic diagram for security authentication verification in an application example according to an embodiment of the present disclosure;
[0038] Figure 7 is a schematic diagram of the composition structure of a first device according to an embodiment of the present disclosure;
[0039] Figure 8 is a schematic diagram of the composition structure of a second device according to an embodiment of the present disclosure;
[0040] Fig. 9 It is a block diagram of an electronic device used to implement the security authentication method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0041] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0042] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The term "at least one" in this article means any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C. The terms "first" and "second" in this article refer to multiple similar technical terms and distinguish them. They do not mean to limit the order or to limit them to only two. For example, the first feature and the second feature refer to two types / two features. The first feature can be one or more, and the second feature can also be one or more.
[0043] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0044] The basic concepts involved in the embodiments of the present application are briefly described. It should be understood that the basic concepts introduced below do not limit the embodiments of the present application.
[0045] 1. TEE refers to a trusted execution environment that implements trusted computing through hardware (such as CPU chips). It can be located in the CPU chip but is independent of the operating system. In TEE, since it can ensure that the trusted computing is not interfered with by the operating system, it is called "trusted". It can be achieved by creating a small operating system that can run independently in the "secure world" of the TrustZone.
[0046] It should be pointed out that TEE can be set up not only in mobile terminals, but also in the cloud, and can be used to run some key operations: for example, fingerprint verification and PIN code input in mobile payments; secure storage of confidential data such as private keys and certificates; for example, digital copyright protection (DigitalRight Management, DRM) of digital product content disseminated on the network, etc.
[0047] 2. The non-secure world refers to the insecure ordinary world (or the outside world different from TEE). In terms of security performance, TEE is in the "secure world" relative to the operating system of the mobile terminal (such as Android), while Android is in the "non-secure world". TEE applications protected by TEE can provide secure services for the operating system (such as Android) in the non-secure world.
[0048] 3. Secure storage refers to trusted storage, which is protected by TEE and can store sensitive data and program code while ensuring the confidentiality and integrity of the data.
[0049] In the related art, in the TEE architecture, although the underlying hardware is trusted, vulnerabilities in the TEE application can be exploited to leak confidential data. Most of these vulnerabilities are triggered through the TEE application API. For the API, trusted applications from the user layer cannot directly access the memory of the non-trusted environment, but communicate with the non-secure world through the API as a secure communication channel. All information flows of the TEE are almost unaffected by the user layer. However, the API provided by the TEE application can be arbitrarily called by the non-secure world, and the TEE application API can be arbitrarily called through malicious attacks, which ultimately leads to the leakage of confidential data, brings security issues, and needs to improve security.
[0050] The security authentication method disclosed in the present invention limits the arbitrary calls of the TEE application API by the non-secure world through the constraints of API interface calls, thereby improving security. The method is suitable for scenarios where the calls to the TEE application API are restricted, or where the order of TEE application API calls needs to be restricted. For example, in a TEE-based deep learning system, when the target objects protected by the TEE are operators / operator operations in a neural network model, neural network models, and various parameters used in operators, the calling order of operators in the neural network model (such as a model for realizing 2D to 3D facial special effects conversion) is constrained to prevent the non-secure world from arbitrarily calling the model operators and maliciously decrypting various parameters in the model.
[0051] According to an embodiment of the present disclosure, Figure 1 It is a schematic diagram of an application scenario according to an embodiment of the present disclosure, which exemplarily describes that a TEE application can be run through a TEE in a secure world, thereby preventing the target objects protected by the TEE (such as neural network models, operators / operator operations in neural network models, various parameters used in neural network models and operators, target applications, system codes, data, etc.) from sending security issues such as confidential data leakage. Specifically, the requests sent from the non-secure world are of two types: one is a request initiated by a legitimate user (such as a command to call TEE), and the other is a request initiated by an illegal user (such as an attacker of the TEE application API interface) (such as a call request for the API interface function / functional function of the TEE application). The database 101 can be used as a secure storage area to implement trusted storage to ensure the confidentiality and integrity of the data. The TEE application can be run in the TEE 102, and the TEE application or some of the API interface functions / functional functions in the TEE application can be used as the target objects protected by the TEE.
[0052] According to an embodiment of the present disclosure, a security authentication method is provided. Figure 2 This is a flowchart of a security authentication method according to an embodiment of the present disclosure. The method can be applied to a first device for security authentication. For example, the first device can be deployed in a terminal or server or other processing device in a single machine, multiple machines or cluster system to implement security authentication and other processing. The terminal can be a user equipment (UE, User Equipment), a mobile device, a personal digital assistant (PDA, Personal Digital Assistant), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the method can also be implemented by a processor calling computer-readable instructions stored in a memory. For example Figure 2 As shown, the method is applied to a first device, comprising:
[0053] S201: The first device obtains a target object to be protected.
[0054] S202: The first device obtains a first configuration file corresponding to the target object according to the target object, where the first configuration file is used to constrain an interface call of an API called by the target object.
[0055] S203: The first device obtains a digital signature for authenticating the first configuration file based on asymmetric encryption.
[0056] S204: The first device sends the first configuration file and the digital signature to the second device, triggering the second device to perform security authentication.
[0057] In an example of S201-S204, the target object to be protected may be a neural network model, an operator / operator operation in a neural network model, various parameters used in the neural network model and the operator, a target application, system code, data, etc. To protect the target object, a first configuration file (such as TEE Config) for security authentication may be pre-configured for the target object. Since the first configuration file includes constraints on the interface call of the API called by the target object, that is, the peer device communicating with the first device (such as the device side where the developer is located), that is, the second device (such as the device side where the user is located), needs to meet the constraints of the interface call when calling the API to complete the security authentication. After the first device obtains the digital signature for authenticating the first configuration file based on asymmetric encryption, it sends the first configuration file and the digital signature to the second device, thereby triggering the second device to perform the security authentication.
[0058] With the present disclosure, the first device can obtain the target object to be protected, and obtain the first configuration file corresponding to the target object according to the target object, and the first configuration file is used to constrain the interface call of the application programming interface called by the target object. The first device can obtain a digital signature for authenticating the first configuration file based on asymmetric encryption, so as to send the first configuration file and the digital signature to the second device, triggering the second device to perform security authentication, thereby improving security.
[0059] In one implementation, the first device obtains a digital signature for authenticating the first configuration file based on asymmetric encryption, including: the first device uses a file identifier corresponding to the first configuration file to perform asymmetric encryption to obtain the digital signature.
[0060] In some examples, the first configuration file (such as TEE Config) is digitally signed based on a file identifier, such as a configuration file identifier (Config_id). The asymmetric encryption may include: an asymmetric encryption method in which the first device uses a private key for encryption and a public key for decryption, or an asymmetric encryption method in which the first device uses a public key for encryption and a private key for decryption.
[0061] In this implementation, the file identifier and the first configuration file are in a one-to-one binding relationship. A digital signature is obtained after asymmetric encryption based on the file identifier. The digital signature can be used to verify the signature of the first configuration file, thereby achieving security authentication.
[0062] In one implementation, it also includes: the first device encrypts the target object to obtain first encrypted data, and the first device sends the first encrypted data.
[0063] In some examples, the encryption method of the target object may be written into the first configuration file.
[0064] In this embodiment, the encryption method is written into the first configuration file in order to agree on the encryption and decryption algorithms of the first device and the second device, so that after the first device sends the first encrypted data to the second device, the second device can decrypt the first encrypted data to obtain the target object. In other words, in addition to the digital signature of the first configuration file, data encryption is also required, so that after the second device responds to the API call request and passes the digital signature verification, the data can be decrypted, so that various operations of the API interface function (or functional function) can be performed according to the decrypted data.
[0065] In one embodiment, constraining the interface call of the API called by the target object includes: constraining the calling order of at least one command line and / or data in the interface function (or function function) corresponding to the API called by the target object. When the calling order constrained by the first device is the first order, the second order of the second device calling the TEE application API matches the first order.
[0066] In one example, after the first sequence is configured, the second device on the other end of the first device also needs to correctly execute the first sequence. In other words, the second sequence executed by the second device needs to match the first sequence (for example, the second sequence is the same as the first sequence). Only in this way can the final security authentication be achieved.
[0067] In this implementation, the purpose of matching is to detect whether the API called by the target object during operation follows the calling order pre-constrained in the first configuration file. For example, if the API call is configured based on the first order, if there is a calling order mismatch, for example, the second order is different from the first order, it means that the security authentication has failed and the call is refused to run; if the second order is the same as the first order, it means that the security authentication is successful and the call is allowed to run.
[0068] Figure 3 is a schematic diagram of model operator operation in an application example according to an embodiment of the present disclosure, such as Figure 3 As shown, for operators, in some examples, the neural network model is composed of various layers (or computing units), these layers can be used as operators, and the operator can also be understood as: the calculation logic (or mathematical operation) corresponding to each layer in the neural network model, and the process of using the operator is the operation processing process of executing the corresponding layer in the neural network model. Figure 3 It is a basic structure of a neural network model (such as the first model), including: convolution layer, pooling layer and fully connected layer. The data is input into the first model, and the output data of the model is obtained after the operation of the convolution layer, pooling layer and fully connected layer. Among them, the calculation logic of the convolution layer corresponds to the first operator, and the first operator can be used to extract features; the calculation logic of the pooling layer corresponds to the second operator, and the size of the feature map and the amount of network calculation can be reduced by the second operator; the calculation logic of the fully connected layer corresponds to the third operator, and the third operator can be used to implement weighted summation to integrate the extracted features together. It should be pointed out that the data in the operator can be called a tensor, including input data and output data, and the output data can be obtained based on the input data and the operator operation.
[0069] In the application scenario of a TEE-based deep learning system, the target object protected by TEE can be an operator / operator operation in a neural network model, a neural network model, and various parameters used in the operator. The operator is an operation (or mathematical operation) in the neural network model. By constraining the calling order of operators in the neural network model (such as a model for realizing 2D to 3D face special effects conversion, or an end-to-end 2D image to 3D semi-realistic image conversion model), it is prevented that the non-secure world arbitrarily calls the model operator, thereby maliciously decrypting various parameters in the model. For this application scenario, in order to protect the above-mentioned target objects, such as various parameters used in the operator, the parameters are encrypted and can only be decrypted in the TEE. The plaintext parameters will not flow out to the non-secure world, thereby improving security.
[0070] It should be pointed out that through TEE applications, different operator operations not limited to the above application scenarios can be provided. The non-secure world can perform different operator operations by calling APIs and then return the final results to the non-secure world.
[0071] In some examples, for the first configuration file, when the first configuration file is TEE Config, the generated TEE Config can adopt a lightweight data exchange format (JavaScript Object Notation, JSON), and the TEE Config can be written by the user or automatically generated by a preprocessor.
[0072] TEE Config can include the following fields:
[0073] 1. Config_id: As the unique identifier of the corresponding TEE Config, it can be written by the user or automatically generated by the preprocessor;
[0074] 2. Command_list: As a call order list, the call order of the TEE application API can be specified. Each call order can use the data format of the TEECommandInfo structure.
[0075] The TEECommandInfo structure may include: (1) command: the name of the API command to be called; (2) input_data: input data and the corresponding processing operation number; (3) output_data: output data and the corresponding processing operation number. The processing operation number defines what kind of operation the TEE application needs to perform on the data before actually calling the function, such as: encrypting and decrypting the data, storing the data in a secure storage area, whether the data needs to be read and written, etc.
[0076] 3. For data that needs to be encrypted, the encryption algorithm corresponding to the data can also be saved in TEE Config. Optionally, determine which one is the encrypted data, as well as information such as the IV parameters required by the encryption algorithm.
[0077] After the TEE Config is generated, it can be saved as a JSON file and signed by the user to prevent malicious tampering. When the TEE application is running, the TEE Config file and its digital signature are transmitted to the user-side TEE of the peer device, the TEE application is run, and the TEE Config and its digital signature are verified in the TEE.
[0078] Figure 4 is a schematic diagram of data interaction for security authentication in an application example according to an embodiment of the present disclosure, such as Figure 4 As shown, it includes: through the preprocessor, the user encrypts the data to be protected to obtain encrypted data; the digital signature of the configuration file corresponding to the data is processed to obtain the Config file and the signature, and the encrypted data, Config file and the signature are sent to the peer device. Among them, the private key "priv_key" and the public key "pub_key" used for asymmetric encryption of data signature are generated through the root key "root_key" generation instruction, so that the private key "priv_key" and the public key "pub_key" are used to perform digital signature processing and subsequent digital signature verification. The data key can also be derived from the command number called and the parameters in the neural network model, and the Config key "Config_key" can be derived from the root key "root_key" and the file identifier "Config_id". Finally, the key is remotely synchronized to the user-side TEE of the peer device. After the preprocessor performs these processes, the encrypted data, Config file and signature are sent to the user-side TEE of the peer device, triggering the user-side TEE of the peer device to perform security authentication based on digital signatures, keys, etc.
[0079] According to an embodiment of the present disclosure, a security authentication method is provided. Figure 5 This is a flowchart of a security authentication method according to an embodiment of the present disclosure. The method can be applied to a second device for security authentication. For example, the device can be deployed in a terminal or server or other processing device in a single machine, multiple machines or cluster system to implement security authentication and other processing. The terminal can be a user equipment (UE, User Equipment), a mobile device, a personal digital assistant (PDA, Personal Digital Assistant), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the method can also be implemented by a processor calling a computer-readable instruction stored in a memory. For example Figure 5 As shown, the method is applied to a second device, comprising:
[0080] S501: A second device receives a first configuration file and a digital signature sent by a first device.
[0081] S502: When the second device successfully verifies the digital signature, the TEE file in the TEE is initialized according to the first configuration file, and the interface call constraints are imposed on the API called by the target object in the TEE file.
[0082] S503: The second device responds to the first request for calling the TEE application API, and the security authentication succeeds if the first request meets the constraints of the interface call.
[0083] In an example of S501-S503, a first configuration file (such as TEE Config) pre-configured for the target object for security authentication is received. Since the first configuration file includes constraints on the interface call of the API called by the target object, that is, the peer device communicating with the first device (such as the developer's device side), that is, the second device (such as the user's device side), needs to meet the constraints of the interface call when calling the API to complete the security authentication. The second device receives the first configuration file and the digital signature, and if the digital verification is successful, initializes the TEE file in the TEE according to the first configuration file (for example, TEE builds a global operating context "TEE Context" according to the content of the first configuration file), and constrains the interface call of the API called by the target object in the TEE file. The second device responds to the first request to call the TEE application API, and the security authentication succeeds if the first request meets the constraints of the interface call.
[0084] With the present disclosure, the second device receives the first configuration file and the digital signature to perform security authentication, responds to the first request to call the TEE application API, and the security authentication succeeds if the first request meets the constraints of the interface call, thereby improving security.
[0085] In one implementation, the method further includes: the second device verifies the digital signature based on asymmetric encryption, and obtains a file identifier corresponding to the first configuration file if the verification is successful.
[0086] In some examples, the first configuration file (such as TEE Config) is digitally signed based on a file identifier, such as a configuration file identifier (Config_id). The asymmetric encryption may include: the first device uses an asymmetric encryption method of private key encryption and public key decryption, or the first device uses an asymmetric encryption method of public key encryption and private key decryption. Accordingly, the second device verifies the digital signature using an asymmetric encryption method corresponding to the first device of the opposite end, and the file identifier corresponding to the first configuration file can be obtained if the verification is successful.
[0087] In some examples, the second device may also query whether the first configuration file corresponding to the file identifier is in a configuration file whitelist based on the file identifier. If the first configuration file is in the configuration file whitelist, the second device loads the first configuration file.
[0088] With this implementation, after the digital signature verification is successful, the config_id can also be verified to determine whether it is in the config whitelist. The first configuration file "TEE Config" that is not in the whitelist will be refused to run; the first configuration file "TEE Config" in the config whitelist will be loaded and run to initialize the TEE file in the TEE.
[0089] In one embodiment, the second device responds to a first request to call a TEE application API, and the security authentication succeeds when the first request satisfies the constraints of the interface call, including: the second device obtains from the TEE file a calling sequence of at least one command line and / or data in a function function corresponding to the API called on the target object. The calling sequence is the first sequence, and the security authentication succeeds when the second sequence of the second device calling the TEE application API matches the first sequence.
[0090] With this implementation, before calling the command of the TEE application, it can be verified whether the current command is the correct sequence in the command list. The purpose of the matching is to detect whether the API called by the target object during operation follows the calling sequence pre-constrained in the first configuration file, such as configuring the API call based on the first sequence. If there is a mismatch in the calling sequence, for example, the second sequence is different from the first sequence, it means that the security authentication has failed and the call is refused to run; if the second sequence is the same as the first sequence, it means that the security authentication is successful and the call is allowed to run.
[0091] In one embodiment, the second device receives the first encrypted data, obtains the encryption method from the TEE file, and decrypts the first encrypted data according to the encryption method to obtain the target object. In this embodiment, after receiving the first encrypted data, the second device can decrypt the first encrypted data using the encryption and decryption method agreed with the first device on the opposite end.
[0092] In some examples, a series of checks for security authentication include the following:
[0093] Verify the TEE Context
[0094] 1. After TEE receives TEE Config and its digital signature, it first verifies the signature. If the verification fails, it stops the operation and returns to the non-secure world. If the verification succeeds, it verifies whether the config_id is in the config whitelist. The first configuration file "TEE Config" that is not in the config whitelist will be refused to run to prevent downgrade attacks.
[0095] 2. TEE builds a global operating context based on the content of the first configuration file "TEE Config" and saves it in the secure storage area.
[0096] The TEE Context contains the following information:
[0097] (1) TEE Config includes command info command list and encryption information;
[0098] (2) Use a specific derivation algorithm, such as generating a corresponding config key based on the config id for data encryption and decryption;
[0099] (3) Includes the sequence number (index) of the previous item in the above command list.
[0100] An example process for TEE Context verification includes the following:
[0101] (1) Before calling the command of the TEE application, verify whether the current command is the correct sequence in the above command list. If the sequence number of the previous item is None, the command to be run must be the 0th item in the command list, otherwise the verification fails; if the sequence number of the previous item is N, N is a positive integer greater than 1, then the command to be run must be the N+1th item in the command list, otherwise the verification fails.
[0102] (2) Use a specific derivation algorithm, such as generating a corresponding data key based on the configuration file key and data identification (ID) for data encryption and decryption. This ensures that data under the same configuration file (config) are encrypted and decrypted using different data keys, and the data is bound to the config. Changing the config (different config id) will not result in successful encryption and decryption.
[0103] (3) For each command, a Trusted Execution Environment Run Information (TEERunInfo) structure is generated, which contains the basic information of the command, the encryption algorithm, and the derived data key, and the TEERunInfo structure is passed to the function.
[0104] Among them, the running process of the function includes: first perform preprocessing operations, perform corresponding operations on the input data defined in TEE Config, including decryption, reading from secure storage, etc.; perform actual function operations; perform corresponding operations on the output data defined in TEEConfig, including encryption, saving to secure storage, etc.; after the operation ends, return to the non-secure world.
[0105] Figure 6 is a schematic diagram for security authentication verification in an application example according to an embodiment of the present disclosure, such as Figure 6 As shown, it includes: after the user-side TEE located in the first device obtains the encrypted data, TEE Config file and its digital signature, it first verifies the digital signature. After the verification is successful, the global context TEEContext can be initialized according to the TEE Config file. After that, the TEEContext is loaded and run. After receiving the command to call TEE, it first verifies whether the called command is in the calling sequence of TEEContext. If yes, it continues to execute; otherwise, it exits. After that, continue to execute the following steps 1)-step 3).
[0106] Step 1) Process input data: According to the config agreement, the data can be decrypted or read from secure storage;
[0107] Step 2) execute the called command;
[0108] Step 3) Process output data: According to the config agreement, the output results can be directly returned or written to secure storage.
[0109] According to an embodiment of the present disclosure, a first device is provided. Figure 7 is a schematic diagram of the composition structure of the first device according to an embodiment of the present disclosure, such as Figure 7 As shown, the first device includes: an acquisition module 701, used to acquire a target object to be protected; a configuration module 702, used to obtain a first configuration file corresponding to the target object according to the target object, wherein the first configuration file is used to constrain interface calls of an application programming interface API called by the target object; a first encryption module 703, used to obtain a digital signature for authenticating the first configuration file based on asymmetric encryption; and a sending module 704, used to send the first configuration file and the digital signature to the second device, triggering the second device to perform security authentication.
[0110] In one implementation, the first encryption module 703 is used to perform the asymmetric encryption using the file identifier corresponding to the first configuration file to obtain the digital signature.
[0111] In one embodiment, the asymmetric encryption includes any one of the following methods:
[0112] 1) The first device uses an asymmetric encryption method of private key encryption and public key decryption;
[0113] 2) Asymmetric encryption using public key encryption and private key decryption.
[0114] In one embodiment, it further includes a second encryption module, which is used to encrypt the target object to obtain first encrypted data; and send the first encrypted data.
[0115] In one embodiment, the method further includes: a writing module, configured to write the encryption method of the target object into the first configuration file.
[0116] In one embodiment, the configuration module 702 is used to constrain the calling order of at least one command line and / or data in the function corresponding to the API called by the target object. When the first device constrains the calling order to be a first order, the second order of the second device calling the TEE application API matches the first order.
[0117] According to an embodiment of the present disclosure, a second device is provided. Figure 8 is a schematic diagram of the composition structure of the second device according to an embodiment of the present disclosure, such as Figure 8 As shown, the second device includes: a receiving module 801, which is used to receive a first configuration file and a digital signature sent by the first device; an initialization module 802, which is used to initialize the TEE file in the trusted execution environment TEE according to the first configuration file when the digital signature verification is successful, and to constrain the interface call of the application programming interface API called by the target object in the TEE file; a security authentication module 803, which is used to respond to a first request for calling the TEE application API, and the security authentication is successful when the first request meets the constraints of the interface call.
[0118] In one embodiment, it further includes a signature verification module, which is used to verify the digital signature based on asymmetric encryption, and obtain a file identifier corresponding to the first configuration file if the verification is successful.
[0119] In one embodiment, the system further comprises a loading module, which is used to query whether the first configuration file corresponding to the file identifier is in a configuration file whitelist according to the file identifier. The first configuration file is loaded when the first configuration file is in the configuration file whitelist.
[0120] In one embodiment, the security authentication module 803 is used to obtain from the TEE file a calling order of at least one command line and / or data in a function function corresponding to an API called to the target object; the calling order is a first order, and the security authentication is successful when the second order of calling the TEE application API matches the first order.
[0121] In one embodiment, a decryption module is further included, which is used to receive first encrypted data; obtain an encryption method from the TEE file, decrypt the first encrypted data according to the encryption method, and obtain the target object.
[0122] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0123] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0124] Fig. 9 A schematic block diagram of an example electronic device 900 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0125] like Fig. 9 As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0126] Multiple components in the electronic device 900 are connected to the I / O interface 905, including: an input unit 906, such as a keyboard, a mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, an optical disk, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows the electronic device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0127] The computing unit 901 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 901 performs the various methods and processes described above, such as a security authentication method. For example, in some embodiments, the security authentication method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 900 via the ROM 902 and / or the communication unit 909. When the computer program is loaded into the RAM 903 and executed by the computing unit 901, one or more steps of the security authentication method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the security authentication method in any other appropriate manner (e.g., by means of firmware).
[0128] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0129] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0130] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0131] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0132] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0133] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0134] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of this disclosure can be achieved, and this document is not limited here.
[0135] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A security authentication method, applied to a first device, comprising: The first device obtains a target object to be protected; The first device obtains a first configuration file corresponding to the target object according to the target object, the first configuration file is used by the second device to initialize a TEE file in a trusted execution environment TEE, and in the TEE file, constraints are imposed on interface calls to an application programming interface API called by the target object, and a calling order of at least one command line and / or data in a function corresponding to a function of the application programming interface API called by the target object is constrained, and when the first device constrains the calling order to be a first order and a second order in which the second device calls the TEE application API is the same as the first order, it is determined that the security authentication is successful; the second device is a peer device communicating with the first device; The first device obtains a digital signature for authenticating the first configuration file based on asymmetric encryption; The first device sends the first configuration file and the digital signature to the second device, triggering the second device to perform security authentication.
2. The method according to claim 1, wherein: The first device obtains a digital signature for authenticating the first configuration file based on asymmetric encryption, including: The first device performs the asymmetric encryption using the file identifier corresponding to the first configuration file to obtain the digital signature.
3. The method according to claim 2, wherein: The asymmetric encryption includes any of the following methods: Asymmetric encryption using private key encryption and public key decryption; Asymmetric encryption using public key encryption and private key decryption.
4. The method according to any one of claims 1 to 3, further comprising: The first device encrypts the target object to obtain first encrypted data; The first device sends the first encrypted data.
5. The method according to claim 4, further comprising: The encryption method of the target object is written into the first configuration file.
6. A security authentication method, applied to a second device, comprising: The second device receives the first configuration file and the digital signature sent by the first device, and triggers the following security authentication: When the second device successfully verifies the digital signature, the TEE file in the trusted execution environment TEE is initialized according to the first configuration file, and the interface call constraints are imposed on the application programming interface API called by the target object in the TEE file; The second device obtains, from the TEE file, a calling sequence of at least one command line and / or data in a function function corresponding to an API called on the target object; The calling order is the first order, and the security authentication is successful when the second order in which the second device calls the TEE application API is the same as the first order.
7. The method according to claim 6, further comprising: The second device verifies the digital signature based on asymmetric encryption, and obtains a file identifier corresponding to the first configuration file if the verification succeeds.
8. The method according to claim 7, further comprising: The second device queries, according to the file identifier, whether the first configuration file corresponding to the file identifier is in a configuration file whitelist; If the first configuration file is in the configuration file whitelist, the second device loads the first configuration file.
9. The method according to any one of claims 6 to 8, further comprising: The second device receives the first encrypted data; The second device obtains the encryption method from the TEE file, decrypts the first encrypted data according to the encryption method, and obtains the target object.
10. A first device, comprising: An acquisition module is used to acquire the target object to be protected; a configuration module, configured to obtain a first configuration file corresponding to the target object according to the target object, wherein the first configuration file is used by a second device to initialize a TEE file in a trusted execution environment TEE, and to constrain an interface call of an application programming interface API called by the target object in the TEE file, so as to constrain a calling order of at least one command line and / or data in a function corresponding to a function of the application programming interface API called by the target object, and when the first device constrains the calling order to be a first order, and a second order in which the second device calls the TEE application API is the same as the first order, it is determined that the security authentication is successful, and the second device is a peer device communicating with the first device; A first encryption module, configured to obtain a digital signature for authenticating the first configuration file based on asymmetric encryption; The sending module is used to send the first configuration file and the digital signature to the second device, triggering the second device to perform security authentication.
11. The device according to claim 10, wherein: The first encryption module is used for: The asymmetric encryption is performed using the file identifier corresponding to the first configuration file to obtain the digital signature.
12. The device according to claim 11, wherein The asymmetric encryption includes any of the following methods: Asymmetric encryption using private key encryption and public key decryption; Asymmetric encryption using public key encryption and private key decryption.
13. The device according to any one of claims 10-11, further comprising a second encryption module, configured to: Encrypting the target object to obtain first encrypted data; The first encrypted data is sent.
14. The apparatus according to claim 13, further comprising: Write modules for: The encryption method of the target object is written into the first configuration file.
15. A second device, comprising: The receiving module is used to receive the first configuration file and the digital signature sent by the first device, and trigger the following modules to perform security authentication: An initialization module, configured to initialize a TEE file in a trusted execution environment TEE according to the first configuration file when the digital signature verification succeeds, and to constrain an interface call of an application programming interface API called by a target object in the TEE file; A security authentication module is used to obtain from the TEE file a calling order of at least one command line and / or data in a function function corresponding to an API called to the target object; the calling order is a first order, and the security authentication is successful if the second order of calling the TEE application API is the same as the first order.
16. The device according to claim 15, further comprising a signature verification module, configured to: The digital signature is verified based on asymmetric encryption, and if the verification succeeds, a file identifier corresponding to the first configuration file is obtained.
17. The device according to claim 16, further comprising a loading module, configured to: According to the file identifier, query whether the first configuration file corresponding to the file identifier is in a configuration file whitelist; The first configuration file loads the first configuration file when the configuration file whitelist is in the list.
18. The device according to any one of claims 15 to 17, further comprising a decryption module, configured to: receiving first encrypted data; An encryption method is obtained from the TEE file, and the first encrypted data is decrypted according to the encryption method to obtain the target object.
19. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.
21. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Field-programmable gate array based trusted execution environment for use in a blockchain network
CN110392889A
