Data protection method and related apparatus

By using a private key fragmentation collaborative decryption method in electronic devices, the problem of insufficient module security is solved, data security and integrity are improved, and data leakage is prevented.

WO2026056502A1PCT designated stage Publication Date: 2026-03-19HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2026-03-19

AI Technical Summary

Technical Problem

Inadequate security in modules of electronic devices makes critical data vulnerable to leakage.

Method used

By using private key fragments collaboratively for decryption between the business module and the TEE in the processor, the exposure of private key fragments on the transmission link is avoided. Intermediate data is generated collaboratively using fragments of session private key and public key for decryption, forming a binding relationship to improve security.

Benefits of technology

It improves the security of private key fragmentation and session private keys, ensures the security of real keys and original data, prevents modules from being unable to be decrypted when they are counterfeited, and enhances data protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025107583_19032026_PF_FP_ABST
    Figure CN2025107583_19032026_PF_FP_ABST
Patent Text Reader

Abstract

A data protection method and a related apparatus. The method can be applied to an electronic device comprising a service module and a processor, wherein the processor comprises a TEE. The service module stores ciphertext data encrypted by a real key, and when executing a service, the service module needs to use the real key to perform decryption to obtain original data from the ciphertext data. The service module and the TEE in the processor use respectively stored private key shares of session private keys to participate in decryption computation of a ciphertext key, so as to perform decryption to obtain the real key in the service module. In this way, during the process of a service module recovering a real key from a ciphertext key, private key shares respectively stored in the service module and the TEE in the processor are not exposed on a transmission link, thereby improving the security of the private key shares, also improving the security of the session private keys, and thus improving the security of the real key.
Need to check novelty before this filing date? Find Prior Art

Description

Data protection method and related apparatus

[0001] The present application claims priority to the Chinese patent application No. 202411273606.2, filed on September 11, 2024, and entitled "Data protection method and related apparatus", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD

[0002] The present application relates to the technical field of data security, in particular to a data protection method and related apparatus. BACKGROUND

[0003] Currently, some modules in an electronic device bear some important services, but the security of the modules in the electronic device is not enough, so that the key data in the modules in the electronic device is easy to be leaked. SUMMARY

[0004] The present application provides a data protection method and related apparatus, which realizes that multiple modules (or nodes) can cooperatively complete decryption of data in a specified module in the multiple modules (or nodes) through respective private key fragments, and improves the security of the data.

[0005] In a first aspect, an embodiment of the present application provides a data protection method applied to an electronic device, the electronic device including a processor and a service module, and the processor running a trusted execution environment (TEE); the method includes: the service module generating first intermediate data based on a first private key fragment of a session private key and a ciphertext key, the ciphertext key being generated by a session public key encrypting a real key, the session public key and the session private key being a pair of public and private keys; the service module sending a first decryption request to the TEE, the first decryption request carrying the first intermediate data; the TEE generating second intermediate data based on the first intermediate data and a second private key fragment of the session private key after receiving the first decryption request; the TEE sending the second intermediate data to the service module; and the service module decrypting the real key from the ciphertext key based on the second intermediate data.

[0006] The data protection method provided by the embodiment of the present application can be applied to an electronic device including a service module and a processor. The processor includes a TEE. The service module stores ciphertext data encrypted by a real key. The service module needs to use the original data decrypted from the ciphertext data by the real key when performing a service. The service module and the TEE in the processor use the private key fragments of the session private keys stored respectively to participate in the decryption calculation of the ciphertext key, so as to decrypt the real key in the service module.

[0007] In this way, in the process of recovering the real key by the business module from the ciphertext key, the private key fragments stored by the business module and the TEE in the processor are not exposed on the transmission link, the security of the private key fragments is improved, the security of the session private key is improved, and the security of the real key is improved. Moreover, the business module can form a binding relationship with the TEE in the processor, and if either the business module or the TEE in the processor is imitated, the real key cannot be decrypted in the business module, thereby ensuring the security of the original data.

[0008] In a possible implementation, the method further includes: the business module decrypts the original data from the ciphertext data using the real key. In this way, since the private key fragments stored by the business module and the TEE in the processor are not exposed on the transmission link, the security of the private key fragments is improved, the security of the real key is improved, and the security of the original data is improved.

[0009] In a possible implementation, the method further includes: the business module deletes the real key after decrypting the original data. In this way, since the business module decrypts the real key in the random memory, the real key can be deleted after the business module decrypts the original data, thereby preventing the real key from being leaked in the business module, and the security of the real key is improved.

[0010] In a possible implementation, the method further includes: the business module deletes the original data after using the original data. In this way, since the business module decrypts the original data in the random memory, the original data can be deleted after the business module uses the original data, thereby preventing the original data from being leaked in the business module, and the security of the original data is improved.

[0011] In a possible implementation, the electronic device further includes a security module, and before the business module generates the first intermediate data based on the first private key fragment of the session private key and the ciphertext key, the method further includes: the security module disperses the session private key into the first private key fragment and the second private key fragment; the security module sends the first private key fragment to the business module; and the security module sends the second private key fragment to the TEE. In this way, the first private key fragment and the second private key fragment of the session key can be generated by the security module and sent to the business module and the TEE, so that the business module and the TEE each save different private key fragments.

[0012] In a possible implementation, the method further includes: the security module encrypts the real key using the session public key to obtain the ciphertext key; and the security module sends the ciphertext key to the service module. In this way, before the ciphertext key is decrypted, the security module can encrypt the real key using the session public key to obtain the ciphertext key. The security module can send the ciphertext key to the service module for storage, so that the security module, the TEE, and the service module form a binding relationship.

[0013] In a possible implementation, the session private key and the session public key are pre-stored in the security module.

[0014] In a possible implementation, before the security module disperses the session private key into the first private key fragment and the second private key fragment, the method further includes: the security module generates the session private key and the session public key.

[0015] In a possible implementation, the electronic device further includes a security module; and before the service module generates the first intermediate data based on the first private key fragment of the session private key and the ciphertext key, the method further includes: the service module and the TEE negotiate the private key fragment of the session private key and the public key fragment of the session public key, where the service module obtains the first private key fragment and the first public key fragment, the TEE obtains the second private key fragment and the second public key fragment; the service module sends the first public key fragment to the security module; the TEE sends the second public key fragment to the security module; the security module generates the session public key based on the first public key fragment and the second public key fragment; the security module encrypts the real key using the session public key to obtain the ciphertext key; and the security module sends the ciphertext key to the service module.

[0016] In this way, the service module and the TEE can negotiate the private key fragment of the session private key and the public key fragment of the session public key, and the service module and the TEE send the respective public key fragments to the security module. Thus, the security module recovers the session public key based on the public key fragments sent by the service module and the TEE respectively, and encrypts the real key using the session public key. Thus, the private key fragment of the session private key is not exposed on the transmission link, ensuring the security of the private key fragment. In the process in which the service module recovers the real key from the ciphertext key, the private key fragments stored by the service module and the TEE respectively are not exposed on the transmission link, improving the security of the private key fragment, the security of the session private key, and the security of the real key, and thus improving the security of the original data. Moreover, the service module can form a binding relationship with the TEE and the security module, and if any of the service module, the TEE, and the security module is imitated, the real key cannot be decrypted in the service module, thus ensuring the security of the real key.

[0017] In a possible implementation, the first private key fragment and the second private key fragment are equal to the session private key, the ciphertext key includes key metadata and encrypted ciphertext; the first decryption request carries the first intermediate data; the business module generates the first intermediate data based on the first private key fragment of the session private key and the ciphertext key, specifically including: the business module generates a first random number; the business module determines first blinded data based on the first private key fragment, the first random number, and the key metadata, and the first intermediate data includes the first blinded data; the TEE generates second intermediate data based on the second private key fragment of the session private key after receiving the first decryption request, specifically including: the TEE determines second blinded data based on the first blinded data, the second private key fragment, and the key metadata after receiving the first decryption request, and the second intermediate data includes the second blinded data; the business module decrypts the real key from the ciphertext key based on the second intermediate data, specifically including: the business module determines unblinded data based on the second blinded data, the first random number, and the key metadata; and the business module decrypts the real key from the encrypted ciphertext based on the unblinded data.

[0018] In summary, the business module and the TEE can participate in the calculation of the first blinded data and the second blinded data by using the respective stored private key fragments, without directly transmitting the first private key fragment and the second private key fragment to each other, so that the unblinded data can be obtained in the business module, and the real key can be recovered in the business module. In this way, in the process of recovering the real key from the ciphertext key in the business module, the private key fragments stored in the business module and the TEE are not exposed on the transmission link, which improves the security of the private key fragments, and improves the security of the session private key, and further improves the security of the real key, thereby improving the security of the original data. Moreover, by introducing the first random number when calculating the first blinded data and the second blinded data, the business module and the TEE can generate different first random numbers each time the ciphertext key is decrypted cooperatively, so that the first blinded data transmitted each time in the transmission link is different, and the second blinded data transmitted each time in the transmission link is also different, thereby increasing the security of the private key fragments.

[0019] In a possible implementation, the business module determines first blinded data based on the first private key fragment, the first random number and the key metadata, specifically including: the business module performs elliptic curve scalar multiplication operation on the first private key fragment and the key metadata after adding the first private key fragment and the first random number, to obtain the first blinded data; the TEE determines second blinded data based on the first blinded data, the second private key fragment and the key metadata after receiving the first decryption request, specifically including: the TEE adds the first blinded data to the result of performing elliptic curve scalar multiplication operation on the second private key fragment and the key metadata, to obtain the second blinded data; the business module determines unblinded data based on the second blinded data, the first random number and the key metadata, specifically including: the business module subtracts the result of performing elliptic curve scalar multiplication operation on the first random number and the key metadata from the second blinded data, to obtain the unblinded data; and the business module determines a recovery key using the unblinded data and the encrypted ciphertext, specifically including: the business module derives an intermediate key based on the data length of the unblinded data and the encrypted ciphertext; and the business module performs exclusive or operation on the encrypted ciphertext and the intermediate key, to obtain the recovery key.

[0020] In a possible implementation, the ciphertext key further includes verification data; and the business module decrypts the real key from the encrypted ciphertext based on the unblinded data, specifically including: the business module determines a recovery key using the unblinded data and the encrypted ciphertext; the business module verifies the verification data based on the unblinded data and the recovery key; and the business module determines the recovery key as the real key after verifying the verification data successfully.

[0021] In a possible implementation, the ciphertext key further includes verification data; and the business module decrypts the real key from the encrypted ciphertext based on the unblinded data, specifically including: the business module determines a recovery key using the unblinded data and the encrypted ciphertext; the business module verifies the verification data based on the unblinded data and the recovery key; and the business module determines the recovery key as the real key after verifying the verification data successfully.

[0022] In a possible implementation, the ciphertext key is generated by encrypting the real key with the session public key, and specifically includes: generating a second random number; performing the elliptic curve scalar multiplication operation on the base point on the elliptic curve with the second random number as a private key to generate a public key corresponding to the second random number, and taking the public key corresponding to the second random number as the key metadata; performing the elliptic curve scalar multiplication operation on the second random number and the session public key to obtain exclusive blind data; deriving the intermediate key based on the exclusive blind data and the data length of the real key; and performing an exclusive OR operation on the intermediate key and the real key to obtain the encrypted ciphertext.

[0023] In a possible implementation, the method further includes: the business module updating the first private key shard to a third private key shard; and the TEE updating the second private key shard to a fourth private key shard, wherein the sum of the third private key shard and the fourth private key shard is equal to the session private key.

[0024] Therefore, through the updating process of the private key shard, the business module and the TEE can negotiate with each other to update the private key shard stored by each of them, so that the updated private key shards of the business module and the TEE are not exposed on the transmission link, but the updated private key shards of the business module and the TEE can still participate in the decryption calculation of the ciphertext key, so that the business module can successfully decrypt the real key from the ciphertext key, and further successfully decrypt the original data from the ciphertext data. In this way, the private key shards stored by the business module and the TEE can be updated, the same private key shard can be prevented from being used for a long time, the possibility of private key shard leakage can be reduced, and the security of the session private key is improved.

[0025] In a possible implementation, the business module updates the first private key shard to a third private key shard, and specifically includes: the business module generating a key update parameter; the business module generating the third private key shard based on the key update parameter and the first private key shard; and the TEE updating the second private key shard to a fourth private key shard, and specifically includes: after receiving the key update parameter sent by the business module, the TEE generates the fourth private key shard based on the key update parameter and the second private key shard.

[0026] In a possible implementation, the method further includes: the business module generating third intermediate data based on the third private key shard and the ciphertext key; the business module sending a second decryption request to the TEE; the TEE generating fourth intermediate data based on the fourth private key shard after receiving the second decryption request; the TEE sending the fourth intermediate data to the business module; and the business module decrypting the real key from the ciphertext key based on the third intermediate data and the fourth intermediate data.

[0027] In a possible implementation, the ciphertext key is preset in the service module. In this way, the writing of the ciphertext key in the service module before the electronic device is shipped can be accelerated, and the efficiency of the electronic device shipping configuration can be improved.

[0028] In a possible implementation, the ciphertext key or the key metadata in the ciphertext key is preset in the TEE. In this way, the writing of the ciphertext key or the key metadata in the ciphertext key in the TEE before the electronic device is shipped can be accelerated, and the efficiency of the electronic device shipping configuration can be improved.

[0029] In a possible implementation, the ciphertext key or the key metadata in the ciphertext key is carried in the first decryption request. In this way, the service module can send the decryption request to the TEE, and carry the metadata of the ciphertext key in the decryption request, so that the TEE does not need to save the ciphertext key or the key metadata in the ciphertext key for a long time.

[0030] In a possible implementation, the ciphertext key or the key metadata in the ciphertext key is carried in the first decryption request. In this way, the service module can send the decryption request to the TEE, and carry the metadata of the ciphertext key in the decryption request, so that the TEE does not need to save the ciphertext key or the key metadata in the ciphertext key for a long time.

[0031] The data protection method provided by the embodiments of the present application can be applied to an electronic device including a service module and a processor. The processor includes a TEE. The service module stores ciphertext data encrypted by a real key. When performing a service, the service module needs to use the original data decrypted from the ciphertext data by the real key. The service module and the TEE in the processor use the private key fragments of the session private key stored respectively to participate in the decryption calculation of the ciphertext key, so as to decrypt the real key in the service module.

[0032] In this way, in the process of recovering the real key from the ciphertext key in the service module, the private key fragments stored respectively by the service module and the TEE in the processor are not exposed on the transmission link, the security of the private key fragments is improved, the security of the session private key is improved, and the security of the real key is improved. Moreover, the service module can form a binding relationship with the TEE in the processor. If either the service module or the TEE in the processor is imitated, the real key cannot be decrypted in the service module, so that the security of the original data is ensured.

[0033] In a possible implementation, the method further includes: the business module decrypts the original data from the ciphertext data using the real key.

[0034] In a possible implementation, the method further includes: after the original data is decrypted, the business module deletes the real key.

[0035] In a possible implementation, the method further includes: after the original data is used, the business module deletes the original data.

[0036] In a possible implementation, the electronic device further includes a security module; before the business module generates the first intermediate data based on the first private key fragment of the session private key and the ciphertext key, the method further includes: the security module disperses the session private key into the first private key fragment and the second private key fragment; the security module sends the first private key fragment to the business module; and the security module sends the second private key fragment to the TEE.

[0037] In a possible implementation, the method further includes: the security module encrypts the real key using the session public key to obtain the ciphertext key; and the security module sends the ciphertext key to the business module.

[0038] In a possible implementation, the session private key and the session public key are preset in the security module.

[0039] In a possible implementation, before the security module disperses the session private key into the first private key fragment and the second private key fragment, the method further includes: the security module generates the session private key and the session public key.

[0040] In a possible implementation, the electronic device further includes a security module; before the business module generates the first intermediate data based on the first private key fragment of the session private key and the ciphertext key, the method further includes: the business module and the TEE negotiate a private key fragment of the session private key and a public key fragment of the session public key, where the business module obtains the first private key fragment and the first public key fragment, and the TEE obtains the second private key fragment and the second public key fragment; the business module sends the first public key fragment to the security module; the TEE sends the second public key fragment to the security module; the security module generates the session public key based on the first public key fragment and the second public key fragment; the security module encrypts the real key using the session public key to obtain the ciphertext key; and the security module sends the ciphertext key to the business module.

[0041] In a possible implementation, the first decryption request carries the ciphertext key or key metadata in the ciphertext key. The sum of the first private key fragment and the second private key fragment is equal to the session private key, and the ciphertext key includes key metadata and encrypted ciphertext; the business module generates first intermediate data based on the first private key fragment of the session private key and the ciphertext key, specifically including: the business module performs elliptic curve scalar multiplication operation on the first private key fragment and the key metadata to obtain third blinded data, and the first intermediate data includes the third blinded data; the TEE generates second intermediate data based on the second private key fragment of the session private key after receiving the first decryption request, specifically including: the TEE performs elliptic curve scalar multiplication operation on the second private key fragment and the key metadata to obtain fourth blinded data after receiving the first decryption request, and the second intermediate data includes the fourth blinded data; the business module decrypts the real key from the ciphertext key based on the first intermediate data and the second intermediate data, specifically including: the business module adds the third blinded data and the fourth blinded data to obtain unblinded data; and the business module decrypts the real key from the encrypted ciphertext based on the unblinded data.

