Key processing method and device, computer device and storage medium
By using a secure hash function to process public and private keys to generate obfuscated values, the problem of blockchain account freezing caused by lost private keys is solved, enabling the recovery and secure storage of private keys and reducing the management burden.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER
- Filing Date
- 2023-08-07
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, the loss of a user's private key leads to the freezing of funds in the blockchain account, and the separate storage of public and private keys increases the management burden and the probability of loss, and the private key cannot be recovered.
A secure hash function is used to process the public and private keys, generate an obfuscated value and parse auxiliary parameters, recover the lost private key through the hash function, and store the private key using the obfuscated value, thereby reducing the management burden and ensuring security.
This technology enables the recovery of private keys in the event of loss, while reducing the management burden on users and ensuring the security of blockchain accounts and the protection of private keys.
Smart Images

Figure CN117134891B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information security technology, specifically to a key processing method, apparatus, computer device, and storage medium. Background Technology
[0002] Blockchain, a distributed ledger, has garnered widespread attention in recent years. In blockchain, users typically use two public-private key pairs to encrypt their accounts for security. This means that when a user makes a transaction, they need to provide both public and private key pairs to sign the transaction. Even if one private key is compromised, an attacker cannot control the user's account, thus enhancing account security.
[0003] However, the above method also brings new problems: if a user loses one of their private keys, for example, if the hardware device that the user stores the public and private key pair is lost or damaged, then the user will lose control of their account and the funds in the account will be permanently frozen.
[0004] To address this issue, users would need to copy two public-private key pairs. However, if a user stores both copies on a single device, and that device is stolen, an attacker could easily obtain the user's key information and impersonate the user to transfer funds from their account. Therefore, users need to store the two copies separately. This not only increases the user's management burden but also increases the probability of private key loss, and if either private key is lost, it cannot be recovered. Summary of the Invention
[0005] Therefore, it is necessary to provide a key processing method, apparatus, computer equipment, and storage medium to address the aforementioned technical problems, which can not only reduce the user's key management burden but also recover lost private keys.
[0006] Firstly, this application provides a key processing method, which includes:
[0007] If the first private key in the first public-private key pair of the target user is lost, a secure hash function is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain the first hash value.
[0008] The obfuscated value is parsed to obtain auxiliary parameters; the obfuscated value is determined based on a secure hash function, a random number, a first private key, a second private key, and an additive group, and the first public key is constructed based on the first private key and the generator of the additive group;
[0009] A secure hash function is used to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key.
[0010] In one embodiment, a secure hash function is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain a first hash value, including:
[0011] Determine the product between the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user;
[0012] A secure hash function is used to hash the product to obtain the first hash value.
[0013] In one embodiment, the auxiliary parameters include a first auxiliary parameter and a second auxiliary parameter, and the obfuscation value is determined in the following manner:
[0014] The product of the random number and the generator of the additive group is used as the first auxiliary parameter;
[0015] A secure hash function is used to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter;
[0016] The confusion value is obtained based on the first auxiliary parameter and the second auxiliary parameter.
[0017] In one embodiment, a secure hash function is used to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter, including:
[0018] A secure hash function is used to process the first private key, the second private key, and the generator to obtain the first hash value;
[0019] A secure hash function is used to process the random number, the first hash value, and the generator to obtain the second hash value;
[0020] A second auxiliary parameter is generated based on the second hash value, the first private key, and the second private key.
[0021] In one embodiment, a secure hash function is used to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key, including:
[0022] A secure hash function is used to hash the first hash value and the first auxiliary parameter to obtain the second hash value.
[0023] The first private key is obtained based on the second hash value, the second auxiliary parameter, and the second private key.
[0024] In one embodiment, the method further includes:
[0025] Determine security parameters based on the security level requirements of the blockchain accounts corresponding to the target users;
[0026] Determine the addition group based on the safety parameters;
[0027] Determine the secure hash function based on the security parameters and the additive group.
[0028] In one embodiment, the method further includes:
[0029] A key generation function is used to generate the third private key in the third public-private key pair based on security parameters;
[0030] Construct the third public key in the third public-private key pair based on the third private key and the generator;
[0031] The third public-private key pair is used as the new first public-private key pair, and the obfuscation value is updated based on the new first public-private key pair.
[0032] Secondly, this application also provides a key processing apparatus, which includes:
[0033] The first processing module is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user using a secure hash function to obtain the first hash value when the first private key in the first public-private key pair of the target user is lost.
[0034] The parsing module is used to parse the obfuscated value to obtain auxiliary parameters. The obfuscated value is determined based on a secure hash function, a random number, a first private key, a second private key, and an additive group. The first public key is constructed based on the first private key and the generator of the additive group.
[0035] The recovery module is used to obtain the first private key using a secure hash function, based on the first hash value, auxiliary parameters, and the second private key.
[0036] Thirdly, this application also provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described key processing method.
[0037] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described key processing method.
[0038] Fifthly, this application also provides a computer program product comprising a computer program that, when executed by a processor, implements the steps of the above-described key processing method.
[0039] The aforementioned key processing method, apparatus, computer equipment, and storage medium, in the event of loss of the first private key in the target user's first public-private key pair, employ a secure hash function to process the first public key in the first public-private key pair and the second private key in the target user's second public-private key pair to obtain a first hash value. The obfuscated value is then parsed to obtain auxiliary parameters. Finally, a secure hash function is used to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key. Compared to existing technologies that separate copies of the two public-private key pairs used to protect the account to prevent attackers from impersonating the user and transferring resources, thus increasing the user's management burden, the key processing method of this application, on the one hand, uses the obfuscated value obtained from processing the first and second private keys to preserve the private key, reducing the user's management burden; on the other hand, since the obfuscated value is determined based on a secure hash function, a random number, the first private key, the second private key, and an additive group, it masks the first and second private keys. Therefore, even if the obfuscated value is stolen, the private key itself cannot be truly obtained, thus ensuring the security of the blockchain account. Furthermore, if the private key in one of the two public-private key pairs is lost, the lost private key can be recovered based on the obfuscation value and the unlost parts of the two public-private key pairs. Attached Figure Description
[0040] Figure 1 This is a flowchart illustrating a key processing method in one embodiment;
[0041] Figure 2 This is a schematic diagram of the process for determining the first hash value in one embodiment;
[0042] Figure 3 This is a flowchart illustrating the process of determining the obfuscation value in one embodiment;
[0043] Figure 4 This is a flowchart illustrating the process of determining a second auxiliary parameter in one embodiment;
[0044] Figure 5 This is a schematic diagram of the process for determining the first private key in one embodiment;
[0045] Figure 6 This is a schematic diagram of the process for updating obfuscation values in one embodiment;
[0046] Figure 7 This is a flowchart illustrating the key processing method in another embodiment;
[0047] Figure 8 This is a structural block diagram of a key processing device in one embodiment;
[0048] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0049] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0050] Blockchain, a distributed ledger, has garnered widespread attention in recent years. In a blockchain, each user holds at least one public-private key pair. When a user wants to make a transfer, they need to use their private key to sign the transaction. Once verified, the transaction is then packaged into the blockchain. This means that if a user's private key is leaked, an attacker could impersonate the user and steal all the resources in their account, causing significant financial losses.
[0051] To address these issues, a straightforward approach is to utilize two public-private key pairs to manage accounts. This means that when a user makes a transaction, they must provide both public and private key pairs to sign the transaction. Even if one private key is compromised, an attacker cannot control the user's account, thus enhancing account security.
[0052] However, the above method also brings new problems: if a user loses one of their private keys—for example, if the hardware device storing the public-private key pair is lost or damaged—the user will lose control of their account, and the funds in the account will be permanently frozen. To solve this problem, the user needs to make copies of both public-private key pairs. But if the user uses a device to store both copies simultaneously, once that device is stolen, an attacker can easily obtain the user's key information and impersonate the user to transfer resources from the account. Therefore, the user needs to keep the two copies separately, which not only increases the user's management burden but also increases the probability of private key loss, and in the event of loss of either private key, it cannot be recovered. Based on this, embodiments of this application provide a key processing method to improve the above-mentioned technical problems.
[0053] In one embodiment, Figure 1 This is a flowchart illustrating a key processing method according to an embodiment of this application, and the method is described using an application to a server as an example. The method includes the following steps:
[0054] S101, if the first private key in the first public-private key pair of the target user is lost, a secure hash function is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain the first hash value.
[0055] Optionally, the target user can be any user in the blockchain. To protect the security of their blockchain account resources, the target user sets up a key mechanism, which includes two public-private key pairs. Optionally, in this embodiment, the target user's lost private key is used as the first private key, and the corresponding public-private key pair is used as the first public-private key pair. Correspondingly, the target user's other public-private key pair is used as the second public-private key pair. The first public-private key pair includes a first public key and a first private key, and the second public-private key pair includes a second public key and a second private key.
[0056] Furthermore, a secure hash function, also known as a secure hash map, can be a function that maps a bit string of arbitrary length consisting of 0s and 1s to integers within a fixed length range. The generation of a secure hash function is influenced by various factors, such as security parameters determined based on the target user's security level requirements for the blockchain account, and the order of the additive group determined based on these security parameters. Optionally, security parameters can be determined based on the security level requirements of the target user's blockchain account; the additive group can be determined based on these security parameters; and the secure hash function can be determined based on the security parameters and the additive group. Here, the additive group is the group formed by adding numbers using ordinary addition operations, and its order is the number of elements in the additive group.
[0057] For example, since there is a first mapping relationship between security level requirements and security parameters, and a second mapping relationship between security parameters and the order of the additive group, security parameters can be determined according to security level requirements, and then the order of the additive group (denoted as p) can be determined according to security parameters. The secure hash function in this embodiment is a function that maps a bit string of arbitrary length consisting of 0s and 1s to integers within a fixed length interval of 1-p, i.e., H:{0,1}→Z p .
[0058] Specifically, in the case where the first private key in the first public-private key pair of the target user is lost, security parameters are determined according to the security level requirements of the blockchain account corresponding to the target user. Then, the order of the additive group is determined according to the security parameters, and a secure hash function is determined according to the order of the additive group. The secure hash function is then used to perform hash calculation on the first public key and the second private key to obtain the first hash value corresponding to the first public key and the second private key.
[0059] S102, parse the obfuscation value to obtain auxiliary parameters.
[0060] Optionally, the first public key is constructed based on the first private key and the generator of the additive group. Further, the obfuscation value can be a value determined by a secure hash function, a random number, the first private key, the second private key, and the generator, and is kept by the user, with the random number being an integer between 1 and p.
[0061] Furthermore, the auxiliary parameters can be parameters that play an auxiliary role in the generation process of the obfuscated value and the recovery process of the private key; optionally, in the embodiments of this application, the auxiliary parameters of the obfuscated value include a first auxiliary parameter and a second auxiliary parameter.
[0062] It should be noted that repeatedly performing addition operations on a certain number can yield all the elements of the additive group, and that number is the generator of the additive group.
[0063] Furthermore, since obfuscated values can be obtained by combining auxiliary parameters according to preset combination rules, conversely, preset parsing rules can be determined based on preset combination rules, and the obfuscated values can be parsed according to these preset parsing rules to obtain auxiliary parameters.
[0064] S103 uses a secure hash function to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key.
[0065] Specifically, after determining the secure hash function, the first hash value, the auxiliary parameters, and the second private key, the secure hash function is used to calculate the first hash value, the auxiliary parameters, and the second private key according to the key calculation formula, thereby recovering the first private key.
[0066] In the aforementioned key processing method, if the first private key in the target user's first public-private key pair is lost, a secure hash function is used to process the first public key in the first public-private key pair and the second private key in the target user's second public-private key pair to obtain a first hash value. The obfuscated value is then parsed to obtain auxiliary parameters. Finally, a secure hash function is used to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key. Compared to existing technologies that separate copies of the two public-private key pairs used to protect the account to prevent attackers from impersonating the user and transferring resources, thus increasing the user's management burden, the key processing method of this application, on the one hand, uses the obfuscated value obtained from processing the first and second private keys to preserve the private key, reducing the user's management burden; on the other hand, since the obfuscated value is determined based on a secure hash function, a random number, the first private key, the second private key, and an additive group, it masks the first and second private keys. Therefore, even if the obfuscated value is stolen, the private key itself cannot be obtained, thus ensuring the security of the blockchain account. Furthermore, if the private key in one of the two public-private key pairs is lost, the lost private key can be recovered based on the obfuscation value and the unlost parts of the two public-private key pairs.
[0067] Based on the above embodiments, by Figure 2 The steps for determining the first hash value have been broken down and refined. Optional, such as... Figure 2 As shown, the implementation process includes the following:
[0068] S201, determine the product between the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user.
[0069] Specifically, the first public key from the first public-private key pair and the second private key from the target user's second public-private key pair are extracted, and the product between the first public key and the second private key is calculated. For example, if the first public key is denoted as pk1 and the second private key as sk2, their product is pk1*sk2.
[0070] S202 uses a secure hash function to hash the product and obtain the first hash value.
[0071] Specifically, after obtaining the product between the first public key and the second private key, a secure hash function is used to hash this product to obtain the first hash value. For example, the secure hash function uses the product between the first public key and the second private key, pk1*sk2, as a parameter, and performs a hash calculation on this parameter to obtain the first hash value hash1 = H(pk1*sk2).
[0072] It is understandable that in this embodiment, the first hash value is obtained through a secure hash function, which lays the foundation for the subsequent key processing.
[0073] Based on the above embodiments, by Figure 3 The steps for determining the confusion value have been broken down and refined.
[0074] like Figure 3 As shown, the implementation process includes the following:
[0075] S301 uses the product of the random number and the generator of the additive group as the first auxiliary parameter.
[0076] Specifically, the first auxiliary parameter is obtained by extracting the random number and the generator of the additive group and multiplying them. For example, if the first auxiliary parameter, the random number, and the generator of the additive group are denoted as R, r, and P respectively, then the first auxiliary parameter is R = r * P.
[0077] S302 uses a secure hash function to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter.
[0078] Specifically, the first private key, the second private key, and the generator are extracted, and any integer in the range of 1 to p is randomly selected as a random number. The first private key, the second private key, the generator, and the random number are then calculated according to a preset calculation rule to obtain the second auxiliary parameter.
[0079] S303, based on the first auxiliary parameter and the second auxiliary parameter, obtain the confusion value.
[0080] Specifically, after obtaining the first auxiliary parameter and the second auxiliary parameter, the first auxiliary parameter and the second auxiliary parameter are combined according to a preset combination rule to obtain the confusion value.
[0081] It is understandable that this embodiment provides an optional way to obtain the obfuscated value by using a secure hash function in combination with the first and second private keys, thus providing the conditions for recovering the first private key and laying the foundation for subsequent key processing.
[0082] Based on the above embodiments, by Figure 4 The steps for determining the second auxiliary parameter have been broken down and refined. For example... Figure 4 As shown, the implementation process includes the following:
[0083] S401 uses a secure hash function to process the first private key, the second private key, and the generator to obtain the first hash value.
[0084] Specifically, the first private key from the first public-private key pair and the second private key from the second public-private key pair of the target user are extracted. The product between the first public key, the second private key, and the generator is calculated, and a secure hash function is used to hash this product to obtain the first hash value. For example, if the second auxiliary parameter is denoted as δ and the first private key is denoted as sk1, the first private key sk1 from the first public-private key pair and the second private key sk2 from the second public-private key pair are extracted. The product of these two and the generator is sk1*sk2*P. This product is used as the parameter of the secure hash function, and the hash function is used to hash this product to obtain the first hash value hash1 = H(sk1*sk2*P).
[0085] It should be noted that since the first public key is constructed based on the first private key and the generator, the first hash value obtained in step S401 is equal to the first hash value obtained by processing the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user using a secure hash function, thus providing the conditions for recovering the first private key.
[0086] S402 uses a secure hash function to process the random number, the first hash value, and the generator to obtain the second hash value.
[0087] Specifically, after obtaining the first hash value, the product between the random number, the first hash value, and the generator is determined, and a secure hash function is used to perform hash calculation on this product to obtain the second hash value. For example, since the random number, the first hash value, and the generator are r, hash1, and P respectively, the product between the random number, the first hash value, and the generator can be determined as r*hash1*P. This product is used as the parameter of the secure hash function, and the hash calculation is performed on this product to obtain the second hash value hash2 = H(r*hash1*P).
[0088] S403, generate the second auxiliary parameter based on the second hash value, the first private key, and the second private key.
[0089] Specifically, after obtaining the second hash value, the second auxiliary parameter can be obtained by combining the first and second private keys and multiplying them. For example, since the second hash value, the first private key, and the second private key are hash2, sk1, and sk2 respectively, the product of the second hash value, the first private key, and the second private key can be determined as hash2*sk1*sk2, thus yielding the second auxiliary parameter δ = H(r*hash1*P)*sk1*sk2.
[0090] It is understandable that this embodiment provides an optional way to obtain the second auxiliary parameter through a secure hash function and preset calculation rules, which provides the conditions for recovering the first private key and lays the foundation for the subsequent key processing.
[0091] Based on the above embodiments, by Figure 5 The steps for determining the first private key have been broken down and refined. Optional, such as... Figure 5 As shown, the implementation process includes the following:
[0092] S501 uses a secure hash function to hash the first hash value and the first auxiliary parameter to obtain the second hash value.
[0093] Specifically, after obtaining the first hash value and the first auxiliary parameter, the two are multiplied to obtain the product between the first hash value and the first auxiliary parameter. A secure hash function is then used to perform a hash calculation on this product to obtain the second hash value. For example, since the first hash value and the first auxiliary parameter are hash1 and R respectively, the product between the first hash value and the first auxiliary parameter can be determined as hash1*R. A secure hash function is then used to perform a hash calculation on this product to obtain the second hash value hash2 = H(hash1*R).
[0094] S502, based on the second hash value, the second auxiliary parameter, and the second private key, obtain the first private key.
[0095] Specifically, after obtaining the second hash value, the second auxiliary parameter and the second private key are combined and calculated according to a preset calculation rule to obtain the first private key. For example, since the second hash value, the second auxiliary parameter, and the second private key are hash2, δ, and sk2 respectively, and the preset calculation rule is sk1 = δ * (H(hash2 * R)) -1 *sk2 -1Substituting hash2, δ, and sk2 into the above formula, we can obtain the first private key sk1.
[0096] It is understood that this embodiment provides an optional method for recovering the first private key by using a secure hash function, combined with the first hash value, the first auxiliary parameter, the second auxiliary parameter, and the second private key.
[0097] To better protect the blockchain account information of target users, it is necessary to update the obfuscation value regularly or periodically. This application embodiment uses... Figure 6 The steps for updating the obfuscation value have been broken down and refined. Optional, such as Figure 6 As shown, the implementation process includes the following:
[0098] S601 uses a key generation function to generate the third private key in the third public-private key pair based on security parameters.
[0099] Specifically, a key generation function is used to randomly generate a private key, which serves as the third private key, based on security parameters determined according to the security level requirements of the target user's blockchain account. For example, if the security parameter is denoted as l, the (sk,pk)←KeyGen(l) function is used to randomly generate the third private key sk3.
[0100] S602, construct the third public key in the third public-private key pair based on the third private key and the generator.
[0101] Specifically, after obtaining the third private key sk3, the third public key can be determined according to the preset relationship between the private and public keys. For example, if the third public key is denoted as pk3, after obtaining the third private key sk3, the third private key sk3 can be obtained by combining the generator P and the preset relationship between the private and public keys pk = sk * P.
[0102] S603, take the third public-private key pair as the new first public-private key pair, and update the obfuscation value based on the new first public-private key pair.
[0103] Specifically, after obtaining the third public key, it is used to construct a third public-private key pair with the third private key. This third public-private key pair is then used to replace the original first public-private key pair, which becomes the new first public-private key pair. Based on this new first public-private key pair, the obfuscation value is updated.
[0104] Furthermore, to ensure the security of blockchain accounts, while updating the obfuscation value, it is also necessary to transfer elements of the original blockchain account to the new blockchain account. For example, an on-chain resource transfer transaction request can be initiated using the account information of the original blockchain account. This request includes the target user's new blockchain address, instructing blockchain nodes to transfer elements of the original blockchain account (e.g., data and / or assets stored in the original blockchain account) to the new blockchain account, replacing the original account. For instance, the original blockchain account is controlled by a first public-private key pair and a second public-private key pair; the new blockchain account is controlled by a second public-private key pair and a new first public-private key pair (i.e., a third public-private key pair). After updating the public-private key pairs, the obfuscation value can be updated based on the updated public-private key pairs. The on-chain resource transfer transaction request can also include the target user's original blockchain key (such as the original blockchain public key). The original blockchain key is used to verify the on-chain element transfer transaction request. If the verification is successful, the elements of the original blockchain account are transferred to the new blockchain account.
[0105] It should be noted that after transferring elements from the original blockchain account to the new blockchain account, the relevant information of the target user's original blockchain account saved locally can be deleted.
[0106] It is understandable that by updating the obfuscation value in this embodiment, the blockchain account information of the target user can be better protected.
[0107] In one embodiment, via Figure 7 A flowchart of a key processing method in another embodiment is shown, in conjunction with... Figure 7 As shown, each stage includes the following implementation process:
[0108] S701 uses the product of the random number and the generator of the additive group as the first auxiliary parameter.
[0109] S702 uses a secure hash function to process the first private key, the second private key, and the generator to obtain the first hash value.
[0110] S703 uses a secure hash function to process the random number, the first hash value, and the generator to obtain the second hash value.
[0111] S704, generate the second auxiliary parameter based on the second hash value, the first private key, and the second private key.
[0112] The obfuscation value can be obtained based on the first and second auxiliary parameters. Furthermore, the auxiliary parameters can be obtained by parsing the obfuscation value.
[0113] S705, based on the first auxiliary parameter and the second auxiliary parameter, the confusion value can be obtained.
[0114] S706, if the first private key in the first public-private key pair of the target user is lost, determine the product between the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user.
[0115] S707 uses a secure hash function to hash the product and obtain the first hash value.
[0116] Optionally, the first public key is constructed from the first private key and the generator of the addition group.
[0117] S708, the obfuscation value is parsed to obtain the first auxiliary parameter and the second auxiliary parameter.
[0118] S709 uses a secure hash function to hash the first hash value and the first auxiliary parameter to obtain the second hash value.
[0119] S710 obtains the first private key based on the second hash value, the second auxiliary parameter, and the second private key.
[0120] S711 uses a key generation function to generate the third private key in the third public-private key pair based on security parameters.
[0121] S712, construct the third public key in the third public-private key pair based on the third private key and the generator.
[0122] S713, take the third public-private key pair as the new first public-private key pair, and update the obfuscation value based on the new first public-private key pair.
[0123] The specific processes of S701-S713 described above can be found in the description of the above method embodiments. Their implementation principles and technical effects are similar and will not be repeated here.
[0124] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0125] Based on the same inventive concept, this application also provides a key processing apparatus for implementing the key processing method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more key processing apparatus embodiments provided below can be found in the limitations of the key processing method described above, and will not be repeated here.
[0126] In one embodiment, by Figure 8 A structural block diagram of a key processing device in one embodiment is shown. Figure 8 As shown, a key processing device 8 is provided, which includes: a first processing module 80, a parsing module 81, and a recovery module 82, wherein:
[0127] The first processing module 80 is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user using a secure hash function to obtain a first hash value when the first private key in the first public-private key pair of the target user is lost.
[0128] The parsing module 81 is used to parse the obfuscated value to obtain auxiliary parameters; wherein, the obfuscated value is determined based on the secure hash function, random number, first private key, second private key and additive group, and the first public key is constructed based on the first private key and the generator of additive group;
[0129] Recovery module 82 is used to obtain the first private key using a secure hash function based on the first hash value, auxiliary parameters, and the second private key.
[0130] The aforementioned key processing device, in the event of loss of the first private key in the target user's first public-private key pair, uses a secure hash function to process the first public key in the first public-private key pair and the second private key in the target user's second public-private key pair to obtain a first hash value. It then parses the obfuscated value to obtain auxiliary parameters, and subsequently uses a secure hash function to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key. Compared to existing technologies that separate copies of the two public-private key pairs used to protect the account to prevent attackers from impersonating the user and transferring resources, thus increasing the user's management burden, the key processing method of this application, on the one hand, uses the obfuscated value obtained from processing the first and second private keys to preserve the private key, reducing the user's management burden; on the other hand, since the obfuscated value is determined based on a secure hash function, a random number, the first private key, the second private key, and an additive group, it masks the first and second private keys, thus ensuring that even if the obfuscated value is stolen, the private key itself cannot be obtained, thereby guaranteeing the security of the blockchain account. Furthermore, if the private key in one of the two public-private key pairs is lost, the lost private key can be recovered based on the obfuscation value and the unlost parts of the two public-private key pairs.
[0131] In one embodiment, the first processing module 80 is specifically used for:
[0132] Determine the product between the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user; use a secure hash function to hash the product to obtain the first hash value.
[0133] In one embodiment, the device 8 further includes:
[0134] The first determining module is used to take the product of the random number and the generator of the additive group as the first auxiliary parameter;
[0135] The second processing module is used to process the random number, the first private key, the second private key, and the generator using a secure hash function to obtain the second auxiliary parameter;
[0136] The second determining module is used to obtain the obfuscation value based on the first auxiliary parameter and the second auxiliary parameter.
[0137] In one embodiment, the second processing module is specifically used for:
[0138] A secure hash function is used to process the first private key, the second private key, and the generator to obtain the first hash value; a secure hash function is used to process the random number, the first hash value, and the generator to obtain the second hash value; and a second auxiliary parameter is generated based on the second hash value, the first private key, and the second private key.
[0139] In one embodiment, the recovery module 82 is specifically used for:
[0140] A secure hash function is used to hash the first hash value and the first auxiliary parameter to obtain the second hash value; the first private key is obtained based on the second hash value, the second auxiliary parameter, and the second private key.
[0141] In one embodiment, the device 8 further includes:
[0142] The module is used to determine security parameters based on the security level requirements of the target user's blockchain account; determine the additive group based on the security parameters; and determine the secure hash function based on the security parameters and the additive group.
[0143] In one embodiment, the device 8 further includes:
[0144] The update module is used to generate a third private key in a third public-private key pair based on security parameters using a key generation function; construct a third public key in a third public-private key pair based on the third private key and the generator; use the third public-private key pair as a new first public-private key pair; and update the obfuscation value based on the new first public-private key pair.
[0145] Each module in the aforementioned key processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0146] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows. Figure 9 As shown, the computer device includes a processor, memory, network interface, and transceiver connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The transceiver, under the control of the processor, performs operations to receive or send data. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data such as sample data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a key processing method.
[0147] Those skilled in the art will understand that Figure 9The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specifically, the computer device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0148] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0149] If the first private key in the first public-private key pair of the target user is lost, a secure hash function is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain the first hash value.
[0150] The obfuscated value is parsed to obtain auxiliary parameters; the obfuscated value is determined based on a secure hash function, a random number, a first private key, a second private key, and an additive group, and the first public key is constructed based on the first private key and the generator of the additive group;
[0151] A secure hash function is used to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key.
[0152] In one embodiment, when the processor executes the logic in the computer program that uses a secure hash function to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain the first hash value, the following steps are specifically implemented:
[0153] Determine the product between the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user; use a secure hash function to hash the product to obtain the first hash value.
[0154] In one embodiment, the auxiliary parameters include a first auxiliary parameter and a second auxiliary parameter. When the processor executes the logic for determining the obfuscation value in the computer program, it specifically implements the following steps:
[0155] The product of the random number and the generator of the additive group is used as the first auxiliary parameter; a secure hash function is used to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter; based on the first and second auxiliary parameters, the obfuscation value is obtained.
[0156] In one embodiment, when the processor executes the logic in the computer program that uses a secure hash function to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter, the following steps are specifically implemented:
[0157] A secure hash function is used to process the first private key, the second private key, and the generator to obtain the first hash value; a secure hash function is used to process the random number, the first hash value, and the generator to obtain the second hash value; and a second auxiliary parameter is generated based on the second hash value, the first private key, and the second private key.
[0158] In one embodiment, when the processor executes the logic in the computer program that uses a secure hash function to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key, it also specifically implements the following:
[0159] A secure hash function is used to hash the first hash value and the first auxiliary parameter to obtain the second hash value; the first private key is obtained based on the second hash value, the second auxiliary parameter, and the second private key.
[0160] In one embodiment, when the processor executes the logic in the computer program, it further implements the following steps:
[0161] Based on the security level requirements of the blockchain accounts corresponding to the target users, determine the security parameters; based on the security parameters, determine the additive group; based on the security parameters and the additive group, determine the secure hash function.
[0162] In one embodiment, when the processor executes the logic in the computer program, it further implements the following steps:
[0163] Using a key generation function, a third private key is generated in the third public-private key pair according to the security parameters; based on the third private key and the generator, a third public key is constructed in the third public-private key pair; the third public-private key pair is used as the new first public-private key pair, and the obfuscation value is updated based on the new first public-private key pair.
[0164] The principles and specific processes of the computer equipment provided above in implementing each embodiment can be found in the description of the key processing method embodiment in the foregoing embodiments, and will not be repeated here.
[0165] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0166] If the first private key in the first public-private key pair of the target user is lost, a secure hash function is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain the first hash value.
[0167] The obfuscated value is parsed to obtain auxiliary parameters; the obfuscated value is determined based on a secure hash function, a random number, a first private key, a second private key, and an additive group, and the first public key is constructed based on the first private key and the generator of the additive group;
[0168] A secure hash function is used to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key.
[0169] In one embodiment, when the logic of using a secure hash function in the computer program to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain the first hash value is executed by the processor, the following steps are specifically implemented:
[0170] Determine the product between the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user; use a secure hash function to hash the product to obtain the first hash value.
[0171] In one embodiment, the auxiliary parameters include a first auxiliary parameter and a second auxiliary parameter. When the logic for determining the obfuscation value in the computer program is executed by the processor, the following steps are also specifically implemented:
[0172] The product of the random number and the generator of the additive group is used as the first auxiliary parameter; a secure hash function is used to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter; based on the first and second auxiliary parameters, the obfuscation value is obtained.
[0173] In one embodiment, when the logic of using a secure hash function in the computer program to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter is executed by the processor, the following steps are specifically implemented:
[0174] A secure hash function is used to process the first private key, the second private key, and the generator to obtain the first hash value; a secure hash function is used to process the random number, the first hash value, and the generator to obtain the second hash value; and a second auxiliary parameter is generated based on the second hash value, the first private key, and the second private key.
[0175] In one embodiment, when the logic of obtaining the first private key based on the first hash value, auxiliary parameters, and the second private key using a secure hash function in the computer program is executed by the processor, the following is also specifically implemented:
[0176] A secure hash function is used to hash the first hash value and the first auxiliary parameter to obtain the second hash value; the first private key is obtained based on the second hash value, the second auxiliary parameter, and the second private key.
[0177] In one embodiment, when the logic in the computer program is executed by the processor, the following steps are also specifically implemented:
[0178] Based on the security level requirements of the blockchain accounts corresponding to the target users, determine the security parameters; based on the security parameters, determine the additive group; based on the security parameters and the additive group, determine the secure hash function.
[0179] In one embodiment, when the logic in the computer program is executed by the processor, the following steps are also specifically implemented:
[0180] Using a key generation function, a third private key is generated in the third public-private key pair according to the security parameters; based on the third private key and the generator, a third public key is constructed in the third public-private key pair; the third public-private key pair is used as the new first public-private key pair, and the obfuscation value is updated based on the new first public-private key pair.
[0181] The principles and specific processes of the computer-readable storage medium provided above in implementing the various embodiments can be found in the description of the key processing method embodiments in the foregoing embodiments, and will not be repeated here.
[0182] The principles and specific processes of the computer-readable storage medium provided above in implementing the various embodiments can be found in the descriptions of the target detection method embodiments in the foregoing embodiments, and will not be repeated here.
[0183] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0184] If the first private key in the first public-private key pair of the target user is lost, a secure hash function is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain the first hash value.
[0185] The obfuscated value is parsed to obtain auxiliary parameters; the obfuscated value is determined based on a secure hash function, a random number, a first private key, a second private key, and an additive group, and the first public key is constructed based on the first private key and the generator of the additive group;
[0186] A secure hash function is used to obtain the first private key based on the first hash value, auxiliary parameters, and the second private key.
[0187] In one embodiment, when the logic of using a secure hash function in the computer program to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain the first hash value is executed by the processor, the following steps are specifically implemented:
[0188] Determine the product between the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user; use a secure hash function to hash the product to obtain the first hash value.
[0189] In one embodiment, the auxiliary parameters include a first auxiliary parameter and a second auxiliary parameter. When the logic for determining the obfuscation value in the computer program is executed by the processor, the following steps are also specifically implemented:
[0190] The product of the random number and the generator of the additive group is used as the first auxiliary parameter; a secure hash function is used to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter; based on the first and second auxiliary parameters, the obfuscation value is obtained.
[0191] In one embodiment, when the logic of using a secure hash function in the computer program to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter is executed by the processor, the following steps are specifically implemented:
[0192] A secure hash function is used to process the first private key, the second private key, and the generator to obtain the first hash value; a secure hash function is used to process the random number, the first hash value, and the generator to obtain the second hash value; and a second auxiliary parameter is generated based on the second hash value, the first private key, and the second private key.
[0193] In one embodiment, when the logic of obtaining the first private key based on the first hash value, auxiliary parameters, and the second private key using a secure hash function in the computer program is executed by the processor, the following is also specifically implemented:
[0194] A secure hash function is used to hash the first hash value and the first auxiliary parameter to obtain the second hash value; the first private key is obtained based on the second hash value, the second auxiliary parameter, and the second private key.
[0195] In one embodiment, when the logic in the computer program is executed by the processor, the following steps are also specifically implemented:
[0196] Based on the security level requirements of the blockchain accounts corresponding to the target users, determine the security parameters; based on the security parameters, determine the additive group; based on the security parameters and the additive group, determine the secure hash function.
[0197] In one embodiment, when the logic in the computer program is executed by the processor, the following steps are also specifically implemented:
[0198] Using a key generation function, a third private key is generated in the third public-private key pair according to the security parameters; based on the third private key and the generator, a third public key is constructed in the third public-private key pair; the third public-private key pair is used as the new first public-private key pair, and the obfuscation value is updated based on the new first public-private key pair.
[0199] The principles and specific processes of implementing the computer program products provided above can be found in the descriptions of the target detection method embodiments in the foregoing embodiments, and will not be repeated here.
[0200] It should be noted that all information involved in this application (including but not limited to the target user's blockchain account information, public and private key pairs, etc.) has been fully authorized by all parties.
[0201] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0202] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0203] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A key processing method, characterized in that, include: If the first private key in the first public-private key pair of the target user is lost, a secure hash function is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user to obtain the first hash value. The obfuscated value is parsed to obtain auxiliary parameters; wherein, the first public key is constructed based on the first private key and the generator of the additive group; Using the secure hash function, the first private key is obtained based on the first hash value, the auxiliary parameters, and the second private key; The auxiliary parameters include a first auxiliary parameter and a second auxiliary parameter, and the confusion value is determined in the following manner: The product of the random number and the generator of the additive group is used as the first auxiliary parameter; The secure hash function is used to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter; The obfuscation value is obtained based on the first auxiliary parameter and the second auxiliary parameter.
2. The method according to claim 1, characterized in that, The first hash value is obtained by processing the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user using a secure hash function, including: Determine the product between the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user; A secure hash function is used to hash the product to obtain a first hash value.
3. The method according to claim 1, characterized in that, The secure hash function is used to process the random number, the first private key, the second private key, and the generator to obtain the second auxiliary parameter, including: The first hash value is obtained by processing the first private key, the second private key, and the generator using the secure hash function. The secure hash function is used to process the random number, the first hash value, and the generator to obtain the second hash value; A second auxiliary parameter is generated based on the second hash value, the first private key, and the second private key.
4. The method according to claim 1, characterized in that, The step of obtaining the first private key using the secure hash function, based on the first hash value, the auxiliary parameters, and the second private key, includes: The first hash value and the first auxiliary parameter are hashed using the secure hash function to obtain the second hash value; The first private key is obtained based on the second hash value, the second auxiliary parameter, and the second private key.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: Based on the security level requirements of the blockchain account corresponding to the target user, determine the security parameters; The addition group is determined based on the security parameters; The secure hash function is determined based on the security parameters and the additive group.
6. The method according to claim 1, characterized in that, The method further includes: A key generation function is used to generate the third private key in the third public-private key pair based on security parameters; Based on the third private key and the generator, construct the third public key in the third public-private key pair; The third public-private key pair is used as the new first public-private key pair, and the obfuscation value is updated based on the new first public-private key pair.
7. A key processing device, characterized in that, The device includes: The first processing module is used to process the first public key in the first public-private key pair and the second private key in the second public-private key pair of the target user using a secure hash function to obtain a first hash value when the first private key in the first public-private key pair of the target user is lost. The parsing module is used to parse the obfuscated value to obtain auxiliary parameters; wherein, the first public key is constructed based on the first private key and the generator of the additive group; The recovery module is used to obtain the first private key by using the secure hash function, based on the first hash value, the auxiliary parameters, and the second private key; The device further includes: The first determining module is used to take the product of the random number and the generator of the additive group as the first auxiliary parameter; The second processing module is used to process the random number, the first private key, the second private key, and the generator using a secure hash function to obtain the second auxiliary parameter; The second determining module is used to obtain the obfuscation value based on the first auxiliary parameter and the second auxiliary parameter.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.