[0042] In this way, the business module and the TEE can participate in the calculation of the blinded data by using the private key fragments stored respectively, without directly transmitting the first private key fragment and the second private key fragment to each other, so that the unblinded data can be obtained in the business module, and the real key can be recovered in the business module. In this way, in the process of recovering the real key from the ciphertext key in the business module, the private key fragments stored respectively by the business module and the TEE are not exposed on the transmission link, the security of the private key fragments is improved, the security of the session private key is improved, and the security of the real key is improved, thereby improving the security of the original data.

[0043] In a possible implementation, the ciphertext key further includes verification data; the business module decrypts the real key from the encrypted ciphertext based on the unblinded data, specifically including: the business module determines a recovered key by using the unblinded data and the encrypted ciphertext; the business module verifies the verification data based on the unblinded data and the recovered key; and the business module determines the recovered key as the real key after verifying that the verification data is successful.

[0044] In a possible implementation, the ciphertext key is generated by encrypting the real key with the session public key, and specifically includes: generating a second random number; performing the elliptic curve scalar multiplication operation on the second random number as a private key and a base point on the elliptic curve to generate a public key corresponding to the second random number, and taking the public key corresponding to the second random number as the key metadata; performing the elliptic curve scalar multiplication operation on the second random number and the session public key to obtain unblinded data; deriving the intermediate key based on the unblinded data and the data length of the real key; and performing an exclusive OR operation on the intermediate key and the real key to obtain the encrypted ciphertext.

[0045] In a possible implementation, the method further includes: the business module updating the first private key shard into a third private key shard; and the TEE updating the second private key shard into a fourth private key shard, and a sum of the third private key shard and the fourth private key shard is equal to the session private key.

[0046] In a possible implementation, the business module updates the first private key shard into a third private key shard, and specifically includes: the business module generating a key update parameter; and the business module generating the third private key shard based on the key update parameter and the first private key shard; and the TEE updates the second private key shard into a fourth private key shard, and specifically includes: after receiving the key update parameter sent by the business module, the TEE generates the fourth private key shard based on the key update parameter and the second private key shard.

[0047] In a possible implementation, the method further includes: the business module generating third intermediate data based on the third private key shard and the ciphertext key; the business module sending a second decryption request to the TEE; the TEE generating fourth intermediate data based on the fourth private key shard after receiving the second decryption request; the TEE sending the fourth intermediate data to the business module; and the business module decrypting the real key from the ciphertext key based on the third intermediate data and the fourth intermediate data.

[0048] In a possible implementation, the ciphertext key is preset in the business module.

[0049] In a possible implementation, the ciphertext key or key metadata in the ciphertext key is preset in the TEE.

[0050] The second aspect and beneficial effects not described in possible implementations of the second aspect can refer to the first aspect and possible implementations of the first aspect, and will not be described here.

[0051] In a third aspect, the embodiments of the present application provide another data protection method, applied to a data protection system, the data protection system comprising a first node and a second node; the method comprising: the first node generating first intermediate data based on a first private key shard of a session private key and a ciphertext key, the ciphertext key being generated by a session public key encrypting a real key, the session public key and the session private key being a pair of public and private keys; the first node sending a first decryption request to the second node, the first decryption request carrying the first intermediate data; the second node generating second intermediate data based on the first intermediate data and a second private key shard of the session private key after receiving the first decryption request; the second node sending the second intermediate data to the first node; and the first node decrypting the real key from the ciphertext key based on the second intermediate data.

[0052] The data protection method provided by the embodiments of the present application is applied to a data protection system, the data protection system comprising a first node and a second node. The first node stores ciphertext data encrypted by a real key. When performing a service, the first node needs to use the real key to decrypt original data from the ciphertext data. The first node and the second node use private key shards of a session private key stored respectively by the first node and the second node to participate in decryption calculation of a ciphertext key, so that the real key is decrypted in the first node.

[0053] In this way, in the process of recovering the real key from the ciphertext key in the first node, the private key shards stored respectively by the first node and the second node are not exposed on a transmission link, the security of the private key shards is improved, the security of the session private key is improved, and the security of the real key is improved. Moreover, the first node can form a binding relationship with the second node. If either of the first node and the second node is imitated, the real key cannot be decrypted in the first node, so that the security of the original data is ensured.

[0054] In a possible implementation, the method further comprises: the first node decrypting original data from the ciphertext data using the real key. In this way, since the private key shards stored respectively by the first node and the second node are not exposed on the transmission link, the security of the private key shards is improved, the security of the real key is improved, and the security of the original data is improved.

[0055] In a possible implementation, the method further comprises: the first node deleting the real key after decrypting the original data. In this way, since the first node decrypts the real key in random memory, the real key can be deleted after the first node decrypts the original data, so that the leakage of the real key in the first node is prevented, and the security of the real key is improved.

[0056] In a possible implementation, the method further includes: deleting, by the first node, the original data after the first node uses the original data. In this way, since the original data is decrypted in the random memory of the first node, the original data can be deleted after the first node uses the original data, thereby preventing the original data from being leaked in the first node, and improving the security of the original data.

[0057] In a possible implementation, the data protection system further includes a third node; and before the first node generates the first intermediate data based on the first private key share of the session private key and the ciphertext key, the method further includes: dispersing, by the third node, the session private key into the first private key share and the second private key share; sending, by the third node, the first private key share to the first node; and sending, by the third node, the second private key share to the second node. In this way, the first private key share and the second private key share of the session key can be generated by the third node and sent to the first node and the second node, so that the first node and the second node each save a different private key share.

[0058] In a possible implementation, the method further includes: encrypting, by the third node, the real key using the session public key to obtain the ciphertext key; and sending, by the third node, the ciphertext key to the first node. In this way, before the ciphertext key is decrypted, the third node can encrypt the real key using the session public key to obtain the ciphertext key. The third node can send the ciphertext key to the first node for storage, so that the first node, the second node and the third node form a binding relationship.

[0059] In a possible implementation, the session private key and the session public key are pre-stored in the third node.

[0060] In a possible implementation, before the third node disperses the session private key into the first private key share and the second private key share, the method further includes: generating, by the third node, the session private key and the session public key.

[0061] In a possible implementation, the electronic device further includes a third node; and before the first node generates the first intermediate data based on the first private key share of the session private key and the ciphertext key, the method further includes: negotiating, by the first node and the second node, the private key share of the session private key and the public key share of the session public key, wherein the first node obtains the first private key share and the first public key share, and the second node obtains the second private key share and the second public key share; sending, by the first node, the first public key share to the third node; sending, by the second node, the second public key share to the third node; generating, by the third node, the session public key based on the first public key share and the second public key share; encrypting, by the third node, the real key using the session public key to obtain the ciphertext key; and sending, by the third node, the ciphertext key to the first node.

[0062] In this way, the first node and the second node can negotiate the private key share of the session private key and the public key share of the session public key, and the first node and the second node send the respective public key share to the third node. Thus, the third node can recover the session public key according to the public key share sent by the first node and the second node respectively, and encrypt the real key using the session public key. Thus, the private key share of the session private key is not exposed on the transmission link, ensuring the security of the private key share. In the process of recovering the real key from the ciphertext key by the first node, the private key share stored by the first node and the second node respectively is not exposed on the transmission link, improving the security of the private key share, and also improving the security of the session private key, and thus improving the security of the real key, thereby improving the security of the original data. Moreover, the first node can form a binding relationship with the second node and the third node, and if any of the first node, the second node and the third node is imitated, the first node cannot decrypt the real key, thereby ensuring the security of the real key.

[0063] In a possible implementation, the method further includes: the first node updates the first private key share to a third private key share; and the second node updates the second private key share to a fourth private key share, and the sum of the third private key share and the fourth private key share is equal to the session private key.

[0064] In a possible implementation, the first node updates the first private key share to a third private key share, and specifically includes: the first node generates a key update parameter; the first node generates the third private key share based on the key update parameter and the first private key share; and the second node updates the second private key share to a fourth private key share, and specifically includes: after receiving the key update parameter sent by the first node, the second node generates the fourth private key share based on the key update parameter and the second private key share.

[0065] Therefore, through the updating process of the private key share, the first node and the second node can negotiate to update the respective stored private key share, so that the updated private key share of the first node and the second node is not exposed on the transmission link, but the updated private key share of the first node and the second node can still participate in the decryption calculation of the ciphertext key, so that the first node can successfully decrypt the real key from the ciphertext key, and thus the first node can successfully decrypt the original data from the ciphertext data. In this way, the private key share stored by the first node and the second node can be updated, preventing the same private key share from being used for a long time, reducing the possibility of the private key share being leaked, and improving the security of the session private key.

[0066] In a possible implementation, the method further includes: the first node generating third intermediate data based on the third private key shard and the ciphertext key; the first node sending a second decryption request to the second node; the second node generating fourth intermediate data based on the fourth private key shard after receiving the second decryption request; the second node sending the fourth intermediate data to the first node; and the first node decrypting the real key from the ciphertext key based on the third intermediate data and the fourth intermediate data.

[0067] In a possible implementation, the ciphertext key is preset in the first node.

[0068] In a possible implementation, the ciphertext key or key metadata in the ciphertext key is preset in the second node.

[0069] In a possible implementation, the ciphertext key or key metadata in the ciphertext key is carried in the first decryption request.

[0070] In a possible implementation, the ciphertext key or key metadata in the ciphertext key is carried in the first decryption request.

[0071] The data protection method provided in the embodiments of the present application is applied to a data protection system including a first node and a second node. The first node stores ciphertext data encrypted by a real key. When performing a service, the first node needs to use the real key to decrypt original data from the ciphertext data. The first node and the second node use private key shards of respective session private keys stored by the first node and the second node to participate in decryption calculation of a ciphertext key, so that the real key is decrypted in the first node.

[0072] In this way, in the process of recovering the real key from the ciphertext key in the first node, the private key shards stored by the first node and the second node are not exposed on a transmission link, the security of the private key shards is improved, the security of the session private key is improved, and the security of the real key is improved. In addition, the first node can form a binding relationship with the second node. If either the first node or the second node is imitated, the real key cannot be decrypted in the first node, so that the security of the original data is ensured.

[0073] In a possible implementation, the method further includes: the first node decrypting original data from the ciphertext data using the real key.

[0074] In a possible implementation, the method further includes: the first node deleting the real key after decrypting the original data.

[0075] In a possible implementation, the method further includes: the first node deleting the original data after using the original data.

[0076] In a possible implementation, the data protection system further includes a third node; before the first node generates the first intermediate data based on the first private key shard of the session private key and the ciphertext key, the method further includes: the third node disperses the session private key into the first private key shard and the second private key shard; the third node sends the first private key shard to the first node; and the third node sends the second private key shard to the second node.

[0077] In a possible implementation, the method further includes: the third node encrypts the real key using the session public key to obtain the ciphertext key; and the third node sends the ciphertext key to the first node.

[0078] In a possible implementation, the session private key and the session public key are preset in the third node.

[0079] In a possible implementation, before the third node disperses the session private key into the first private key shard and the second private key shard, the method further includes: the third node generates the session private key and the session public key.

[0080] In a possible implementation, the ciphertext key is generated by encrypting the real key using the session public key, and specifically includes: generating a second random number; performing the elliptic curve scalar multiplication operation on a base point on the elliptic curve using the second random number as a private key, to generate a public key corresponding to the second random number, and taking the public key corresponding to the second random number as the key metadata; performing the elliptic curve scalar multiplication operation on the second random number and the session public key to obtain unblinded data; deriving the intermediate key based on the unblinded data and a data length of the real key; and performing an exclusive or operation on the intermediate key and the real key to obtain the encrypted ciphertext.

[0081] In a possible implementation, the method further includes: the first node updates the first private key shard to a third private key shard; and the second node updates the second private key shard to a fourth private key shard, wherein a sum of the third private key shard and the fourth private key shard is equal to the session private key.

[0082] In a possible implementation, the first node updates the first private key shard to a third private key shard, specifically comprising: the first node generates a key update parameter; the first node generates the third private key shard based on the key update parameter and the first private key shard; the second node updates the second private key shard to a fourth private key shard, specifically comprising: after receiving the key update parameter sent by the first node, the second node generates the fourth private key shard based on the key update parameter and the second private key shard.

[0083] In a possible implementation, the method further comprises: the first node generates third intermediate data based on the third private key shard and the ciphertext key; the first node sends a second decryption request to the second node; after receiving the second decryption request, the second node generates fourth intermediate data based on the fourth private key shard; the second node sends the fourth intermediate data to the first node; and the first node decrypts the real key from the ciphertext key based on the third intermediate data and the fourth intermediate data.

[0084] In a possible implementation, the ciphertext key is preset in the first node.

[0085] In a possible implementation, the ciphertext key or key metadata in the ciphertext key is preset in the second node.

[0086] In a possible implementation, the ciphertext key or key metadata in the ciphertext key is carried in the first decryption request.

[0087] The fourth aspect and beneficial effects not described in possible implementations of the fourth aspect can refer to the third aspect and possible implementations of the third aspect, and will not be described here.

[0088] In a possible implementation, the ciphertext key is preset in the first node.

[0089] In a possible implementation, the ciphertext key or key metadata in the ciphertext key is preset in the second node.

[0090] In a sixth aspect, an electronic device is provided, which includes one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are configured to store a computer program. When the one or more processors execute the computer program, the data protection method in any possible implementation of any of the aspects above is implemented.

[0091] In a seventh aspect, a computer readable storage medium is provided, which stores a computer program. When the computer program is run on a processor, the data protection method in any possible implementation of any of the aspects above is implemented.

[0092] In an eighth aspect, a computer program product is provided, which includes a computer program. When the computer program is run on a processor, the data protection method in any possible implementation of any of the aspects above is implemented.

[0093] In a ninth aspect, a chip system is provided, which includes a processing circuit and an interface circuit. The interface circuit is configured to receive code instructions and transmit the code instructions to the processing circuit. The processing circuit is configured to run the code instructions, so as to implement the data protection method in any possible implementation of any of the aspects above. BRIEF DESCRIPTION OF DRAWINGS

[0094] FIG. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present application;

[0095] FIG. 2 is a structural schematic diagram of a trusted execution environment of an electronic device according to an embodiment of the present application;

[0096] FIG. 3 is a flow schematic diagram of a data protection method according to an embodiment of the present application;

[0097] FIG. 4 is a specific flow schematic diagram of a data protection method according to an embodiment of the present application;

[0098] FIG. 5 is a flow schematic diagram of a data protection method according to another embodiment of the present application;

[0099] FIG. 6 is a specific flow schematic diagram of a data protection method according to another embodiment of the present application;

[0100] FIG. 7 is a process of updating a private key fragment according to an embodiment of the present application;

[0101] FIG. 8 is an architectural schematic diagram of a data protection system according to an embodiment of the present application;

[0102] FIG. 9 is a flow schematic diagram of a data protection method according to another embodiment of the present application. DETAILED DESCRIPTION

[0103] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " represents the meaning of or, for example, A / B can represent A or B; the "and / or" in the text only describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist together, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0104] Hereinafter, the terms "first" and "second" are only used for description purposes, and cannot be understood as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first" and "second" can explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" is two or more than two.

[0105] FIG. 1 shows a structural schematic diagram of an electronic device 100.

[0106] The embodiments will be specifically described below taking the electronic device 100 as an example. It should be understood that the electronic device 100 shown in FIG. 1 is only an example, and the electronic device 100 can have more or fewer components than those shown in FIG. 1, can combine two or more components, or can have a different component configuration. The various components shown in FIG. 1 can be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.

[0107] The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include one or more of a pressure sensor 180A, a gyro sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0108] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0109] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices or integrated in one or more processors. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions. The processor 110 can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can save instructions or data that have just been used or are repeatedly used by the processor 110. If the processor 110 needs to use the instructions or data again, it can directly call from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.

[0110] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0111] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation of the electronic device 100. In some other embodiments of the present application, the electronic device 100 can also use different interface connection modes or a combination of multiple interface connection modes in the above embodiments.

[0112] The charging management module 140 is configured to receive charging input from a charger. The power management module 141 is configured to connect the battery 142 and the charging management module 140. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.

[0113] The wireless communication function of the electronic device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor. The antenna 1 and the antenna 2 are configured to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0114] The mobile communication module 150 can provide a solution for wireless communication including 2G / 3G / 4G / 5G, etc. applied to the electronic device 100. The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1 and perform filtering, amplification, etc. on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can also amplify the signals modulated by the modem processor and convert them into electromagnetic waves radiated by the antenna 1. In some embodiments, at least part of the functional modules of the mobile communication module 150 can be arranged in the processor 110. In some embodiments, at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 can be arranged in the same device.

[0115] The wireless communication module 160 can provide a solution for wireless communication including wireless local area networks (WLAN) (e.g., wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, etc. applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives an electromagnetic wave via the antenna 2, frequency-modulates and filters the electromagnetic wave signal, and transmits the processed signal to the processor 110. The wireless communication module 160 can also receive a signal to be transmitted from the processor 110, frequency-modulate it, amplify it, and radiate it as an electromagnetic wave via the antenna 2.

[0116] In some embodiments, the antenna 1 and the mobile communication module 150 of the electronic device 100 are coupled, and the antenna 2 and the wireless communication module 160 are coupled, so that the electronic device 100 can communicate with a network and other devices through wireless communication technology. The wireless communication technology can include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS can include a global positioning system (GPS), a global navigation satellite system (GLONASS), a beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and / or a satellite based augmentation systems (SBAS).

[0117] The electronic device 100 implements a display function through a GPU, a display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, which is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs, which execute program instructions to generate or change display information.

[0118] The display screen 194 is configured to display images, videos, and the like. The display screen 194 includes a display panel. The display panel can be implemented by a liquid crystal display (LCD). The display screen panel can also be implemented by an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flex light-emitting diode (FLED), a miniled, a microled, a micro-oled, a quantum dot light emitting diodes (QLED), and the like. In some embodiments, the electronic device 100 can include one or N display screens 194, where N is a positive integer greater than 1.

[0119] The electronic device 100 can implement a photographing function through an ISP, the camera 193, a video codec, a GPU, the display screen 194, and an application processor.

[0120] The external memory interface 120 can be configured to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The internal memory 121 can be configured to store computer-executable program codes including instructions. The processor 110 performs various functional applications and data processing of the electronic device 100 by executing the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required for at least one function (such as a sound play function, an image play function, and the like), and the like. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phonebook, and the like), and the like. In addition, the internal memory 121 can include a high-speed random access memory, and can further include a non-volatile memory such as at least one of a magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.

[0121] The electronic device 100 can implement an audio function through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, and an application processor. For example, music play, recording, and the like.

[0122] The pressure sensor 180A is configured to sense a pressure signal and convert the pressure signal into an electrical signal. The gyro sensor 180B can be configured to determine a motion posture of the electronic device 100. The barometric sensor 180C is configured to measure atmospheric pressure. The magnetic sensor 180D includes a Hall sensor. The acceleration sensor 180E can detect the magnitude of acceleration of the electronic device 100 in various directions (typically, three axes). The distance sensor 180F is configured to measure a distance. The proximity light sensor 180G can include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The ambient light sensor 180L is configured to sense ambient light brightness. The fingerprint sensor 180H is configured to acquire a fingerprint. The temperature sensor 180J is configured to detect temperature. The touch sensor 180K, also referred to as a "touch panel," can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 can form a touch screen, also referred to as a "touch screen panel." The touch sensor 180K is configured to detect a touch operation applied thereto or in the vicinity thereof. The touch sensor 180K can transmit a detected touch operation to the application processor to determine a touch event type. Visual output related to the touch operation can be provided via the display screen 194. In other embodiments, the touch sensor 180K can be disposed on a surface of the electronic device 100, apart from the location of the display screen 194. The bone conduction sensor 180M can acquire a vibration signal. The keys 190 include a power key, a volume key, and the like. The motor 191 can generate a vibration prompt. The indicator 192 can be an indicator light configured to indicate a charging state, a power change, and the like, and can also be configured to indicate a message, a missed call, a notification, and the like.

[0123] The SIM card interface 195 is configured to connect a SIM card, which can also be referred to as a universal integrated circuit card (UICC). The SIM card can be connected to or disconnected from the electronic device 100 by being inserted into or pulled out of the SIM card interface 195. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195. The types of the multiple cards can be the same or different. The SIM card interface 195 can be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external storage cards. The electronic device 100 interacts with a network through the SIM card to implement functions such as call and data communication. In some embodiments, the electronic device 100 can use an embedded SIM (eSIM) module, which can also be referred to as an embedded universal integrated circuit card (eUICC) module. The eSIM module can be embedded in the electronic device 100 and cannot be separated from the electronic device 100. In some embodiments, the electronic device 100 can use an iSIM module, which can also be referred to as an integrated universal integrated circuit card (iUICC) module. The iUICC module is integrated into a chip (for example, a communication chip or a system on chip (SoC)) in the form of software.

[0124] In embodiments of the present application, the device type of the electronic device 100 can include any one of a mobile phone, a watch, a bracelet, a sound box, a personal computer, a television, a tablet computer, a smart socket, an air purifier, a table lamp, an air conditioner, a curtain, a water heater, a door lock, a camera, a server, and the like.

[0125] FIG. 2 is a structural diagram of a trusted execution environment of an electronic device according to an embodiment of the present application.

[0126] As shown in FIG. 2, the electronic device 100 can include a processor 201, a security module 202, and a service module 203. Two application environments, a rich execution environment (REE) and a trusted execution environment (TEE), can run in the CPU.

[0127] Among them, the application running in the REE can be referred to as a client application (CA), and the application running in the TEE can be referred to as a trusted application (TA). Among them, the trusted application in the TEE can include a decryption TA.

[0128] The operating system running in the REE can be referred to as a rich execution environment operating system (REE OS), and the operating system running in the TEE can be referred to as a trusted execution environment operating system (TEE OS). Among them, the TEE is a secure running environment running in the processor 201, and the secure startup process of the TEE needs to be verified, and its secure startup process is separated from the REE. Each application running in the TEE is independent of each other, and each application cannot access each other without authorization, ensuring that the processing process of the resources and data of the application in the TEE is executed in a trusted environment, thereby providing a secure service for the REE operating system. The TEE has its own execution space, which is higher than the security level of the REE operating system, and is a security architecture that overlaps with the hardware architecture of the currently used processor 201. The software and hardware resources accessible by the TEE are separated from the REE operating system, providing hardware-supported isolation. Among them, the decryption CA and the decryption TA share memory. If the decryption CA needs to communicate with the decryption TA, the decryption CA can apply to the TEE OS to establish a session with the requested decryption TA. After the session establishment between the decryption CA and the decryption TA is completed, the decryption CA can send a processing request and data to be processed to the decryption TA through the shared memory. After the decryption TA obtains the processing request and data to be processed of the decryption CA from the shared memory, it can execute the processing request in the TEE environment, and the processing result obtained is stored in the shared memory. The decryption CA can obtain the processing result of the decryption TA through the shared memory. After obtaining the processing result, if the decryption CA does not need the decryption TA to continue processing, the decryption CA can initiate a request to close the session (close session) to the TEE OS. After receiving the request to close the session (close session), the TEE OS can recycle the related resources of the decryption TA.

[0129] The TEE has a root of trust mechanism, which can securely store unencrypted plaintext data.

[0130] The security module 202 has a root of trust mechanism, which can securely store unencrypted plaintext data. The security module 202 can store a real key (MK). Among them, the real key (MK) can be used to decrypt the original data from the ciphertext data stored in the business module 203.

[0131] In a possible implementation, the real key (MK) can be pre-stored in the security module 202 before the electronic device 100 is shipped.

[0132] In another possible implementation, the real key (MK) can be written into the security module 202 through an over-the-air technology (OTA) after the electronic device 100 is shipped.

[0133] The security module 202 can encrypt the real key (MK) by using a session public key (PK) through an encryption algorithm to obtain a ciphertext key (C MK). The encryption algorithm can be an SM2 algorithm. The security module 202 can send the ciphertext key (C MK) to the business module 203 through a communication interface (for example, a serial peripheral interface (SPI), an integrated circuit (I2C) interface, an improved inter-integrated circuit (I3C) interface, or the like). For example, the communication interface between the security module 202 and the business module 203 can adopt a communication interface standard such as “ISO 7816”.

[0134] The business module 203 can store the ciphertext data, the ciphertext key (C MK), and a private key fragment 1 (KEY SK 1) of a session private key (SK). The ciphertext data is obtained by encrypting original data by using the real key (MK). The business module 203 needs to use the original data to perform a business.

[0135] In a possible implementation, the ciphertext data can be pre-stored in the business module 203 before the electronic device 100 is shipped.

[0136] In another possible implementation, the ciphertext data can be written into the business module 203 through an OTA after the electronic device 100 is shipped.

[0137] When the business module 203 needs to use the original data, the business module 203 can generate intermediate data 1 by using the private key fragment 1 (KEY SK 1) and the ciphertext key (C MK) through a security algorithm program and send the intermediate data 1 to the TEE. For example, the security algorithm program can be a software development kit (SDK) of a multi-party computation (MPC) security algorithm.

[0138] The TEE can store the private key fragment 2 (KEY_SK_2). After receiving the intermediate data 1, the TEE can generate intermediate data 2 based on the private key fragment 2 (KEY_SK_2) and the intermediate data 1 through the encryption and decryption TA, and send the intermediate data 2 to the business module 203.

[0139] The business module 203 can recover the real key (MK) based on the intermediate data 2 and the ciphertext key (C_MK) through the security algorithm program. After recovering the real key (MK), the business module 203 can decrypt the original data from the ciphertext data based on the real key (MK).

[0140] After decrypting the original data, the business module 203 can delete the real key (MK). After using the original data, the business module 203 can delete the original data. In this way, after decrypting the original data through the recovered real key (MK), the business module 203 deletes the real key (MK) in time, which can avoid the real key (MK) from being leaked from the business module 203. After using the original data, the business module 203 deletes the original data in time, which can avoid the original data from being leaked from the business module 203, and improves the security of the original data.

[0141] In a possible implementation, the security module 202 can generate a session private key (SK) and a session public key (PK), where the session public key (PK) and the session private key (SK) are a pair of public and private keys. Then, the security module 202 can disperse the session private key (SK) into a private key fragment 1 (KEY_SK_1) and a private key fragment 2 (KEY_SK_2). The security module 202 can send the private key fragment 1 (KEY_SK_1) to the business module 203, and send the private key fragment 2 (KEY_SK_2) to the TEE.

[0142] In a possible implementation, the TEE can first negotiate the private key shard of the session private key (SK) and the public key shard of the session public key (PK) with the business module 203. After the TEE negotiates the private key shard of the session private key (SK) with the business module 203, the business module 203 can obtain the private key shard 1 (KEY_SK_1) and the public key shard 1 (KEY_PK_1), and the TEE can obtain the private key shard 2 (KEY_SK_2) and the public key shard 2 (KEY_PK_2). The business module 203 can send the public key shard 1 (KEY_PK_1) to the security module 202. The TEE can send the public key shard 2 (KEY_PK_2) to the security module 202. After obtaining the public key shard 1 (KEY_PK_1) and the public key shard 2 (KEY_PK_2), the security module 202 can recover the session public key (PK) based on the public key shard 1 (KEY_PK_1) and the public key shard 2 (KEY_PK_2). The security module 202 can encrypt the real key (MK) using the session public key (PK) to obtain the ciphertext key (C_MK). Then, the security module 202 can send the ciphertext key (C_MK) to the business module 203.

[0143] In a possible implementation, the ciphertext data can be the encrypted image data in the business module 203, and the original data can be a business program. After the business module 203 decrypts the business program from the program image (image), the business module 203 can run the business program in the memory (random access memory, RAM) to perform the business. For example, the business module 203 can be a communication chip, and the business performed by the business module 203 can be a communication business. The communication chip can include any one of a cellular communication chip, a Wi-Fi communication chip, a Bluetooth communication chip, a satellite communication chip, and the like.

[0144] In a possible implementation, the security module 202 can be any one of a SIM card, an eSIM module, an iSIM module, and a secure element (SE) chip.

[0145] In a possible implementation, if the security module 202 is any one of a SIM card, an eSIM module, an iSIM module, and the like, the security module 202 can communicate with the TEE of the processor 201 through modules such as a mobile communication chip (for example, a modem), a REE of the processor 201, and a TA for encryption and decryption of the TEE of the processor 201.

[0146] For example, the security module 202 can communicate with the TEE of the processor 201 through a mobile communication chip (e.g., a modem), a telephony module (not shown in FIG. 2) in the REE of the processor 201, a ciphering CA, and a ciphering TA in the TEE of the processor 201, and the like.

[0147] In a possible implementation, if the security module 202 is a secure element (SE) chip, the security module 202 can communicate with the TEE of the processor 201 through the REE of the processor 201, and a ciphering TA in the TEE of the processor 201, and the like.

[0148] For example, the security module 202 can communicate with the TEE of the processor 201 through an open mobile API (OMAPI) interface (not shown in FIG. 2) in the REE, a ciphering CA, and a ciphering TA in the TEE of the processor 201, and the like.

[0149] In a possible implementation, the service module 203 can communicate with the TEE of the processor 201 through the REE of the processor 201, and a ciphering TA in the TEE of the processor 201, and the like.

[0150] In a possible implementation, the service module 203 and the TEE of the processor 201 can communicate through a shared memory.

[0151] In a possible implementation, the service module 203 and the processor 201 can not be on the same system on chip (SoC).

[0152] In a possible implementation, the service module 203 and the processor 201 can be on the same system on chip (SoC).

[0153] In a possible implementation, the service module 203 does not have a root of trust mechanism, and cannot securely store unencrypted plaintext data.

[0154] In a possible implementation, the service module 203 can also include both REE and TEE execution environments. Therefore, the security algorithm program, the ciphertext key (C_MK), the ciphertext data, and the private key fragment 1 (KEY_SK_1) of the session private key (SK) in the service module 203 can be stored in the TEE of the service module 203, thereby improving the security of data in the service module 203. The TEE of the service module 203 and the TEE of the processor 201 can cooperatively decrypt the ciphertext key (C_MK).

[0155] In some embodiments, the ciphertext key (C MK) and the private key shard 1 (KEY SK 1) can be pre-stored in the service module 203. For example, the ciphertext key (C MK) and the private key shard 1 (KEY SK 1) can be pre-stored in the service module 203 before the electronic device 100 is manufactured. For another example, the ciphertext key (C MK) and the private key shard 1 (KEY SK 1) can be downloaded into the service module 203 by an OTA technology after the electronic device 100 is manufactured. The private key shard 2 (KEY SK 2) can be pre-stored in the TEE of the processor 201. For example, the private key shard 2 (KEY SK 2) can be pre-stored in the TEE of the processor 201 before the electronic device 100 is manufactured. For another example, the private key shard 2 (KEY SK 2) can be downloaded into the TEE of the processor 201 by an OTA technology after the electronic device 100 is manufactured. In this way, the service module 203 and the TEE of the processor 201 can decrypt the ciphertext key and the ciphertext data in the service module 203 without the participation of the security module 202.

[0156] The data protection method provided by the embodiments of the present application can be applied to the electronic device 100 including the service module 203 and the processor 201. The processor 201 includes a TEE. The service module 203 stores ciphertext data encrypted by a real key. When performing a service, the service module 203 needs to use the original data decrypted from the ciphertext data by the real key. The service module 203 and the TEE of the processor 201 participate in the decryption calculation of the ciphertext key by using the private key shards of the session private keys stored respectively, so as to decrypt the real key in the service module 203, and then decrypt the original data from the ciphertext data by the real key. Optionally, the electronic device 100 can further include the security module 202. Before decrypting the ciphertext key, the security module 202 can encrypt the real key by using the session public key to obtain the ciphertext key. The security module 202 can send the ciphertext key to the service module 203 for storage.

[0157] In this way, in the process of recovering the real key (MK) from the ciphertext key (C MK) in the service module 203, the private key shards stored respectively by the service module 203 and the TEE of the processor 201 are not exposed on the transmission link, the security of the private key shards is improved, the security of the session private key is improved, and the security of the real key (MK) is improved, so as to improve the security of the original data. Moreover, the service module 203 can form a binding relationship with the TEE of the processor 201. If either the service module 203 or the TEE of the processor 201 is imitated, the real key cannot be decrypted in the service module 203, so as to ensure the security of the original data.

[0158] A data protection method is provided in embodiments of the present application.

[0159] FIG. 3 shows a flow diagram of a data protection method provided in embodiments of the present application.

[0160] As shown in FIG. 3, the data protection method can be applied to an electronic device 100 including a processor 201, a security module 202 and a service module 203. The processor 201 can run a TEE.

[0161] The data protection method can include the following steps:

[0162] S301. The security module 202 stores a real key (MK).

[0163] In one possible implementation, the real key (MK) can be pre-stored in the security module 202 before the electronic device 100 is shipped.

[0164] In another possible implementation, the real key (MK) can be written into the security module 202 through OTA.

[0165] S302. The service module 203 stores ciphertext data but does not store the real key (MK), wherein the ciphertext data is obtained by encrypting original data with the real key (MK).

[0166] In one possible implementation, the ciphertext data can be pre-stored in the service module 203 before the electronic device 100 is shipped.

[0167] In another possible implementation, the ciphertext data can be written into the service module 203 through OTA after the electronic device 100 is shipped.

[0168] S303. The security module 202 generates a session public key (PK) and a session private key (SK), wherein the session public key (PK) and the session private key (SK) form a pair of public and private keys.

[0169] The security module 202 can generate a random number as the session private key (SK). The security module 202 can generate the session public key (PK) corresponding to the session private key (SK) through an elliptic curve algorithm based on the session private key (SK). For example, the security module 202 can perform elliptic curve scalar multiplication operation on the session private key (SK) and a base point G on the elliptic curve to obtain the session public key (PK).

[0170] S304. The security module 202 encrypts the real key (MK) using the session public key (PK) to obtain a ciphertext key (C_MK).

[0171] In a possible implementation, the security module 202 can encrypt the real key (MK) by using a session public key (PK) through an elliptic curve-based public key cryptography algorithm (for example, SM2) to obtain a ciphertext key (C MK).

[0172] S305. The security module 202 disperses the session private key (SK) into a private key shard 1 (KEY SK 1) and a private key shard 2 (KEY SK 2).

[0173] In a possible implementation, the security module 202 can employ an additive secret sharing mechanism to disperse the session private key (SK) into the private key shard 1 (KEY SK 1) and the private key shard 2 (KEY SK 2).

[0174] For example, the relationship between the session private key (SK) and the private key shard 1 (KEY SK 1) and the private key shard 2 (KEY SK 2) can satisfy the following formula (1): d = d1 + d2 formula (1)

[0175] In the above formula (1), d is the session private key (SK), d1 is the private key shard 1 (KEY SK 1), and d2 is the private key shard 2 (KEY SK 2).

[0176] S306. The security module 202 sends the ciphertext key (C MK) and the private key shard 1 (KEY SK 1) to the business module 203.

[0177] For example, the communication interface between the security module 202 and the business module 203 can employ a communication standard such as “ISO 7816”. The security module 202 can send the ciphertext key (C MK) and the private key shard 1 (KEY SK 1) to the business module 203 through the communication interface.

[0178] S307. The business module 203 stores the ciphertext key (C MK) and the private key shard 1 (KEY SK 1).

[0179] For example, the business module 203 can store the ciphertext key (C MK) and the private key shard 1 (KEY SK 1) in a non-volatile memory inside the business module 203, for example, a flash memory.

[0180] S308. The security module 202 sends the private key shard 2 (KEY SK 2) to the TEE.

[0181] The security module 202 can first establish a secure channel with the TEE. Then, the security module 202 sends the private key shard 2 (KEY_SK_2) to the TEE through the secure channel.

[0182] S309. The TEE stores the private key shard 2 (KEY_SK_2).

[0183] S310. The service module 203 detects a trigger condition for using the original data.

[0184] For example, if the service module 203 is a communication chip, the original data can be a program image (image) in the communication chip, and the trigger condition can be that the service module 203 obtains a request to perform a communication service.

[0185] S311. After detecting the trigger condition for using the original data, the service module 203 generates intermediate data 1 based on the private key shard 1 (KEY_SK_1) and the ciphertext key (C_MK).

[0186] The service module 203 can use a secure algorithm program (for example, an MPC algorithm SDK) to generate the intermediate data 1 based on the private key shard 1 (KEY_SK_1) and the ciphertext key (C_MK).

[0187] For example, the algorithm for generating the intermediate data 1 can be as shown in the following formula (2): Mid1 = PKE_MPC1(C_MK, KEY_SK_1) Formula (2)

[0188] In the above formula (2), Mid1 is the intermediate data 1, “PKE_MPC1()” is an MPC algorithm operation function used by the secure algorithm program in the service module 203, C_MK is the ciphertext key, and KEY_SK_1 is the private key shard 1.

[0189] S312. The service module 203 sends a decryption request to the TEE, wherein the decryption request carries the intermediate data 1.

[0190] S313. The TEE determines intermediate data 2 based on the intermediate data 1 and the private key shard 2 (KEY_SK_2).

[0191] The TEE can use a decryption TA (for example, an MPC TA) to generate the intermediate data 2 based on the intermediate data 1 and the private key shard 2 (KEY_SK_2).

[0192] For example, the algorithm for generating the intermediate data 2 can be as shown in the following formula (3): Mid2 = PKE_MPC2(Mid1, KEY_SK_2) Formula (3)

[0193] In the above formula (3), Mid1 is the intermediate data 1, Mid2 is the intermediate data 2, "PKE_MPC2()" is an MPC algorithm operation function used by the encryption and decryption TA in the TEE. C_MK is the ciphertext key, which can be an input of the MPC algorithm operation function used by the encryption and decryption TA. KEY_SK_2 is the private key shard 2, which can be another input of the MPC algorithm operation function used by the encryption and decryption TA.

[0194] S314. The TEE sends the intermediate data 2 to the service module 203.

[0195] S315. The service module 203 determines the real key (MK) based on the intermediate data 2 and the ciphertext key (C_MK).

[0196] The service module 203 can use a secure algorithm program (for example, an MPC algorithm SDK) to determine the real key (MK) based on the intermediate data 2 and the ciphertext key (C_MK).

[0197] For example, the algorithm for determining the real key can be shown in the following formula (4): MK = Evaluator_MPC1(C_MK, Mid2) Formula (4)

[0198] In the above formula (4), MK is the real key, "Evaluator_MPC1()" is an MPC decryption algorithm function used by the secure algorithm program in the service module 203. C_MK is the ciphertext key, which can be an input of the MPC decryption algorithm function used by the secure algorithm program. Mid2 is the intermediate data 2, which can be another input of the decryption function used by the secure algorithm program.

[0199] The secure algorithm program runs in the random memory (RAM) of the service module 203, and the real key (MK) decrypted by the secure algorithm program is also temporarily stored in the random memory (RAM).

[0200] In some embodiments, after detecting the trigger condition of using the original data, the business module 203 can generate the intermediate data 1 based on the ciphertext key (C MK) and the private key shard 1, and send a decryption request to the TEE. In the decryption request, the intermediate data 1 can not be carried. After receiving the decryption request, the TEE can use a secure algorithm program to generate the intermediate data 2 based on the private key shard 2. Specifically, the TEE can generate the intermediate data 2 based on the key metadata C1 in the ciphertext key (C MK) and the private key shard 2. Then, the TEE can send the intermediate data 2 to the business module 203. The business module 203 can decrypt the real key (MK) from the ciphertext key (C MK) based on the intermediate data 1 and the intermediate data 2. Optionally, the TEE can be pre-installed with the ciphertext key (C MK). Alternatively, the decryption request can carry the ciphertext key (C MK).

[0201] For example, the algorithm for generating the intermediate data 2 can be shown in the following formula (5): Mid2 = PKE_MPC3(C MK, KEY_SK_2) Formula (5)

[0202] In the above formula (5), Mid2 is the intermediate data 2, “PKE_MPC3()” is an MPC algorithm operation function used by the encryption and decryption TA, C MK is the ciphertext key, and KEY_SK_2 is the private key shard 2.

[0203] For example, the algorithm for determining the real key (MK) can be shown in the following formula (6): MK = Evaluator_MPC2(C MK, Mid1, Mid2) Formula (6)

[0204] In the above formula (6), MK is the real key, “Evaluator_MPC2()” is another MPC decryption algorithm function used by the secure algorithm program in the business module 203. C MK is the ciphertext key, which can be used as an input of the MPC decryption algorithm function used by the secure algorithm program. Mid1 is the intermediate data 1, which can be used as another input of the decryption function used by the secure algorithm program. Mid2 is the intermediate data 2, which can be used as another input of the decryption function used by the secure algorithm program.

[0205] The secure algorithm program runs in the random memory (RAM) of the business module 203, and the real key (MK) decrypted by the secure algorithm program is also temporarily stored in the random memory (RAM).

[0206] S316. The business module 203 uses the real key (MK) to decrypt the original data from the ciphertext data.

[0207] The business module 203 can decrypt the original data from the cipher data using the real key (MK) in a random memory (RAM) in the business module 203.

[0208] For example, the process of decrypting the original data from the cipher data using the real key (MK) can be shown in the following formula (7): Data_plain = ENC(MK, Data_cipher) Formula (7)

[0209] In the above formula (7), Data_plain is the original data, “ENC()” is a decryption algorithm function of the real key, for example, the real key can be encrypted and decrypted by using “SM4 algorithm”. C_MK is the cipher key. MK can be used as an input of the decryption algorithm function of the real key. Data_cipher is the cipher data, and Data_cipher can be used as another input of the decryption algorithm function of the real key.

[0210] S317. The business module 203 deletes the real key (MK) after decrypting the original data.

[0211] Since the business module 203 decrypts the real key (MK) in the random memory (RAM), the real key (MK) can be deleted after the business module 203 decrypts the original data, thereby preventing the real key (MK) from being leaked in the business module 203, and improving the security of the real key (MK).

[0212] S318. The business module 203 deletes the original data after using the original data.

[0213] For example, if the business module 203 is a communication chip, the cipher data can be encrypted image data in the communication chip, and the original data can be a business program. The business module 203 can decrypt the business program from the program image (image) and run the business program in the memory to perform the communication business.

[0214] Since the business module 203 decrypts the original data in the random memory (RAM), the original data can be deleted after the business module 203 uses the original data, thereby preventing the original data from being leaked in the business module 203, and improving the security of the original data.

[0215] In a possible implementation, before the electronic device 100 is shipped, the encryption machine device can derive the session public key from the security module 202, and then encrypt the real key (MK) into a ciphertext key (C MK). The encryption machine device can write the ciphertext key (C MK) into the service module 203 for storage. In this way, the security module 202 can not send the ciphertext key (C MK) to the service module 203. After the electronic device 100 is shipped, the security module 202 can re-encrypt the real key (MK) using the updated session public key after the session public key and the session private key are updated, to obtain an updated ciphertext key. The security module 202 can generate two updated private key shards based on the updated session private key, and then send one of the updated private key shards and the updated ciphertext key to the service module 203, and send the other updated private key shard to the TEE in the processor 201. In this way, the writing of the ciphertext key in the service module 203 before the electronic device 100 is shipped can be accelerated, and the efficiency of the electronic device 100 shipping configuration can be improved.

[0216] The data protection method provided by the embodiment of the present application can be applied to the electronic device 100 including the TEE and the service module 203. The security module 202 can generate a session public key and a session private key, and disperse a private key shard 1 and a private key shard 2 based on the session private key. The security module 202 can send the private key shard 1 to the service module 203 for storage, and send the private key shard 2 to the TEE for storage. The security module 202 can encrypt the real key using the session public key to obtain a ciphertext key. The security module 202 can send the ciphertext key to the service module for storage. The service module 203 and the TEE participate in the decryption calculation of the ciphertext key using the private key shard of the session private key stored respectively, so as to decrypt the real key in the service module 203, and then decrypt the original data from the ciphertext data through the real key.

[0217] In this way, in the process of recovering the real key (MK) from the ciphertext key (C MK) in the service module 203, the private key shards stored respectively by the service module 203 and the TEE are not exposed on the transmission link, the security of the private key shards is improved, the security of the session private key is improved, and the security of the real key (MK) is improved, so as to improve the security of the original data. In addition, the service module 203 can form a binding relationship with the TEE, and if any of the service module 203 and the TEE is imitated, the real key cannot be decrypted in the service module 203, so as to ensure the security of the original data.

[0218] It should be noted that in some examples, the above intermediate data 1 can be referred to as first intermediate data, the above intermediate data 2 can be referred to as second intermediate data, the above private key fragment 1 (KEY_SK_1) can be referred to as a first private key fragment, and the above private key fragment 2 (KEY_SK_2) can be referred to as a second private key fragment.

[0219] The following describes a specific flow of the data protection method provided in the embodiments of the present application, based on the flow of the data protection method shown in FIG. 3 and in combination with the encryption and decryption processes of the real key.

[0220] FIG. 4 shows a specific flow diagram of a data protection method provided in the embodiments of the present application.

[0221] As shown in FIG. 4, the data protection method can be applied to an electronic device 100 including a processor 201, a security module 202, and a business module 203. The TEE can be run in the processor 201. The data protection method can include the following steps:

[0222] S401. The security module 202 stores a real key (MK).

[0223] S402. The business module 203 stores ciphertext data but does not store the real key (MK), wherein the ciphertext data is obtained by encrypting original data with the real key (MK).

[0224] S403. The security module 202 generates a session public key (PK) and a session private key (SK).

[0225] The steps S401 and S403 can refer to the steps S301 to S303 in the embodiment shown in FIG. 3, and will not be described here.

[0226] S404. The security module 202 encrypts the real key (MK) using the session public key (PK) to obtain a ciphertext key (C_MK), wherein the ciphertext key (C_MK) includes key metadata C1, encrypted ciphertext C2, and verification data C3.

[0227] The process of encrypting the real key (MK) into the ciphertext key (C_MK) by the security module 202 using the session public key (PK) can include the following steps:

[0228] 1. The security module 202 can first generate a random number k2, wherein k2 is a positive integer.

[0229] 2. The security module 202 can generate a public key corresponding to the random number k2 by an elliptic curve algorithm using the random number k2 as a private key, and take the public key corresponding to the random number k2 as the key metadata C1.

[0230] For example, the key metadata C1may be determined by the following equation (8): C1= (x1, y1) = [k2]G Equation (8)

[0231] In the above equation (8), G is a base point on an elliptic curve, and [k2]G represents an elliptic curve scalar multiplication operation of the random number k2and the base point G. x1represents a horizontal coordinate of a point on the elliptic curve obtained after the elliptic curve scalar multiplication operation of the random number k2and the base point G, and y1represents a vertical coordinate of the point on the elliptic curve obtained after the elliptic curve scalar multiplication operation of the random number k2and the base point G. That is, the key metadata C1includes the horizontal coordinate and the vertical coordinate of the point on the elliptic curve obtained after the elliptic curve scalar multiplication operation of the random number k2and the base point G.

[0232] 3. The security module 202 can perform an elliptic curve scalar multiplication operation of the random number k2and the session public key (PK) to obtain unblinded data. For example, the unblinded data can be determined by the following equation (9): (x2, y2) = [k2]PK Equation (9)

[0233] In the above equation (9), [k2]PK represents an elliptic curve scalar multiplication operation of the random number k2and the session public key (PK). (x2, y2) is the unblinded data, where x2is a horizontal coordinate of a point on the elliptic curve obtained after the elliptic curve scalar multiplication operation of the random number k2and the session public key (PK), and y2is a vertical coordinate of the point on the elliptic curve obtained after the elliptic curve scalar multiplication operation of the random number k2and the session public key (PK).

[0234] 4. The security module 202 derives an intermediate key based on the unblinded data and a data length n (in bits) of the real key (MK).

[0235] For example, the intermediate key can be determined by the following equation (10): t = KDF(x2‖y2, n) Equation (10)

[0236] In the above equation (10), t is the intermediate key, and "KDF()" is a key derivation function. x2is the horizontal coordinate in the above unblinded data, and y2is the vertical coordinate in the above unblinded data. x2‖y2represents a value obtained by concatenating the vertical coordinate in the above unblinded data after the horizontal coordinate in the above unblinded data, and x2‖y2may be used as one input of the key derivation function. n is the data length of the real key (MK) in bits (bit), and n can be used as another input of the key derivation function. The key derivation function can generate the intermediate key t with a data length of n bits according to x2‖y2.

[0237] In which, the data length of the intermediate key t is also n.

[0238] 5、The security module 202 can obtain the encrypted ciphertext C2 based on the intermediate key and the real key (MK).

[0239] For example, the encrypted ciphertext C2 can be determined by the following formula (11): C2 = t ^ MK formula (11)

[0240] In the above formula (11), C2 is the encrypted ciphertext, t is the intermediate key, MK is the real key, and t ^ MK represents the exclusive OR operation of the intermediate key and the real key (MK).

[0241] Since the data length of the real key (MK) and the data length of the intermediate key t are both n, the data length of the encrypted ciphertext C2 obtained after the operation of the above formula (11) is also n.

[0242] 6、The security module 202 can determine the check data C3 based on the unblinded data and the real key.

[0243] For example, the intermediate key can be determined by the following formula (12): C3 = Hash (x2 || MK || y2) formula (12)

[0244] In the above formula (12), C3 is the check data, MK is the real key, x2 is the abscissa in the above unblinded data, and y2 is the ordinate in the above unblinded data. x2 || MK || y2 represents concatenating the real key (MK) after the abscissa x2 in the above unblinded data, and then concatenating the ordinate y2 in the above unblinded data after the real key (MK). "Hash()" represents a hash operation function.

[0245] 7、The security module 202 can obtain the ciphertext key (C_MK) after determining the key metadata C1, the encrypted ciphertext C2 and the check data C3.

[0246] The security module 202 can assemble the key metadata C1, the encrypted ciphertext C2 and the check data C3 into the ciphertext key (C_MK) according to a fixed format. For example, the first part of the ciphertext key (C_MK) can be the key metadata C1, the second part of the ciphertext key (C_MK) after the first part can be the encrypted ciphertext C2, and the third part of the ciphertext key (C_MK) after the second part can be the check data C3.

[0247] S405. The security module 202 disperses the session private key (SK) into the private key fragment 1 (KEY_SK_1) and the private key fragment 2 (KEY_SK_2).

[0248] S406. The security module 202 sends the ciphertext key (C_MK) and the private key fragment 1 (KEY_SK_1) to the business module 203.

[0249] S407. The business module 203 stores the ciphertext key (C MK) and the private key shard 1 (KEY SK 1).

[0250] S408. The security module 202 sends the private key shard 2 (KEY SK 2) to the TEE.

[0251] S409. The TEE stores the private key shard 2 (KEY SK 2).

[0252] S410. The business module 203 detects a trigger condition for using the original data.

[0253] The steps S405 to S410 can refer to the steps S305 to S310 in the embodiment shown in FIG. 3, and will not be described here again.

[0254] S411. After detecting the trigger condition for using the original data, the business module 203 generates a random number k1, and determines the blinded data 1 based on the private key shard 1 (KEY SK 1), the random number k1, and the key metadata C1 in the ciphertext key (C MK).

[0255] The business module 203 can add the private key shard 1 (KEY SK 1) and the random number k1 together, and perform an elliptic curve scalar multiplication operation on the key metadata C1 to obtain the blinded data 1.

[0256] For example, the blinded data 1 can be determined by the following formula (13): R1=[d1+k1]C1 Formula (13)

[0257] In the above formula (13), R1 is the blinded data 1, d1 is the private key shard 1 (KEY SK 1), and C1 is the key metadata.

[0258] S412. The business module 203 sends a decryption request to the TEE, wherein the decryption request carries the intermediate data 1, and the intermediate data 1 includes the blinded data 1.

[0259] S413. The TEE determines the blinded data 2 based on the blinded data 1, the key metadata C1, and the private key shard 2 (KEY SK 2).

[0260] Optionally, the TEE can store the ciphertext key (C MK) or the key metadata C1 in the ciphertext key (C MK), which can be sent by the security module 202, or pre-stored in the TEE before leaving the factory, or downloaded to the TEE through OTA after leaving the factory.

[0261] Optionally, the decryption request can carry the ciphertext key (C_MK) or the key metadata C1 in the ciphertext key (C_MK) in addition to the intermediate data 1.

[0262] In the above formula (14), R2 is the blinded data 2, R1 is the blinded data 1, d2 is the private key fragment 2 (KEY_SK_2), and C1 is the key metadata.

[0263] In the above formula (14), R2 is the blinded data 2, R1 is the blinded data 1, d2 is the private key fragment 2 (KEY_SK_2), and C1 is the key metadata.

[0264] In the above formula (14), R2 is the blinded data 2, R1 is the blinded data 1, d2 is the private key fragment 2 (KEY_SK_2), and C1 is the key metadata.

[0265] S414. The TEE sends the intermediate data 2 to the service module 203, wherein the intermediate data 2 includes the blinded data 2.

[0266] S415. The service module 203 determines the deblinded data based on the blinded data 2, the random number k1, and the key metadata C1.

[0267] In the above formula (14), R2 is the blinded data 2, R1 is the blinded data 1, d2 is the private key fragment 2 (KEY_SK_2), and C1 is the key metadata.

[0268] In the above formula (14), R2 is the blinded data 2, R1 is the blinded data 1, d2 is the private key fragment 2 (KEY_SK_2), and C1 is the key metadata.

[0269] In the above formula (14), R2 is the blinded data 2, R1 is the blinded data 1, d2 is the private key fragment 2 (KEY_SK_2), and C1 is the key metadata.

[0270] In the above formula (14), R2 is the blinded data 2, R1 is the blinded data 1, d2 is the private key fragment 2 (KEY_SK_2), and C1 is the key metadata.

[0271] In the above formula (14), R2 is the blinded data 2, R1 is the blinded data 1, d2 is the private key fragment 2 (KEY_SK_2), and C1 is the key metadata.

[0272] In the above formula (14), R2 is the blinded data 2, R1 is the blinded data 1, d2 is the private key fragment 2 (KEY_SK_2), and C1 is the key metadata.

[0273] wherein, in the above formula (17), (x2, y2) is the unblinded data, d is the session private key (SK), and G is a base point on an elliptic curve.

[0274] Since the session private key (SK) and the session public key (PK) are a pair of public and private keys, the session public key (PK) is obtained by performing an elliptic curve scalar multiplication operation on the session private key (SK) and the base point G on the elliptic curve, that is, [d]G is the session public key (PK). Therefore, the above formula (17) is equivalent to the above formula (9), and the above formula (17) is derived from the above formula (15), that is, the above formula (15) is equivalent to the above formula (9).

[0275] In summary, the business module 203 and the TEE can participate in the calculation of the blinded data 1 and the blinded data 2 by using the respective stored private key fragments, without directly transmitting the private key fragment 1 and the private key fragment 2 to each other, so as to obtain the unblinded data in the business module 203, thereby recovering the real key (MK) in the business module 203. In this way, in the process of recovering the real key (MK) from the ciphertext key (C_MK) in the business module 203, the private key fragments stored in the business module 203 and the TEE are not exposed on the transmission link, which improves the security of the private key fragments, and also improves the security of the session private key, and further improves the security of the real key (MK), thereby improving the security of the original data. Moreover, by introducing the random number k1 when calculating the blinded data 1 and the blinded data 2, different random numbers k1 are generated each time the business module 203 and the TEE cooperate to decrypt the ciphertext key (C_MK), so that the blinded data 1 transmitted in the transmission link each time is different, and the blinded data 2 transmitted in the transmission link each time is also different, thereby increasing the security of the private key fragments.

[0276] S416. The business module 203 uses the unblinded data and the encrypted ciphertext C2 to determine the recovery key (RK).

[0277] wherein, the business module 203 can derive an intermediate key based on the data length n of the unblinded data and the encrypted ciphertext C2.

[0278] For example, the intermediate key can be determined by the above formula (10), which will not be described here.

[0279] The business module 203 can perform an exclusive or operation on the encrypted ciphertext C2 and the intermediate key to obtain the recovery key (RK).

[0280] For example, the recovery key (RK) can be determined by the following formula (18): RK=C2⊕t formula (18)

[0281] In the above formula (18), C2 is the encrypted ciphertext, t is the intermediate key, RK is the recovery key, and C2 ^ t represents that the key metadata is subjected to an exclusive-OR operation with the intermediate key.

[0282] S417. The service module 203 verifies the check data C3 in the ciphertext key (C MK) based on the unblinded data and the recovery key (RK).

[0283] The service module 203 can determine the check data C4 by the following formula (19). C4 = Hash (x2 || RK || y2) Formula (19)

[0284] In the above formula (19), RK is the recovery key, x2 is the abscissa in the above unblinded data, and y2 is the ordinate in the above unblinded data. x2 || RK || y2 represents that the recovery key (RK) is concatenated after the abscissa x2 in the above unblinded data, and then the ordinate y2 in the above unblinded data is concatenated after the recovery key (RK). “Hash ()” represents a hash operation function.

[0285] The service module 203 can compare whether the check data C4 is consistent with the check data C3 in the above ciphertext key (C MK), and if consistent, it indicates that the verification of the check data C3 is successful, and the service module 203 can determine the recovery key (RK) as the real key (MK).

[0286] The TEE can effectively protect the security of the private key fragment 2, even if the identity of the service module 203 is forged. The forged service module cannot decrypt the ciphertext data in cooperation with the TEE because the forged service module does not store the private key fragment 1 internally. Moreover, if the identity of the TEE is forged, the check data C4 obtained by the service module 203 and the forged TEE when decrypting the ciphertext key (C MK) in cooperation is different from the check data C3 in the ciphertext key (C MK), thereby causing the service module 203 and the forged TEE to fail to decrypt the ciphertext key (C MK) in cooperation. In this way, the service module 203 and the TEE can be bound, and after the service module 203 and the TEE are unbound, the service module 203 cannot decrypt the real key (MK) to decrypt the original data, so that the service module 203 cannot normally execute the service, thereby preventing the service module 203 from being normally used on other devices after being disassembled.

[0287] S418. After verifying the check data C3 successfully, the service module 203 determines the recovery key (RK) as the real key (MK), and uses the real key (MK) to decrypt the original data from the ciphertext data.

[0288] S419. After decrypting the original data, the service module 203 deletes the real key (MK).

[0289] Since the service module 203 decrypts the real key (MK) in random memory (RAM), after the service module 203 decrypts the original data, the real key (MK) can be deleted, thereby preventing the real key (MK) from being leaked in the service module 203, and improving the security of the real key (MK).

[0290] S420. The service module 203 deletes the original data after using the original data.

[0291] For example, if the service module 203 is a communication chip, the original data can be a program image (image) in the communication chip. After the service module 203 decrypts the original data, the service module 203 can load the program image in the random access memory (RAM) of the service module 203 and run, thereby executing the communication service.

[0292] Since the service module 203 decrypts the original data in random memory (RAM), after the service module 203 uses the original data, the original data can be deleted, thereby preventing the original data from being leaked in the service module 203, and improving the security of the original data.

[0293] In a possible implementation, after detecting a trigger condition for using the original data, the service module 203 can generate intermediate data 1 based on the key metadata C1 and the private key fragment 1, and send a decryption request to the TEE. The intermediate data 1 includes blinded data 3. The decryption request does not carry the intermediate data 1. After receiving the decryption request, the TEE can determine blinded data 4 based on the key metadata C1 and the private key fragment 2 (KEY_SK_2). The TEE can send intermediate data 2 to the service module 203, where the intermediate data 2 includes the blinded data 4. The service module 203 can determine the unblinded data based on the blinded data 3 and the blinded data 4.

[0294] It should be noted that the TEE can store the ciphertext key (C_MK) or the key metadata C1 in the ciphertext key (C_MK). The ciphertext key (C_MK) or the key metadata C1 in the ciphertext key (C_MK) stored in the TEE can be sent by the security module 202, or pre-stored in the TEE before factory, or downloaded to the TEE through OTA after factory.

[0295] Alternatively, the decryption request sent by the service module 203 to the TEE can carry the ciphertext key (C_MK) or the key metadata C1 in the ciphertext key (C_MK).

[0296] The TEE can perform an elliptic curve scalar multiplication operation on the private key shard 2 (KEY_SK_2) and the key metadata C1 to obtain blinded data 4.

[0297] The blinded data 3 can be determined by the following formula (20) for example: R3 = [d1]C1 formula (20)

[0298] In the above formula (20), R3 is the blinded data 3, d1 is the private key shard 1 (KEY_SK_1), and C1 is the key metadata.

[0299] The blinded data 4 can be determined by the following formula (21) for example: R4 = [d2]C1 formula (21)

[0300] In the above formula (21), R4 is the blinded data 4, d2 is the private key shard 2 (KEY_SK_2), and C1 is the key metadata.

[0301] The business module 203 can perform an elliptic curve scalar multiplication operation on the private key shard 1 (KEY_SK_1) and the key metadata C1 to obtain blinded data 4.

[0302] The business module 203 can add the blinded data 3 and the blinded data 4 to obtain unblinded data.

[0303] The unblinded data can be determined by the following formula (22) for example: (x2, y2) = R3 + R4 formula (22)

[0304] In the above formula (22), (x2, y2) is the unblinded data, R3 is the blinded data 3, and R4 is the blinded data 4.

[0305] The above formula (22) can be transformed into the above formula (16) by substituting the above formula (20) and formula (21) into formula (22).

[0306] In summary, the business module 203 and the TEE can participate in the calculation of the blinded data by using the private key shards stored respectively, without directly transmitting the private key shard 1 and the private key shard 2 to each other, so as to obtain the unblinded data in the business module 203, thereby recovering the real key (MK) in the business module 203. In this way, in the process of recovering the real key (MK) from the ciphertext key (C_MK) in the business module 203, the private key shards stored respectively by the business module 203 and the TEE are not exposed on the transmission link, which improves the security of the private key shards, the security of the session key, and the security of the real key (MK), thereby improving the security of the original data.

[0307] The data protection method provided by the embodiment of the present application can be applied to the electronic device 100 including the TEE, the security module 202 and the business module 203. The security module 202 can generate a session public key and a session private key, and distribute a private key fragment 1 and a private key fragment 2 based on the session private key. The security module 202 can send the private key fragment 1 to the business module 203 for storage, and send the private key fragment 2 to the TEE for storage. The security module 202 can encrypt the real key using the session public key to obtain a ciphertext key. The security module 202 can send the ciphertext key to the business module 203 for storage. The business module 203 and the TEE participate in the decryption calculation of the ciphertext key using the respective stored private key fragments, so as to decrypt the real key in the business module 203, and then decrypt the original data from the ciphertext data by using the real key.

[0308] In this way, in the process of recovering the real key (MK) from the ciphertext key (C_MK) by the business module 203, the private key fragments stored by the business module 203 and the TEE are not exposed on the transmission link, the security of the private key fragments is improved, the security of the session private key is improved, and the security of the real key (MK) is improved, so as to improve the security of the original data. In addition, the business module 203 can form a binding relationship with the TEE. If either of the business module 203 and the TEE is imitated, the real key cannot be decrypted in the business module 203, so as to ensure the security of the original data.

[0309] It should be noted that in some examples, the above-mentioned intermediate data 1 can be referred to as first intermediate data, the above-mentioned intermediate data 2 can be referred to as second intermediate data, the above-mentioned private key fragment 1 (KEY_SK_1) can be referred to as first private key fragment, the above-mentioned private key fragment 2 (KEY_SK_2) can be referred to as second private key fragment, the above-mentioned blinded data 1 can be referred to as first blinded data, the above-mentioned blinded data 2 can be referred to as second blinded data, the above-mentioned blinded data 3 can be referred to as third blinded data, the above-mentioned blinded data 4 can be referred to as fourth blinded data, the above-mentioned random number k1 can be referred to as first random number, and the above-mentioned random number k2 can be referred to as second random number.

[0310] FIG. 5 shows a flow diagram of a data protection method provided in another embodiment of the present application.

[0311] As shown in FIG. 5, the data protection method can be applied to the electronic device 100 including the processor 201, the security module 202 and the business module 203. The TEE can be run in the processor 201. The data protection method can include the following steps:

[0312] S501. The security module 202 stores a real key (MK).

[0313] S502. The service module 203 stores the ciphertext data but does not store the real key (MK), wherein the ciphertext data is obtained by encrypting the original data with the real key (MK).

[0314] Wherein, the steps S501 and S502 can refer to the steps S301 to S302 in the embodiment shown in the above Fig. 3, and will not be repeated here.

[0315] S503. The TEE and the service module 203 negotiate the private key slice of the session private key (SK) and the public key slice of the session public key (PK).

[0316] S504. After the service module 203 negotiates the private key slice of the session private key (SK) and the public key slice of the session public key (PK) with the TEE, the service module 203 obtains the private key slice 1 (KEY_SK_1) and the public key slice 1 (KEY_PK_1).

[0317] S505. The service module 203 sends the public key slice 1 (KEY_PK_1) to the secure module 202.

[0318] S506. The service module 203 stores the private key slice 1 (KEY_SK_1).

[0319] S507. After the TEE negotiates the private key slice of the session private key (SK) and the public key slice of the session public key (PK) with the service module 203, the TEE obtains the private key slice 2 (KEY_SK_2) and the public key slice 2 (KEY_PK_2).

[0320] S508. The TEE sends the public key slice 2 (KEY_PK_2) to the secure module 202.

[0321] S509. The TEE stores the private key slice 2 (KEY_SK_2).

[0322] Wherein, the session private key (SK) and the private key slice 1 (KEY_SK_1) and the private key slice (KEY_SK_2) satisfy the above formula (1), which will not be repeated here.

[0323] S510. The secure module 202 generates the session public key (PK) based on the public key slice 1 (KEY_PK_1) and the public key slice 2 (KEY_PK_2). Wherein, the session public key (PK) and the public key slice 1 (KEY_PK_1) and the public key slice 2 (KEY_PK_2) satisfy the following formula (23): p = p1 + p2 formula (23)

[0324] In the above formula (23), p is the session public key (PK), p1 is the public key slice 1 (KEY_PK_1), and p1 is the public key slice 2 (KEY_PK_2).

[0325] S511. The security module 202 encrypts the real key (MK) using a session public key (PK) to obtain a ciphertext key (C MK).

[0326] In a possible implementation, the security module 202 can encrypt the real key (MK) using a session public key (PK) by an elliptic curve-based public key cryptography algorithm (for example, SM2) to obtain a ciphertext key (C MK).

[0327] S512. The security module 202 sends the ciphertext key (C MK) to the business module 203.

[0328] The communication interface between the security module 202 and the business module 203 can adopt a communication standard such as “ISO 7816”. The security module 202 can send the ciphertext key (C MK) to the business module 203 through the communication interface.

[0329] S513. The business module 203 stores the ciphertext key (C MK).

[0330] The business module 203 can store the ciphertext key (C MK) and the private key shard 1 (KEY SK 1) in a nonvolatile memory inside the business module 203, for example, a flash memory inside the business module 203.

[0331] S514. The business module 203 detects a trigger condition for using original data.

[0332] For example, if the business module 203 is a communication chip, the original data can be a program image (image) in the communication chip, and the trigger condition can be that the business module 203 obtains a request to perform a communication service.

[0333] S515. After detecting the trigger condition for using the original data, the business module 203 generates intermediate data 1 based on the private key shard 1 (KEY SK 1) and the ciphertext key (C MK).

[0334] S516. The business module 203 sends a decryption request to the TEE, where the decryption request carries the intermediate data 1.

[0335] The decryption request is used to request the TEE and the business module 203 to perform multi-party collaborative decryption.

[0336] S517. The TEE determines intermediate data 2 based on the intermediate data 1 and the private key shard 2 (KEY SK 2).

[0337] S518. The TEE sends the intermediate data 2 to the business module 203.

[0338] S519. The service module 203 determines the real key (MK) based on the intermediate data 2 and the ciphertext key (C MK).

[0339] S520. The service module 203 decrypts the original data from the ciphertext data using the real key (MK).

[0340] S521. The service module 203 deletes the real key (MK) after decrypting the original data.

[0341] S522. The service module 203 deletes the original data after using the original data.

[0342] The steps S515 to S522 can refer to the steps S311 to S318 in the embodiment shown in FIG. 3, and will not be described here.

[0343] The data protection method provided by the embodiment can be applied to the electronic device 100 including the TEE, the security module 202 and the service module 203. The service module 203 can negotiate the public key fragment of the session public key and the private key fragment of the session private key with the TEE, wherein the service module 203 can obtain the public key fragment 1 and the private key fragment 1, and the TEE can obtain the public key fragment 2 and the private key fragment 2. The service module 203 and the TEE can send the obtained public key fragments to the security module 202. The security module 202 can restore the session public key using the public key fragment 1 and the public key fragment 2, and then encrypt the real key using the session public key to obtain the ciphertext key. The security module 202 can send the ciphertext key to the service module 203 for storage. The service module 203 and the TEE participate in the decryption calculation of the ciphertext key using the stored private key fragments, so as to decrypt the real key in the service module 203, and then decrypt the original data from the ciphertext data through the real key.

[0344] In this way, the business module 203 and the TEE can negotiate the private key fragment of the session private key and the public key fragment of the session public key, and the business module 203 and the TEE send the respective public key fragments to the security module 202. Thus, the security module 202 restores the session public key according to the public key fragments sent by the business module 203 and the TEE respectively, and encrypts the real key using the session public key. Thus, the private key fragment of the session private key is not exposed on the transmission link, ensuring the security of the private key fragment. In the process of restoring the real key (MK) from the ciphertext key (C MK) by the business module 203, the private key fragments stored by the business module 203 and the TEE are not exposed on the transmission link, improving the security of the private key fragment, and also improving the security of the session private key, thereby improving the security of the real key (MK), and thus improving the security of the original data. Moreover, the business module 203 can form a binding relationship with the TEE and the security module 202, and if any of the business module 203, the TEE and the security module 202 is imitated, the real key cannot be decrypted in the business module 203, thereby ensuring the security of the original data.

[0345] It should be noted that in some examples, the above-mentioned intermediate data 1 can be referred to as first intermediate data, the above-mentioned intermediate data 2 can be referred to as second intermediate data, the above-mentioned private key fragment 1 (KEY SK 1) can be referred to as first private key fragment, the above-mentioned private key fragment 2 (KEY SK 2) can be referred to as second private key fragment, the above-mentioned public key fragment 1 (KEY PK 1) can be referred to as first public key fragment, the above-mentioned public key fragment 2 (KEY PK 2) can be referred to as second public key fragment, the above-mentioned blinded data 1 can be referred to as first blinded data, and the above-mentioned blinded data 2 can be referred to as second blinded data.

[0346] The following describes the specific process of the data protection method provided by the present application based on the process of the data protection method shown in FIG. 5, in combination with the process of negotiating the private key fragment and the public key fragment and the process of encrypting and decrypting the real key.

[0347] FIG. 6 shows a specific process diagram of a data protection method provided in another embodiment of the present application.

[0348] As shown in FIG. 6, the data protection method can be applied to an electronic device 100 including a processor 201, a security module 202 and a business module 203. The processor 201 can run a TEE. The data protection method can include the following steps:

[0349] S601. The security module 202 stores a real key (MK).

[0350] S602. The service module 203 stores the ciphertext data but does not store the real key (MK), wherein the ciphertext data is obtained by encrypting the original data with the real key (MK).

[0351] The steps S601 and S602 can refer to the steps S301 and S302 in the embodiment shown in FIG. 3, which will not be described here again.

[0352] S603. The service module 203 generates a random number a1 and a random number b1, both of which are positive integers.

[0353] S604. The service module 203 generates a public key B1 corresponding to the random number b1 by an elliptic curve algorithm with the random number b1 as a private key.

[0354] For example, the public key B1 can be determined by the following formula (24): B1=[b1]G formula (24)

[0355] In the above formula (24), B1 is the public key corresponding to the random number b1, G is the base point on the elliptic curve, and [b1]G represents the elliptic curve scalar multiplication operation of the random number b1 and the base point G.

[0356] S605. The service module 203 sends a temporary key negotiation request to the TEE, wherein the temporary key negotiation request carries the random number a1 and the public key B1.

[0357] The temporary key negotiation request is used to request the TEE and the service module 203 to negotiate the private key shard of the session private key (SK) and the public key shard of the session public key (PK).

[0358] S606. After receiving the temporary key negotiation request, the TEE generates a random number a2 and a random number b2, both of which are positive integers.

[0359] S607. The TEE generates a public key B2 corresponding to the random number b2 by an elliptic curve algorithm with the random number b2 as a private key.

[0360] For example, the public key B2 can be determined by the following formula (25): B2=[b2]G formula (25)

[0361] In the above formula (25), G is the base point on the elliptic curve, and [b2]G represents the elliptic curve scalar multiplication operation of the random number b2 and the base point G.

[0362] S608. The TEE sends the random number a2 and the public key B2 to the service module 203.

[0363] S609. The service module 203 generates a private key shard 1 (KEY_SK_1) of the session private key (SK) based on the random number a2 and the random number b1.

[0364] In a possible implementation, the service module 203 can perform a multiplication operation on the random number a2 and the random number b1 to obtain the private key shard 1 (KEY_SK_1).

[0365] For example, the private key shard 1 (KEY_SK_1) can be determined by the following formula (26): d1=a2×b1 formula (26)

[0366] In the above formula (26), d1 is the private key shard 1 (KEY_SK_1).

[0367] S610. The service module 203 generates a public key shard 1 (KEY_PK_1) of the session public key (PK) based on the random number a1 and the public key B2.

[0368] In a possible implementation, the service module 203 can perform an elliptic curve scalar multiplication operation on the random number a1 and the public key B2 to obtain the public key shard 1 (KEY_PK_1).

[0369] For example, the public key shard 1 (KEY_PK_1) can be determined by the following formula (27): p1=[a1]B2 formula (27)

[0370] In the above formula (27), p1 is the public key shard 1 (KEY_PK_1), B2 is the public key corresponding to the random number b2, and [a1]B2 represents an elliptic curve scalar multiplication operation on the random number a1 and the public key B2.

[0371] S611. The TEE generates a private key shard 2 (KEY_SK_2) of the session private key (SK) based on the random number a1 and the random number b2.

[0372] In a possible implementation, the TEE can perform a multiplication operation on the random number a1 and the random number b2 to obtain the private key shard 2 (KEY_SK_2).

[0373] For example, the private key shard 2 (KEY_SK_2) can be determined by the following formula (28): d2=a1×b2 formula (28)

[0374] In the above formula (28), d2 is the private key shard 2 (KEY_SK_2).

[0375] S612. The TEE generates a public key shard 2 (KEY_PK_2) of the session public key (PK) based on the random number a2 and the public key B1.

[0376] In one possible implementation, the TEE can perform an elliptic curve scalar multiplication operation on the random number a2 and the public key B1 to obtain public key fragment 2 (KEY_PK_2).

[0377] For example, public key fragment 2 (KEY_PK_2) can be determined by the following formula (29): p2 = [a2]B1 formula (29)

[0378] In the above formula (29), p2 is public key fragment 2 (KEY_PK_2), B1 is the public key corresponding to random number b1, and [a2]B1 indicates that random number a2 and public key B1 are multiplied by elliptic curve scalar.

[0379] S613. The business module 203 sends public key fragment 1 (KEY_PK_1) to the security module 202.

[0380] S614.TEE sends public key fragment 2 (KEY_PK_2) to security module 202.

[0381] S615. Security module 202 generates a session public key (PK) based on public key fragment 1 (KEY_PK_1) and public key fragment 2 (KEY_PK_2).

[0382] The session private key (SK) can be the sum of private key fragment 1 (KEY_SK_1) and private key fragment 2 (KEY_SK_2), and the session public key (PK) can be the sum of public key fragment 1 (KEY_PK_1) and public key fragment 2 (KEY_PK_2).

[0383] For example, based on the above formulas (26) and (28), the session private key (SK) can be obtained as shown in the following formula (30): d=d1+d2=a2×b1+a1×b2 Formula (30)

[0384] In the above formula (30), d is the session private key (SK), d1 is private key fragment 1 (KEY_SK_1), and d2 is private key fragment 2 (KEY_SK_2). For example, according to the above formulas (27) and (29), the session public key (PK) can be obtained as shown in the following formula (31): p=p1+p2=[a1]B2+[a2]B1 Formula (31)

[0385] In the above formula (31), p is the session public key (PK), p1 is public key fragment 1 (KEY_PK_1), p2 is public key fragment 2 (KEY_PK_2), d is the session private key (SK), G is the base point on the elliptic curve, [a1]B2 represents the elliptic curve scalar multiplication operation between random number a1 and public key B2, and [a2]B1 represents the elliptic curve scalar multiplication operation between random number a2 and public key B2.

[0386] The above formula (24), formula (25) and formula (30) are brought into the above formula (31), and the above formula (31) is transformed to obtain the following formula (32): p = p1 + p2 = [a1]B2 + [a2]B1 = [a1 x b2 + a2 x b1]G = [d]G formula (32)

[0387] In the above formula (32), d is a session private key (SK), p is a session public key (PK), and [d]G represents that the session private key (SK) is subjected to an elliptic curve scalar multiplication operation with a base point on an elliptic curve.

[0388] As can be seen from the above formula (32), after the business module 203 and the TEE negotiate the private key fragment of the session private key (SK) and the public key fragment of the session public key (PK), the business module 203 and the TEE can send the obtained public key fragments to the security module 202. Thus, the session public key (PK) is restored based on the public key fragments sent by the business module 203 and the TEE in the security module 202. Thus, the security module 202 encrypts the real key (MK) into a ciphertext key (C_MK) through the session public key (PK), and sends the ciphertext key (C_MK) to the business module 203 for storage. Subsequently, when the business module 203 needs to decrypt the ciphertext key (C_MK), the business module 203 and the TEE can participate in the decryption calculation of the ciphertext key (C_MK) through the respective private key fragments, without exposing the respective private key fragments on the transmission link between the business module 203 and the TEE, thereby improving the security of the private key fragments, the security of the session private key, and the security of the real key (MK), and thus improving the security of the original data.

[0389] S616. The security module 202 encrypts the real key (MK) using the session public key (PK) to obtain a ciphertext key (C_MK), wherein the ciphertext key (C_MK) includes key metadata C1, encrypted ciphertext C2 and verification data C3.

[0390] The specific content of step S616 can refer to step S404 in the embodiment shown in FIG. 4, and will not be described here again.

[0391] S617. The security module 202 sends the ciphertext key (C_MK) to the business module 203.

[0392] S618. The business module 203 stores the ciphertext key (C_MK) and the private key fragment 1 (KEY_SK_1).

[0393] The service module 203 can store the ciphertext key (C MK) and the private key shard 1 (KEY SK 1) in the non-volatile memory inside the service module 203. For example, the non-volatile memory inside the service module 203 can be a flash memory.

[0394] S619. The TEE stores the private key shard 2 (KEY SK 2).

[0395] S620. The service module 203 detects a trigger condition for using the original data.

[0396] The specific content of step S620 can refer to step S310 in the embodiment shown in FIG. 3, and will not be described here again.

[0397] S621. After detecting the trigger condition for using the original data, the service module 203 generates a random number k1, and determines blinded data 1 based on the private key shard 1 (KEY SK 1), the random number k1, and the key metadata C1 in the ciphertext key (C MK).

[0398] S622. The service module 203 sends a decryption request to the TEE, where the decryption request carries the intermediate data 1, and the intermediate data 1 includes the blinded data 1.

[0399] S623. The TEE determines blinded data 2 based on the blinded data 1, the key metadata C1, and the private key shard 2 (KEY SK 2).

[0400] Optionally, the TEE can store the ciphertext key (C MK) or the key metadata C1 in the ciphertext key (C MK). The ciphertext key (C MK) or the key metadata C1 in the ciphertext key (C MK) stored in the TEE can be sent by the security module 202, or pre-stored in the TEE before factory, or downloaded to the TEE through OTA after factory.

[0401] Alternatively, the decryption request can carry the ciphertext key (C MK) or the key metadata C1 in the ciphertext key (C MK) in addition to the intermediate data 1.

[0402] S624. The TEE sends the intermediate data 2 to the service module 203, where the intermediate data 2 includes the blinded data 2.

[0403] S625. The service module 203 determines unblinded data based on the blinded data 2, the random number k1, and the key metadata C1.

[0404] S626. The service module 203 uses the unblinded data and the encrypted ciphertext C2 to determine the recovery key (RK).

[0405] S627. The service module 203 verifies the check data C3 in the ciphertext key (C MK) based on the blinded data and the recovery key (RK).

[0406] S628. After the service module 203 successfully verifies the check data C3, the service module 203 determines the recovery key (RK) as the real key (MK), and uses the real key (MK) to decrypt the original data from the ciphertext data.

[0407] S629. After the service module 203 decrypts the original data, the service module 203 deletes the real key (MK).

[0408] S630. After the service module 203 uses the original data, the service module 203 deletes the original data.

[0409] The specific content of the steps S621 to S630 can refer to the steps S411 to S420 in the embodiment shown in FIG. 4, and will not be described here.

[0410] The data protection method provided by the embodiment of the present application can be applied to the electronic device 100 including the TEE, the security module 202 and the service module 203. The service module 203 can first negotiate the public key fragment of the session public key and the private key fragment of the session private key with the TEE, wherein the service module 203 can obtain the public key fragment 1 and the private key fragment 1, and the TEE can obtain the public key fragment 2 and the private key fragment 2. The service module 203 and the TEE can send the public key fragments obtained by themselves to the security module 202. The security module 202 can recover the session public key using the public key fragment 1 and the public key fragment 2, and then encrypt the real key using the session public key to obtain the ciphertext key. The security module 202 can send the ciphertext key to the service module 203 for storage. The service module 203 and the TEE participate in the decryption calculation of the ciphertext key using the private key fragments stored by themselves, so that the real key is decrypted in the service module 203, and the original data is decrypted from the ciphertext data through the real key.

[0411] In this way, the business module 203 and the TEE can negotiate the private key fragment of the session private key and the public key fragment of the session public key, and the business module 203 and the TEE send the respective public key fragments to the security module 202. Thus, the security module 202 restores the session public key according to the public key fragments sent by the business module 203 and the TEE respectively, and encrypts the real key using the session public key. Thus, the private key fragment of the session private key is not exposed on the transmission link, ensuring the security of the private key fragment. In the process of restoring the real key (MK) from the ciphertext key (C MK) by the business module 203, the private key fragments stored by the business module 203 and the TEE are not exposed on the transmission link, improving the security of the private key fragments, and also improving the security of the session private key, and further improving the security of the real key (MK), thereby improving the security of the original data. Moreover, the business module 203 can form a binding relationship with the TEE, and if either the business module 203 or the TEE is imitated, the real key cannot be decrypted in the business module 203, thereby ensuring the security of the original data.

[0412] It should be noted that in some examples, the above-mentioned intermediate data 1 can be referred to as first intermediate data, the above-mentioned intermediate data 2 can be referred to as second intermediate data, the above-mentioned private key fragment 1 (KEY SK 1) can be referred to as first private key fragment, the above-mentioned private key fragment 2 (KEY SK 2) can be referred to as second private key fragment, the above-mentioned blinded data 1 can be referred to as first blinded data, the above-mentioned blinded data 2 can be referred to as second blinded data, the above-mentioned blinded data 3 can be referred to as third blinded data, the above-mentioned blinded data 4 can be referred to as fourth blinded data, and the above-mentioned random number k1 can be referred to as first random number.

[0413] The updating process of the private key fragment provided in the present application will be introduced below.

[0414] FIG. 7 shows the process of updating the private key fragment provided in the embodiments of the present application.

[0415] As shown in FIG. 7, the data protection method can be applied to an electronic device 100 including a processor 201 and a business module 203, wherein the TEE can be run in the processor 201. The updating process of the private key fragment can include the following steps:

[0416] S701. The business module 203 stores the private key fragment 1 (KEY SK 1).

[0417] S702. The TEE stores the private key fragment 2 (KEY SK 2).

[0418] The generation process of the private key fragment 1 and the private key fragment 2 can refer to the embodiments shown in FIGS. 3 to 6, which will not be described here.

[0419] S703. The service module 203 generates a random number k3, which is a positive integer.

[0420] S704. The service module 203 generates a public key P3 corresponding to the random number k3 by an elliptic curve algorithm, taking the random number k3 as a private key.

[0421] In the above formula (33), P3 is the public key corresponding to the random number k3, G is the base point on the elliptic curve, and [k3]G represents the elliptic curve scalar multiplication operation of the random number k3 and the base point on the elliptic curve.

[0422] In the above formula (33), P3 is the public key corresponding to the random number k3, G is the base point on the elliptic curve, and [k3]G represents the elliptic curve scalar multiplication operation of the random number k3 and the base point on the elliptic curve.

[0423] In the above formula (33), P3 is the public key corresponding to the random number k3, G is the base point on the elliptic curve, and [k3]G represents the elliptic curve scalar multiplication operation of the random number k3 and the base point on the elliptic curve.

[0424] S705. The service module 203 sends a key update request to the TEE, wherein the key update request carries the public key P3.

[0425] S706. After receiving the key update request, the TEE generates a random number k4, which is a positive integer.

[0426] S707. The TEE generates a public key P4 corresponding to the random number k4 by an elliptic curve algorithm, taking the random number k4 as a private key.

[0427] In the above formula (33), P3 is the public key corresponding to the random number k3, G is the base point on the elliptic curve, and [k3]G represents the elliptic curve scalar multiplication operation of the random number k3 and the base point on the elliptic curve.

[0428] In the above formula (33), P3 is the public key corresponding to the random number k3, G is the base point on the elliptic curve, and [k3]G represents the elliptic curve scalar multiplication operation of the random number k3 and the base point on the elliptic curve.

[0429] In the above formula (33), P3 is the public key corresponding to the random number k3, G is the base point on the elliptic curve, and [k3]G represents the elliptic curve scalar multiplication operation of the random number k3 and the base point on the elliptic curve.

[0430] S708. The TEE sends the public key P4 to the service module 203.

[0431] S709. After receiving the public key P4, the service module 203 generates a key update parameter r based on the random number k3 and the public key P4.

[0432] The business module 203 can perform an elliptic curve scalar multiplication operation on the random number k3 and the public key P4 to obtain coordinate data of a coordinate point R. Then, the business module 203 can determine a key update parameter r based on the coordinate data of the coordinate point R and a data length n of the session private key (SK).

[0433] For example, the business module 203 can determine the coordinate data of the coordinate point R by the following formula (35): (x3, y3) = R = [k3]P4 formula (35)

[0434] In the above formula (35), x3 is the abscissa of the coordinate point R, and y3 is the ordinate of the coordinate point R. [k3]P4 represents an elliptic curve scalar multiplication operation on the random number k3 and the public key P4.

[0435] For example, the key update parameter r can be determined by the following formula (36): r = KDF(x3‖y3, n) formula (36)

[0436] In the above formula (36), r is the key update parameter, “KDF()” is a key derivation function. x3 is the abscissa of the above coordinate point R, and y3 is the ordinate of the above coordinate point R. x3‖y3 represents a value obtained by concatenating the abscissa of the above coordinate point R with the ordinate of the above coordinate point R, and x3‖y3 can be used as an input of the key derivation function. n is the data length of the real key (MK) in bits, and n can be used as another input of the key derivation function. The key derivation function can generate a key update parameter r with a data length of n bits according to x3‖y3.

[0437] S710. The business module 203 generates a private key fragment 3 (KEY_SK_3) based on the private key fragment 1 (KEY_SK_1) and the key update parameter r.

[0438] The business module 203 can calculate the difference between the private key fragment 1 (KEY_SK_1) and the key update parameter r to obtain the private key fragment 3 (KEY_SK_3).

[0439] For example, the private key fragment 3 (KEY_SK_3) can be determined by the following formula (37): d3 = d1 - r formula (37)

[0440] In the above formula (37), d3 is the private key fragment 3 (KEY_SK_3), d1 is the private key fragment 1 (KEY_SK_1), and r is the key update parameter.

[0441] S711. The business module 203 stores the private key fragment 3 (KEY_SK_3) and deletes the private key fragment 1 (KEY_SK_1) and the key update parameter r.

[0442] S712.After generating the random number k4, the TEE can generate the key update parameter r based on the random number k4 and the public key P3.

[0443] In the above formula (38), x3 is the horizontal coordinate of the coordinate point R, and y3 is the vertical coordinate of the coordinate point R. [k4]P3 represents the result of the elliptic curve scalar multiplication operation of the random number k4 and the public key P3.

[0444] In the above formula (38), x3 is the horizontal coordinate of the coordinate point R, and y3 is the vertical coordinate of the coordinate point R. [k4]P3 represents the result of the elliptic curve scalar multiplication operation of the random number k4 and the public key P3.

[0445] In the above formula (38), x3 is the horizontal coordinate of the coordinate point R, and y3 is the vertical coordinate of the coordinate point R. [k4]P3 represents the result of the elliptic curve scalar multiplication operation of the random number k4 and the public key P3.

[0446] In the above formula (38), x3 is the horizontal coordinate of the coordinate point R, and y3 is the vertical coordinate of the coordinate point R. [k4]P3 represents the result of the elliptic curve scalar multiplication operation of the random number k4 and the public key P3.

[0447] In the above formula (38), x3 is the horizontal coordinate of the coordinate point R, and y3 is the vertical coordinate of the coordinate point R. [k4]P3 represents the result of the elliptic curve scalar multiplication operation of the random number k4 and the public key P3.

[0448] S713.The TEE generates the private key fragment 4 (KEY_SK_4) based on the private key fragment 2 (KEY_SK_2) and the key update parameter r.

[0449] In the above formula (39), d4 is the private key fragment 4 (KEY_SK_4), d2 is the private key fragment 2 (KEY_SK_2), and r is the key update parameter.

[0450] In the above formula (39), d4 is the private key fragment 4 (KEY_SK_4), d2 is the private key fragment 2 (KEY_SK_2), and r is the key update parameter.

[0451] In the above formula (39), d4 is the private key fragment 4 (KEY_SK_4), d2 is the private key fragment 2 (KEY_SK_2), and r is the key update parameter.

[0452] Since the sum of the private key shard 1 (KEY_SK_1) and the private key shard 2 (KEY_SK_2) is equal to the session private key (SK), the private key shard 3 (KEY_SK_3) is the difference between the private key shard 1 (KEY_SK_1) and the key update parameter r, and the private key shard 4 (KEY_SK_4) is the sum of the private key shard 2 (KEY_SK_2) and the key update parameter r. Therefore, the sum of the private key shard 4 (KEY_SK_4) and the private key shard 3 (KEY_SK_3) is also equal to the session private key (SK).

[0453] In a possible implementation, the private key shard 3 (KEY_SK_3) can be the sum of the private key shard 1 (KEY_SK_1) and the key update parameter r, and the private key shard 4 (KEY_SK_4) can be the difference between the private key shard 2 (KEY_SK_2) and the key update parameter r. In this way, the sum of the private key shard 4 (KEY_SK_4) and the private key shard 3 (KEY_SK_3) is also equal to the session private key (SK).

[0454] In this way, the private key shards stored in the business module 203 and the TEE can be updated, but the updated private key shards of the business module 203 and the TEE can still participate in the calculation of decrypting the ciphertext key (C_MK), so that the business module 203 can successfully decrypt the real key (MK) from the ciphertext key (C_MK), and then the business module 203 can successfully decrypt the original data from the ciphertext data.

[0455] After updating the private key shards stored in the business module 203 and the TEE, if the ciphertext key (C_MK) needs to be decrypted, the business module 203 can generate intermediate data 3 based on the private key shard 3 (KEY_SK_3) and the ciphertext key. The business module 203 can send a second decryption request to the TEE; the TEE can generate intermediate data 4 based on the private key shard 4 (KEY_SK_4) and the ciphertext key (C_MK) after receiving the second decryption request. The TEE can send the intermediate data 4 to the business module 203. The business module 203 can decrypt the real key from the ciphertext key (C_MK) based on the intermediate data 3 and the intermediate data 4.

[0456] The process of decrypting the ciphertext key (C_MK) using the private key shard 3 (KEY_SK_3) and the private key shard 4 (KEY_SK_4) can refer to the process of decrypting the ciphertext key (C_MK) using the private key shard 1 (KEY_SK_1) and the private key shard 2 (KEY_SK_2) in the above-mentioned embodiments of FIG. 3 to FIG. 6, which will not be described here.

[0457] In a possible implementation, the TEE can generate a random number with a length of n as the key update parameter r. The TEE carries the key update parameter r in the key update request sent to the business module 203. After obtaining the key update parameter r from the key update request, the business module 203 can generate the private key shard 3 (KEY_SK_3) based on the private key shard 1 (KEY_SK_1) and the key update parameter r. The TEE can generate the private key shard 4 (KEY_SK_4) based on the private key shard 2 (KEY_SK_2) and the key update parameter r.

[0458] S714. The TEE stores the private key shard 4 (KEY_SK_4) and deletes the private key shard 2 (KEY_SK_2) and the key update parameter r.

[0459] In a possible implementation, the electronic device 100 can update the private key shards stored by the business module 203 and the TEE at regular intervals, that is, trigger the steps S703 to S714.

[0460] In a possible implementation, the electronic device 100 can update the private key shards stored by the business module 203 and the TEE when a key update condition is detected, that is, trigger the steps S703 to S714.

[0461] Through the process of updating the private key shards provided by the embodiments of the present application, the business module 203 and the TEE can negotiate with each other to update the private key shards stored by each other, so that the updated private key shards of the business module 203 and the TEE are not exposed on the transmission link, but the updated private key shards of the business module 203 and the TEE can still participate in the decryption calculation of the ciphertext key (C_MK), so that the business module 203 can successfully decrypt the real key (MK) from the ciphertext key (C_MK), and then the business module 203 can successfully decrypt the original data from the ciphertext data. In this way, the private key shards stored by the business module 203 and the TEE can be updated, the same private key shards can be prevented from being used for a long time, the possibility of private key shard leakage can be reduced, and the security of the session private key (SK) is improved.

[0462] In some embodiments, the electronic device 100 can generate the private key fragment 3 (KEY_SK_3) and the private key fragment 4 (KEY_SK_4) of the session private key (SK) through the process of generating the private key fragment 1 (KEY_SK_1) and the private key fragment 2 (KEY_SK_2) in the embodiments shown in FIG. 3 to FIG. 6 described above. The service module 203 can store the private key fragment 3 (KEY_SK_3) and delete the private key fragment 1 (KEY_SK_1). The TEE can store the private key fragment 4 (KEY_SK_4) and delete the private key fragment 2 (KEY_SK_2). The sum of the private key fragment 3 (KEY_SK_3) and the private key fragment 4 (KEY_SK_4) is equal to the session private key (SK). In this way, the private key fragments stored by the service module 203 and the TEE can be updated, the same private key fragment can be prevented from being used for a long time, the possibility of the private key fragment being leaked can be reduced, and the security of the session private key (SK) is improved.

[0463] It should be noted that in some examples, the above-mentioned intermediate data 1 can be referred to as first intermediate data, the above-mentioned intermediate data 2 can be referred to as second intermediate data, the above-mentioned intermediate data 3 can be referred to as third intermediate data, the above-mentioned intermediate data 4 can be referred to as fourth intermediate data, the above-mentioned private key fragment 1 (KEY_SK_1) can be referred to as first private key fragment, the above-mentioned private key fragment 2 (KEY_SK_2) can be referred to as second private key fragment, the above-mentioned private key fragment 3 (KEY_SK_3) can be referred to as third private key fragment, and the above-mentioned private key fragment 4 (KEY_SK_4) can be referred to as fourth private key fragment. The decryption request sent by the service module before updating the private key fragment can be referred to as a first decryption request, and the decryption request sent by the service module after updating the private key fragment can be referred to as a second decryption request.

[0464] Next, a data protection system provided by an embodiment of the present application is introduced.

[0465] FIG. 8 shows an architecture schematic diagram of a data protection system provided by an embodiment of the present application.

[0466] As shown in FIG. 8, the data protection system 80 can include a node 810, a node 820, and a node 830.

[0467] The node 830 can use the session public key (PK) to encrypt the real key (MK) through an encryption algorithm to obtain a ciphertext key (C_MK). The encryption algorithm can be an SM2 algorithm. The node 830 can send the ciphertext key (C_MK) to the node 810. The communication connection between the node 830 and the node 810 can establish a secure transmission channel to ensure the secure transmission of data between the node 830 and the node 810.

[0468] The node 810 can store a private key fragment 1 (KEY_SK_1) of the ciphertext data, a ciphertext key (C MK), and a session private key (SK). The ciphertext data is obtained by encrypting original data by using a real key (MK). The service module 203 needs to use the original data to perform a service.

[0469] In a possible implementation, the node 810 has no trust root mechanism and cannot securely store unencrypted plaintext data.

[0470] In a possible implementation, the ciphertext data can be pre-stored in the node 810.

[0471] In another possible implementation, the ciphertext data can be written into the node 810 through OTA.

[0472] When the node 810 needs to use the original data, the node 810 can generate intermediate data 1 by using the private key fragment 1 (KEY_SK_1) and the ciphertext key (C MK) through a secure algorithm program and send the intermediate data 1 to the TEE. For example, the secure algorithm program can be a software development kit (SDK) of a multi-party computation (MPC) secure algorithm.

[0473] The node 820 can store a private key fragment 2 (KEY_SK_2). After receiving the intermediate data 1, the node 820 can generate intermediate data 2 based on the private key fragment 2 (KEY_SK_2) and the intermediate data 1, and send the intermediate data 2 to the node 810.

[0474] The node 810 can recover the real key (MK) based on the intermediate data 2 and the ciphertext key (C MK) through the secure algorithm program. After recovering the real key (MK), the node 810 can decrypt the original data from the ciphertext data based on the real key (MK).

[0475] After decrypting the original data, the node 810 can delete the real key (MK). After using the original data, the node 810 can delete the original data. In this way, after decrypting the original data by using the recovered real key (MK), the node 810 deletes the real key (MK) in time, which can avoid the real key (MK) from being leaked from the node 810. After using the original data, the node 810 deletes the original data in time, which can avoid the original data from being leaked from the node 810 and improve the security of the original data.

[0476] In a possible implementation, the first node, the second node and the third node can be in the same device (for example, the electronic device 100). For example, the first node can be the service module 203 in the electronic device 100, the second node can be the security module 202 in the electronic device 100, and the third node can be a TEE running in the processor 201 of the electronic device 100.

[0477] In a possible implementation, the node 810, the node 820 and the node 830 can be in different devices.

[0478] Case 1: The node 810 can be a first device, the node 820 can be a module A in a second device (for example, a TEE running in a processor of the second electronic device), and the node 830 can be a module B in the second device (for example, a security module of the second electronic device). The first device is different from the second device, and the module A is different from the module B.

[0479] For example, the node 810 can be a camera device, the node 820 can be a TEE running in a processor of a mobile phone, and the node 830 can be a security module of the mobile phone. When the user configures the camera device by using the mobile phone, the mobile phone can negotiate a key fragment with the camera device, and send the private key fragment 1 (KEY_SK_1) and the ciphertext key (C_MK) to the camera device for storage, and the TEE in the mobile phone can save the private key fragment 2 (KEY_SK_2). The original data can be a service program stored in the camera device, and the service program can be executable to collect image data and / or send image data when running. Therefore, the TEE and the security module in the mobile phone have a binding relationship with the camera device. In this way, the camera device needs to be decrypted by the camera device and the mobile phone having the binding relationship each time the camera device collects image data and / or sends image data, so that it is ensured that the camera device can be called only when the camera device establishes a communication connection with the mobile phone having the binding relationship, and other devices are prevented from connecting to the camera device to obtain image data and other data, thereby protecting the privacy of the user.

[0480] Since the camera device and other first devices have no trust root mechanism, the unencrypted plaintext data cannot be safely stored. By using the data protection method provided in the embodiments of the present application, the camera device and other first devices having no trust root mechanism can be upgraded to high-security devices.

[0481] The above examples are only used to explain the embodiments of the present application, and should not be construed as limiting the embodiments of the present application.

[0482] Case 2: The node 810 can be a first device, the node 820 can be a second device, and the node 830 can be a third device. The first device, the second device and the third device are all different.

[0483] For example, the node 810 can be a camera device, the node 820 can be a home device, and the node 830 can be a mobile phone. When the user configures the camera device by using the mobile phone, the home device can be connected with the camera device. The mobile phone can trigger the camera device to store the private key fragment 1 (KEY_SK_1) and the ciphertext key (C_MK), and the home device to store the private key fragment 2 (KEY_SK_2). The original data can be a service program stored in the camera device, and the service program can be executable to collect images and / or send image data at runtime. Therefore, the camera device and the home device have a binding relationship. In this way, the camera device needs to establish a communication connection with the home device having the binding relationship to be invoked each time the camera device collects images and / or sends image data, thereby preventing the image data in the camera device from being stolen by other devices, and protecting the privacy of the user.

[0484] The above examples are only used to explain the embodiments of the present application, and should not be construed as limiting the embodiments of the present application.

[0485] Case 3: The node 810 can be a module C in a first device, the node 820 can be a module D in the first device, and the node 830 can be a second device. The module C is different from the module D.

[0486] For example, the node 810 can be the service module 203 in the electronic device 100, the node 820 can be a TEE running in the processor 201 of the electronic device 100, and the node 830 can be a cloud server. The cloud server can store a real key (MK). The cloud server can use a session public key (PK) to encrypt the real key (MK) into a ciphertext key (C_MK). The cloud server can send the ciphertext key (C_MK) to the electronic device 100. The electronic device 100 can store the ciphertext key (C_MK) into the service module 203. Since the service module 203 also stores the ciphertext data and the private key fragment 1 (KEY_SK_1), and the TEE stores the private key fragment 2 (KEY_SK_2), when the service module 203 needs to use the original data, the service module 203 can use the private key fragments stored respectively by the service module 203 and the TEE to participate in the decryption calculation of the ciphertext data, thereby decrypting the original data from the ciphertext data stored in the service module 203. In this way, the security of the service module 203 using the original data can be improved.

[0487] The above examples are only used to explain the embodiments of the present application, and should not be construed as limiting the embodiments of the present application.

[0488] In some embodiments, the ciphertext key (C MK) and the private key shard 1 (KEY SK 1) can be pre-stored in the node 810. The private key shard 2 (KEY SK 2) can be pre-stored in the node 820. In this way, the node 810 and the node 820 can decrypt the ciphertext key and the ciphertext data in the node 810 in cooperation without the participation of the node 830.

[0489] The data protection method provided by the embodiments of the present application will be described below based on the data protection system shown in Figure 8.

[0490] Figure 9 is a flowchart of a data protection method provided by another embodiment of the present application.

[0491] As shown in Figure 9, the data protection method can be applied to a data protection system, which can include the node 810, the node 820 and the node 830. The data protection method can include the following steps:

[0492] S901. The node 830 stores a real key (MK).

[0493] S902. The node 810 stores ciphertext data but does not store the real key, wherein the ciphertext data is obtained by encrypting original data with the real key (MK).

[0494] S903. The node 830 encrypts the real key (MK) with a session public key (PK) to obtain a ciphertext key (C MK).

[0495] The process in which the node 830 encrypts the real key (MK) with the session public key (PK) can refer to the process in which the security module 202 encrypts the real key (MK) with the session public key (PK) in the embodiments shown in Figures 3 to 6, which will not be described here again.

[0496] S904. The node 830 sends the ciphertext key (C MK) to the node 810.

[0497] S905. The node 810 stores the private key shard 1 (KEY SK 1) and the ciphertext key (C MK).

[0498] The process in which the node 810 obtains the private key shard 1 (KEY SK 1) and the ciphertext key (C MK) can refer to the process in which the business module 203 obtains the private key shard 1 (KEY SK 1) and the ciphertext key (C MK) in the embodiments shown in Figures 3 to 6, which will not be described here again.

[0499] S906. The node 820 stores the private key shard 2 (KEY SK 2).

[0500] The process in which the node 820 obtains the private key fragment 2 (KEY_SK_2) can refer to the process in which the TEE obtains the private key fragment 2 (KEY_SK_2) in the above-described embodiments shown in FIG. 3 to FIG. 6, and will not be described here again.

[0501] S907. The node 810 detects a trigger condition of using the original data.

[0502] S908. After detecting the trigger condition of using the original data, the node 810 determines the intermediate data 1 based on the private key fragment 1 (KEY_SK_1) and the ciphertext key (C_MK).

[0503] The process in which the node 810 determines the intermediate data 1 can refer to the process in which the business module 203 determines the intermediate data 1 in the above-described embodiments shown in FIG. 3 to FIG. 6, and will not be described here again.

[0504] S909. The node 810 sends a decryption request to the node 820, wherein the decryption request carries the intermediate data 1.

[0505] S910. The node 820 determines the intermediate data 2 based on the intermediate data 1 and the private key fragment 2 (KEY_SK_2).

[0506] The process in which the node 820 determines the intermediate data 2 can refer to the process in which the TEE determines the intermediate data 2 in the above-described embodiments shown in FIG. 3 to FIG. 6, and will not be described here again.

[0507] S911. The node 820 sends the intermediate data 2 to the node 810.

[0508] S912. The node 810 determines the real key (MK) based on the intermediate data 2 and the ciphertext key (C_MK).

[0509] The process in which the node 810 determines the real key (MK) can refer to the process in which the business module 203 determines the real key (MK) in the above-described embodiments shown in FIG. 3 to FIG. 6, and will not be described here again.

[0510] S913. The node 810 uses the real key (MK) to decrypt the original data from the ciphertext data.

[0511] The process in which the node 810 uses the real key (MK) to decrypt the original data from the ciphertext data can refer to the process in which the business module 203 uses the real key (MK) to decrypt the original data from the ciphertext data in the above-described embodiments shown in FIG. 3 to FIG. 6, and will not be described here again.

[0512] S914. After decrypting the original data, the node 810 deletes the real key (MK).

[0513] S915. After the node 810 uses the original data, the node 810 deletes the original data.

[0514] In a possible implementation, the node 830 can generate a session private key (SK) and a session public key (PK), where the session public key (PK) and the session private key (SK) are a pair of public and private keys. Then, the node 830 can disperse the session private key (SK) into a private key shard 1 (KEY_SK_1) and a private key shard 2 (KEY_SK_2). The node 830 can send the private key shard 1 (KEY_SK_1) to the node 810, and send the private key shard 2 (KEY_SK_2) to the node 820.

[0515] The process in which the node 830 generates the session private key (SK) and the session public key (PK) can refer to the process in which the security module 202 generates the session private key (SK) and the session public key (PK) in the embodiments shown in FIG. 3 and FIG. 4, and details are not described herein again.

[0516] In a possible implementation, the node 820 can first negotiate, with the node 810, a private key shard of a session private key (SK) and a public key shard of a session public key (PK). After the node 820 negotiates, with the node 810, the private key shard of the session private key (SK), the node 810 can obtain the private key shard 1 (KEY_SK_1) and the public key shard 1 (KEY_PK_1), and the node 820 can obtain the private key shard 2 (KEY_SK_2) and the public key shard 2 (KEY_PK_2). The node 810 can send the public key shard 1 (KEY_PK_1) to the node 830. The node 820 can send the public key shard 2 (KEY_PK_2) to the node 830. After obtaining the public key shard 1 (KEY_PK_1) and the public key shard 2 (KEY_PK_2), the node 830 can recover the session public key (PK) based on the public key shard 1 (KEY_PK_1) and the public key shard 2 (KEY_PK_2). The node 830 can encrypt a real key (MK) using the session public key (PK) to obtain a ciphertext key (C_MK). Then, the security module 202 can send the ciphertext key (C_MK) to the node 810.

[0517] The process in which the node 820 can negotiate, with the node 810, the private key shard of the session private key (SK) and the public key shard of the session public key (PK) can refer to the process in which the TEE negotiates, with the business module 203, the private key shard of the session private key (SK) and the public key shard of the session public key (PK) in the embodiments shown in FIG. 5 and FIG. 6, and details are not described herein again.

[0518] In a possible implementation, the node 810 and the node 820 can negotiate with each other to update the respective stored private key fragments, so that the node 810 and the node 820 update the respective updated private key fragments, and the respective updated private key fragments of the node 810 and the TEE are not exposed on the transmission link, but the node 810 and the TEE can still participate in the decryption calculation of the ciphertext key (C MK), so that the node 810 can successfully decrypt the real key (MK) from the ciphertext key (C MK), and the node 810 can successfully decrypt the original data from the ciphertext data. In this way, the respective stored private key fragments of the node 810 and the node 820 can be updated, the same private key fragments can be prevented from being used for a long time, the possibility of leakage of the private key fragments is reduced, and the security of the session private key (SK) is improved.

[0519] Specifically, the node 810 and the node 820 can negotiate with each other to update the respective stored private key fragments, and the process can refer to the process in which the business module 203 and the TEE update the respective stored private key fragments in the embodiment shown in FIG. 7, which will not be described here again.

[0520] The data protection method provided in the embodiment of the present application can be applied to a data protection system including the node 810 and the node 820. The node 810 stores ciphertext data encrypted by a real key. When performing a business, the node 810 needs to use the original data decrypted from the ciphertext data by the real key. The node 810 and the node 820 participate in the decryption calculation of the ciphertext key by using the respective stored private key fragments of the session private key, so that the real key is decrypted in the node 810, and the original data is decrypted from the ciphertext data by the real key. Optionally, the data protection system can further include the node 830, and before the ciphertext key is decrypted, the node 830 can encrypt the real key by using the session public key to obtain the ciphertext key. The node 830 can send the ciphertext key to the node 810 for storage.

[0521] In this way, in the process in which the node 810 recovers the real key (MK) from the ciphertext key (C MK), the respective stored private key fragments of the node 810 and the TEE are not exposed on the transmission link, the security of the private key fragments is improved, the security of the session private key is improved, and the security of the real key (MK) is improved, so that the security of the original data is improved. In addition, the node 810 can form a binding relationship with the node 820, and if either of the node 810 and the node 820 is imitated, the real key cannot be decrypted in the node 810, so that the security of the original data is ensured.

[0522] It should be noted that in some examples, the above intermediate data 1 can be referred to as first intermediate data, the above intermediate data 2 can be referred to as second intermediate data, the above private key fragment 1 (KEY_SK_1) can be referred to as a first private key fragment, the above private key fragment 2 (KEY_SK_2) can be referred to as a second private key fragment. The above node 810 can be referred to as a first node, the above node 820 can be referred to as a second node, and the above node 830 can be referred to as a third node.

[0523] The embodiments of the present application further provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the steps in the above various method embodiments.

[0524] The embodiments of the present application further provide a computer program product, which includes a computer program. When the computer program is run on a computer, the computer program causes the computer to implement the steps in the above various method embodiments.

[0525] The embodiments of the present application further provide a chip system, which includes a processing circuit and an interface circuit. The interface circuit is configured to receive code instructions and transmit the code instructions to the processing circuit. The processing circuit is configured to run the code instructions to cause the chip system to implement the steps in any method embodiment of the present application. The chip system can be a single chip or a chip module composed of multiple chips.

[0526] The above-described embodiments are only used to illustrate the technical solutions of the present application, but not limit the present application; even though the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A data protection method applied to an electronic device, characterized in that, The electronic device comprises a processor and a service module, and the processor runs a trusted execution environment (TEE); the method comprises: The service module generates first intermediate data based on a first private key fragment of a session private key and a ciphertext key, and the ciphertext key is generated by encrypting a real key by a session public key, and the session public key and the session private key are a pair of public and private keys; The service module sends a first decryption request to the TEE, and the first decryption request carries the first intermediate data; After receiving the first decryption request, the TEE generates second intermediate data based on the first intermediate data and a second private key fragment of the session private key; The TEE sends the second intermediate data to the service module; The service module decrypts the real key from the ciphertext key based on the second intermediate data.

2. A data protection method applied to an electronic device, characterized in that, The electronic device comprises a processor and a service module, and the processor runs a TEE; the method comprises: The service module generates first intermediate data based on a first private key fragment of a session private key and a ciphertext key, and the ciphertext key is generated by encrypting a real key by a session public key, and the session public key and the session private key are a pair of public and private keys; The service module sends a first decryption request to the TEE; After receiving the first decryption request, the TEE generates second intermediate data based on a second private key fragment of the session private key; The TEE sends the second intermediate data to the service module; The service module decrypts the real key from the ciphertext key based on the first intermediate data and the second intermediate data.

3. The method according to claim 1 or 2, characterized in that, The method further comprises: The service module decrypts original data from ciphertext data using the real key.

4. The method of claim 3, wherein, The method further comprises: After decrypting the original data, the service module deletes the real key.

5. The method of claim 3, wherein, The method further comprises: After using the original data, the service module deletes the original data.

6. The method according to any one of claims 1-5, characterized in that, The electronic device further comprises a security module; before the service module generates first intermediate data based on a first private key fragment of a session private key and a ciphertext key, the method further comprises: The security module disperses the session private key into the first private key fragment and the second private key fragment; The security module sends the first private key fragment to the service module; The security module sends the second private key fragment to the TEE.

7. The method of claim 6, wherein, The method further comprises: The security module encrypts the real key using the session public key to obtain the ciphertext key; The security module sends the ciphertext key to the service module.

8. The method according to claim 6 or 7, characterized in that, The session private key and the session public key are pre-stored in the security module.

9. The method according to claim 6 or 7, characterized in that, Before the security module disperses the session private key into the first private key fragment and the second private key fragment, the method further comprises: The security module generates the session private key and the session public key.

10. The method of any one of claims 1-5, wherein, The electronic device further comprises a security module; before the service module generates first intermediate data based on a first private key fragment of a session private key and a ciphertext key, the method further comprises: The business module negotiates a private key fragment of the session private key and a public key fragment of the session public key with the TEE, wherein the business module obtains the first private key fragment and the first public key fragment, and the TEE obtains the second private key fragment and the second public key fragment; The business module sends the first public key fragment to the security module; The TEE sends the second public key fragment to the security module; The security module generates the session public key based on the first public key fragment and the second public key fragment; The security module encrypts the real key using the session public key to obtain the ciphertext key; The security module sends the ciphertext key to the business module.

11. The method of claim 1, wherein, The sum of the first private key fragment and the second private key fragment is equal to the session private key, the ciphertext key includes key metadata and encrypted ciphertext; and the first decryption request carries the first intermediate data; The business module generates first intermediate data based on the first private key fragment of the session private key and the ciphertext key, specifically including: The business module generates a first random number; The business module determines first blinding data based on the first private key fragment, the first random number and the key metadata, and the first intermediate data includes the first blinding data; After receiving the first decryption request, the TEE generates second intermediate data based on the second private key fragment of the session private key, specifically including: After receiving the first decryption request, the TEE determines second blinding data based on the first blinding data, the second private key fragment and the key metadata, and the second intermediate data includes the second blinding data; The business module decrypts the real key from the ciphertext key based on the second intermediate data, specifically including: The business module determines unblinding data based on the second blinding data, the first random number and the key metadata; The business module decrypts the real key from the encrypted ciphertext based on the unblinding data.

12. The method of claim 11, wherein, The business module determines first blinding data based on the first private key fragment, the first random number and the key metadata, specifically including: The business module performs elliptic curve scalar multiplication operation on the sum of the first private key fragment and the first random number and the key metadata to obtain the first blinding data; After receiving the first decryption request, the TEE determines second blinding data based on the first blinding data, the second private key fragment and the key metadata, specifically including: The TEE adds the result of the elliptic curve scalar multiplication operation on the second private key fragment and the key metadata to the first blinding data to obtain the second blinding data; The business module determines unblinding data based on the second blinding data, the first random number and the key metadata, specifically including: The business module subtracts the result of the elliptic curve scalar multiplication operation on the first random number and the key metadata from the second blinding data to obtain the unblinding data; and The business module decrypts the real key from the encrypted ciphertext based on the unblinding data. The business module uses the de-blinding data and the encrypted ciphertext to determine a recovery key, specifically comprising: The business module derives an intermediate key based on the data length of the de-blinding data and the encrypted ciphertext; The business module performs an exclusive or operation on the encrypted ciphertext and the intermediate key to obtain the recovery key.

13. The method of claim 2, wherein, The sum of the first private key fragment and the second private key fragment is equal to the session private key, and the ciphertext key includes key metadata and encrypted ciphertext; The business module generates first intermediate data based on the first private key fragment of the session private key and the ciphertext key, specifically comprising: The business module performs elliptic curve scalar multiplication operation on the first private key fragment and the key metadata to obtain third blind data, and the first intermediate data includes the third blind data; The TEE generates second intermediate data based on the second private key fragment of the session private key after receiving the first decryption request, specifically comprising: The TEE performs elliptic curve scalar multiplication operation on the second private key fragment and the key metadata to obtain fourth blind data after receiving the first decryption request, and the second intermediate data includes the fourth blind data, and the second intermediate data includes the fourth blind data; The business module decrypts the real key from the ciphertext key based on the first intermediate data and the second intermediate data, specifically comprising: The business module adds the third blind data and the fourth blind data to obtain de-blinding data; The business module decrypts the real key from the encrypted ciphertext based on the de-blinding data.

14. The method according to any one of claims 11-13, characterized in that, The ciphertext key further includes verification data; The business module decrypts the real key from the encrypted ciphertext based on the de-blinding data, specifically comprising: The business module uses the de-blinding data and the encrypted ciphertext to determine a recovery key; The business module verifies the verification data based on the de-blinding data and the recovery key; The business module determines the recovery key as the real key after verifying the verification data successfully.

15. The method according to any one of claims 11-14, characterized in that, The ciphertext key is generated by encrypting the real key with a session public key, specifically comprising: Generating a second random number; Performing the elliptic curve scalar multiplication operation on the second random number as a private key and a base point on the elliptic curve to generate a public key corresponding to the second random number, and taking the public key corresponding to the second random number as the key metadata; Performing the elliptic curve scalar multiplication operation on the second random number and the session public key to obtain de-blinding data; Deriving the intermediate key based on the data length of the de-blinding data and the real key; Performing exclusive or operation on the intermediate key and the real key to obtain the encrypted ciphertext.

16. The method according to any one of claims 11-15, characterized in that, The method further comprises: The business module updates the first private key fragment to a third private key fragment; The TEE updates the second private key fragment to a fourth private key fragment, and the sum of the third private key fragment and the fourth private key fragment is equal to the session private key.

17. The method of claim 5, wherein, The business module updates the first private key fragment to a third private key fragment, specifically comprising: The business module generates a key update parameter; The business module generates the third private key fragment based on the key update parameter and the first private key fragment; The TEE updates the second private key fragment into a fourth private key fragment, and specifically includes: After receiving the key update parameter sent by the business module, the TEE generates the fourth private key fragment based on the key update parameter and the second private key fragment.

18. The method of claim 16 or 17, wherein, The method further includes: The business module generates third intermediate data based on the third private key fragment and the ciphertext key; The business module sends a second decryption request to the TEE; After receiving the second decryption request, the TEE generates fourth intermediate data based on the fourth private key fragment; The TEE sends the fourth intermediate data to the business module; The business module decrypts the real key from the ciphertext key based on the third intermediate data and the fourth intermediate data.

19. The method of any one of claims 1-6, wherein, The ciphertext key is pre-stored in the business module.

20. The method of any one of claims 1-19, wherein, The ciphertext key or key metadata in the ciphertext key is pre-stored in the TEE.

21. The method of any one of claims 1-19, wherein, The ciphertext key or key metadata in the ciphertext key is carried in the first decryption request.

22. An electronic device, comprising: Comprise: One or more processors and one or more memories, wherein the one or more memories are coupled to the one or more processors, and the one or more memories are configured to store a computer program, and when the one or more processors execute the computer program, the data protection method of any one of claims 1-21 is executed.

23. A computer-readable storage medium, characterized in that, A computer program is stored, and when the computer program is executed by a processor, the data protection method of any one of claims 1-21 is implemented.

24. A computer program product, characterised in that, Comprise a computer program, and when the computer program is executed by a processor, the data protection method of any one of claims 1-21 is implemented.

25. A chip system, characterized by Comprise processing circuitry and interface circuitry, the interface circuitry is configured to receive code instructions and transmit to the processing circuitry, and the processing circuitry is configured to run the code instructions to execute the data protection method of any one of claims 1-21.

Citation Information

Patent Citations

  • Efficient threshold encryption scheme

    CN107276759A

  • Key management method, system and device

    CN111245597A

  • Secret-related information maintenance method and device, equipment and storage medium

    CN116244750A

  • Data encryption method, data decryption method, data encryption device, data decryption device and electronic equipment

    CN117595986A

  • Sensitive data encryption

    US20230032363A1