Key generation method and device, storage medium, electronic device and computer program product

By jointly generating the target private key by multiple nodes on the blockchain, the risk of private key exposure caused by centralized single-point generation of keys is solved, and higher key security is achieved.

CN118972056BActive Publication Date: 2025-02-18JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411359851.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-02-18
Estimated Expiration
2044-09-27

AI Technical Summary

Technical Problem

The prior art relies on centralized single-point generation keys, resulting in the risk of private key exposure of the key.

Method used

The target private key is generated by multiple nodes on the blockchain, and the private key factor matrix of each node is determined, and a partial private key share is generated based on these matrices, and the target key is finally generated.

Benefits of technology

Generating keys in a distributed manner reduces the risk of private key exposure and improves the security of keys.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972056B_ABST
    Figure CN118972056B_ABST
Patent Text Reader

Abstract

The embodiments of the present application relate to the field of big data, and provide a method and device for generating a key, a storage medium, an electronic device, and a computer program product, wherein the method for generating a key includes: determining a first node set that is allowed to generate a target key, wherein the first node set is a node set on a blockchain, and the target key includes: a target private key; determining a private key factor matrix of each first node in the first node set; determining a partial private key share corresponding to each first node according to each private key factor matrix; and generating the target key according to the partial private key share. Through the above method, the problem that the generated key has the risk of private key exposure caused by relying on a centralized single point to generate a key in the related art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of big data, and specifically, to a method and device for generating a key, a storage medium, an electronic device, and a computer program product. Background Art

[0002] At present, key generation includes methods such as Public Key Infrastructure (PKI), Identity-Based Cryptography (IBC), and Combined Public Key (CPK). PKI is an authentication technology developed from public key theory that can transparently provide key and certificate management. PKI uses a trusted third-party CA as an endorsement to ensure the security of public keys. However, the PKI scheme is limited by the centralized single-point Certificate Authority (CA). The IBC system was proposed because the PKI mechanism cannot get rid of the cumbersome certificate system. Compared with traditional PKI, the IBC identity authentication scheme uses user identity information as the public key. The PKG of IBC is still a centralized organization. As the number of users increases, PKG faces greater pressure on operation and maintenance. CPK cannot resist collusion attacks, that is, it cannot resist attackers who unite to establish a linear equation system with private keys with sufficient data to attack the key.

[0003] Therefore, the problem that the related technology relies on a centralized single point to generate keys, resulting in the risk of private key exposure, has not yet been effectively solved. Summary of the invention

[0004] The embodiments of the present application provide a key generation method and device, a storage medium, an electronic device, and a computer program product to at least solve the problem in the related art that the key generation depends on a centralized single point, resulting in the risk of private key exposure.

[0005] According to one embodiment of the present application, a method for generating a key is provided, comprising: determining a first node set that is allowed to generate a target key, wherein the first node set is a node set on a blockchain, and the target key comprises: a target private key; determining a private key factor matrix of each first node in the first node set; determining a partial private key share corresponding to each first node according to each private key factor matrix; and generating the target key according to the partial private key share.

[0006] In an exemplary embodiment, determining a first node set that is allowed to generate a target key includes: receiving a negotiation request sent by a target object; determining the number of first nodes in the first node set to be generated according to the negotiation request; and determining random numbers of all nodes on the blockchain, wherein each node on the blockchain corresponds to a random number; sorting multiple random numbers from small to large, and determining the first node of the number of nodes in the blockchain in sequence according to the order of the multiple random numbers to generate the first node set.

[0007] In an exemplary embodiment, determining the private key factor matrix of each first node in the first node set includes: obtaining the elliptic curve cryptographic parameters corresponding to each first node; and determining the matrix size of the private key factor matrix to be determined for each first node according to a consensus algorithm; and generating the private key factor matrix of each first node according to the elliptic curve cryptographic parameters and the matrix size.

[0008] In an exemplary embodiment, a private key factor matrix of each first node is generated according to the elliptic curve cryptographic parameters and the matrix size, including: obtaining a large prime number of the elliptic curve corresponding to each first node from the elliptic curve cryptographic parameters corresponding to each first node; determining a plurality of private key factors corresponding to each first node according to the large prime number and each first node; and generating a private key factor matrix of each first node according to the plurality of private key factors corresponding to each first node and the matrix size.

[0009] In an exemplary embodiment, after determining the private key factor matrix of each first node in the first node set, the method further includes: determining multiple public key factors in each first node based on each private key factor in the private key factor matrix; and generating a public key factor matrix for each first node based on the multiple public key factors.

[0010] In an exemplary embodiment, determining multiple public key factors in each first node based on each private key factor in the private key factor matrix includes: obtaining a first base point of the elliptic curve corresponding to each elliptic curve cryptographic parameter; and determining the product of each private key factor corresponding to each first node and the first base point as the multiple public key factors corresponding to each first node.

[0011] In an exemplary embodiment, after generating the public key factor matrix of each first node according to the multiple public key factors, the method further includes: determining the partial public key share corresponding to each first node according to the public key factor matrix of each first node, wherein a target public key corresponding to the partial public key share corresponds to the target private key; and storing the partial public key share in the blockchain.

[0012] In an exemplary embodiment, after determining the private key factor matrix of each first node in the first node set, the method further includes: obtaining a random number corresponding to each first node; performing legitimacy verification on each random number; and when it is determined that each random number has passed the verification, determining the partial private key share corresponding to each first node according to each private key factor matrix.

[0013] In an exemplary embodiment, obtaining the random number corresponding to each first node includes: determining a first numerical value based on a node private key corresponding to each first node and a first base point corresponding to each first node; and determining the random number corresponding to each first node based on the first numerical value and a first hash function.

[0014] In an exemplary embodiment, performing legitimacy verification on each random number includes: determining a first verification integer and a second verification integer corresponding to each first node; determining whether the first verification integer and the second verification integer are consistent; if it is determined that the first verification integer is consistent with the second verification integer, determining that the random number corresponding to each first node passes the legitimacy verification; if it is determined that the first verification integer is inconsistent with the second verification integer, determining that the random number corresponding to each first node fails to pass the legitimacy verification.

[0015] In an exemplary embodiment, obtaining the first verification integer corresponding to each first node includes: obtaining a first hash value corresponding to a target block in the blockchain, and determining a temporary random number corresponding to each first node; mapping the first hash value to an elliptic curve corresponding to each first node according to a second hash function to generate a second base point of the elliptic curve corresponding to each first node; determining a second numerical value corresponding to each first node according to the temporary random number corresponding to each first node and the first base point, and determining a third numerical value corresponding to each first node according to the temporary random number corresponding to each first node and the second base point; determining the first verification integer corresponding to each first node according to a third hash function, the second numerical value, and the third numerical value.

[0016] In an exemplary embodiment, obtaining the second verification integer corresponding to each first node includes: mapping the first hash value to the elliptic curve corresponding to each first node according to a fourth hash function to generate a third base point of the elliptic curve corresponding to each first node; determining a fourth numerical value according to the first verification integer, the temporary random number and the node private key of each first node; determining a fifth numerical value according to the fourth numerical value, the first base point, the first verification integer and the node public key corresponding to each first node, and determining a sixth numerical value according to the fourth numerical value, the third base point, the first verification integer and the first numerical value; determining the second verification integer corresponding to each first node according to the fifth hash function, the fifth numerical value and the sixth numerical value.

[0017] In an exemplary embodiment, determining the partial private key share corresponding to each first node according to each private key factor matrix includes: determining the private key factor sequence corresponding to each first node in the private key factor matrix of each node; determining the weight factor corresponding to each first node according to each private key factor sequence and the random number corresponding to each first node; determining the partial private key share corresponding to each first node according to each private key factor sequence and each weight factor.

[0018] In an exemplary embodiment, determining a private key factor sequence corresponding to each first node in a private key factor matrix of each node includes: obtaining an identity identifier of a target object; determining a first number of private key factor matrix selection sequences based on the identity identifier, wherein the first number is consistent with the number of nodes in the first node set; selecting a second number of private key factors in each first node based on each private key factor matrix selection sequence; and determining a private key factor sequence corresponding to each first node based on the second number of private key factors in each first node.

[0019] In an exemplary embodiment, obtaining the identity of the target object includes: obtaining the identity attributes of the target object, wherein the identity attributes include at least one of the following: the identification card number of the target object, the date of birth of the target object; and performing identity mapping on the identity attributes according to a hash algorithm to generate the identity.

[0020] In an exemplary embodiment, determining the partial private key share corresponding to each first node according to each private key factor sequence and each weight factor includes: determining the weight factor corresponding to each first node by a target formula, wherein the target formula includes: , is the weight factor corresponding to the zth first node, is the private key factor sequence corresponding to the zth first node, is the random number corresponding to the zth first node.

[0021] In an exemplary embodiment, generating the target key according to the partial private key share includes: encrypting the partial private key share; sending the encrypted partial private key share to the target object, so that the target object generates the target key according to the encrypted partial private key share.

[0022] According to another embodiment of the present application, a key generation device is provided, including: a first determination module, used to determine a first node set allowed to generate a target key, wherein the first node set is a node set on a blockchain, and the target key includes: a target private key; a second determination module, used to determine a private key factor matrix of each first node in the first node set; a third determination module, used to determine a partial private key share corresponding to each first node according to each private key factor matrix; and a generation module, used to generate the target key according to the partial private key share.

[0023] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0024] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in the above method embodiment.

[0025] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiment are implemented.

[0026] Through the key generation method of the present application, determine the first node set in the blockchain that is allowed to generate the target private key; determine the private key factor matrix of each first node in the first node set; determine the partial private key share corresponding to each first node according to the private key factor matrix of each first node; generate the target key according to the partial private key share corresponding to each first node. In other words, the embodiment of the present application generates the target private key through multiple first nodes on the blockchain, rather than only generating the target private key through a centralized single point; and then generate a partial private key share according to the private key factor matrix corresponding to each first node to generate the target key. Through the embodiment of the present application, the problem of the risk of private key exposure caused by relying on a centralized single point to generate keys in the related art can be solved, and then the target key is generated by multiple first nodes, so that the generated target key is more secure and the risk of exposure of the generated target private key is reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a hardware structure block diagram of a computer terminal of a key generation method according to an embodiment of the present application;

[0028] Figure 2 is a flow chart of a method for generating a key according to an embodiment of the present application;

[0029] Figure 3 This is a structural diagram of a distributed key management system based on blockchain according to an optional embodiment of the present application;

[0030] Figure 4 is a flowchart of a distributed key management method based on blockchain according to an optional embodiment of the present application;

[0031] Figure 5 is a schematic diagram of a private key factor selection process according to an optional embodiment of the present application;

[0032] Figure 6 This is a schematic diagram of an identity identification and private key factor matrix selection sequence according to an optional embodiment of the present application;

[0033] Figure 7 It is a structural block diagram of a key generation device according to an embodiment of the present application. DETAILED DESCRIPTION

[0034] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0036] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal of a key generation method according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned computer terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0037] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for determining the interactive state in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above-mentioned key generation method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0038] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0039] Figure 2 is a flowchart of a method for generating a key according to an embodiment of the present application, which can be applied to Figure 1 In a computer terminal, such as Figure 2 As shown, the process includes the following steps:

[0040] Step S202, determining a first node set that is allowed to generate a target key, wherein the first node set is a node set on a blockchain, and the target key includes: a target private key;

[0041] Among them, the blockchain includes multiple nodes. The embodiment of the present application can select some nodes in the blockchain to participate in the process of generating the target private key, or can select all nodes in the blockchain to participate in the process of generating the blockchain.

[0042] The number of first nodes in the above first node set is greater than or equal to 2.

[0043] Step S204, determining a private key factor matrix of each first node in the first node set;

[0044] Step S206, determining the partial private key share corresponding to each first node according to each private key factor matrix;

[0045] Step S208: Generate the target key according to the partial private key share.

[0046] Through the key generation method of the present application, determine the first node set in the blockchain that is allowed to generate the target private key; determine the private key factor matrix of each first node in the first node set; determine the partial private key share corresponding to each first node according to the private key factor matrix of each first node; generate the target key according to the partial private key share corresponding to each first node. In other words, the embodiment of the present application generates the target private key through multiple first nodes on the blockchain, rather than only generating the target private key through a centralized single point; and then generate a partial private key share according to the private key factor matrix corresponding to each first node to generate the target key. Through the embodiment of the present application, the problem of the risk of private key exposure caused by relying on a centralized single point to generate keys in the related art can be solved, and then the target key is generated by multiple first nodes, so that the generated target key is more secure and the risk of exposure of the generated target private key is reduced.

[0047] Optionally, the determination of the first node set that allows the generation of the target key in the above step S202 includes: receiving a negotiation request sent by the target object; determining the number of first nodes in the first node set to be generated according to the negotiation request; and determining random numbers of all nodes on the blockchain, wherein each node on the blockchain corresponds to a random number; sorting multiple random numbers from small to large, and determining the first node of the number of nodes in the blockchain in sequence according to the order of the multiple random numbers to generate the first node set.

[0048] It is understandable that the target object can send a negotiation request to the blockchain, and the number of nodes in the first node set is determined by the negotiation request sent by the target object and the situation of the blockchain itself. For example: if the negotiation request is used to indicate that 10 nodes in the blockchain are requested to participate in the process of generating the target private key, but only 8 nodes in the blockchain have the ability to generate the target private key (some nodes may have been occupied by other tasks), then the number of nodes in the first node set in the blockchain needs to be renegotiated. For another example: if the negotiation request is used to indicate that 10 nodes in the blockchain are requested to participate in the process of generating the target private key, and there are more than 10 nodes in the blockchain that are all idle nodes and can participate in the process of generating the target private key, then it can be determined that the first node set includes: 10 nodes in the blockchain.

[0049] At this point, the random numbers of each node in the blockchain can be determined, and the random numbers can be sorted, and 10 random numbers can be selected from small to large. The nodes corresponding to these 10 random numbers are the first nodes in the first node set.

[0050] Optionally, the above-mentioned step S204 of determining the private key factor matrix of each first node in the first node set includes: obtaining the elliptic curve cryptographic parameters corresponding to each first node; and determining the matrix size of the private key factor matrix to be determined of each first node according to the consensus algorithm; and generating the private key factor matrix of each first node according to the elliptic curve cryptographic parameters and the matrix size.

[0051] It can be understood that the specific steps of generating the private key factor matrix of each first node are:

[0052] 1) Obtain the elliptic curve cryptographic parameters corresponding to each first node. That is, it is necessary to determine the parameters required for public key and private key exchange on the elliptic curve, such as the equation, base point, modulus, etc. of the elliptic curve.

[0053] 2) Determine the matrix size of the private key factor matrix to be determined for each first node according to the consensus algorithm. That is, determine the dimension and size of the private key factor matrix according to a specific consensus algorithm so as to generate and exchange private keys in the cryptographic protocol.

[0054] 3) Generate the private key factor matrix of each first node according to the elliptic curve cryptographic parameters and matrix size. That is, using the determined elliptic curve cryptographic parameters and matrix size, generate the private key factor matrix required by each first node to ensure a secure private key exchange and communication process.

[0055] Among them, generating the private key factor matrix of each first node according to the elliptic curve cryptographic parameters and the matrix size includes: obtaining the large prime number of the elliptic curve corresponding to each first node in the elliptic curve cryptographic parameters corresponding to each first node; determining a plurality of private key factors corresponding to each first node according to the large prime number and each first node; and generating the private key factor matrix of each first node according to the plurality of private key factors corresponding to each first node and the matrix size.

[0056] It is understandable that a large prime number can be obtained according to the elliptic curve cryptographic parameters corresponding to each first node, and multiple private key factors corresponding to each first node can be determined based on this, and then a private key factor matrix can be generated according to the private key factors corresponding to each first node and the matrix size. This can effectively improve the security and performance of the cryptographic system, and can also better manage and maintain the private key factors to ensure the reliability and stability of the system.

[0057] After determining the private key factor matrix of each first node in the first node set, multiple public key factor matrices may be generated, specifically:

[0058] (1) determining a plurality of public key factors in each first node according to each private key factor in the private key factor matrix, including:

[0059] Obtain a first base point of the elliptic curve corresponding to each elliptic curve cryptographic parameter; and determine the product of each private key factor corresponding to each first node and the first base point as a plurality of public key factors corresponding to each first node.

[0060] (2) Generating a public key factor matrix of each first node according to the multiple public key factors.

[0061] Optionally, after generating the public key factor matrix, the partial public key share corresponding to each first node can also be determined, including: determining the partial public key share corresponding to each first node based on the public key factor matrix of each first node, wherein the target public key corresponding to the partial public key share corresponds to the target private key; and storing the partial public key share in the blockchain.

[0062] It is understandable that, while generating a partial private key share, a partial public key share can also be generated, and further, the partial public key share can be stored in the blockchain. When information needs to be encrypted, the partial public key share can be obtained in the blockchain, and the information can be encrypted according to the public key corresponding to the partial public key share, wherein the generated private key can decrypt the encrypted information. The blockchain is a decentralized distributed database in which the data is encrypted and linked together to form an unalterable data structure. Once the public key share is stored on the blockchain, any tampering with the data will be immediately detected and cannot be modified, ensuring the security and integrity of the data.

[0063] Optionally, after determining the private key factor matrix of each first node in the first node set in the above step S204, the method also includes: obtaining a random number corresponding to each first node; performing legitimacy verification on each random number; and when it is determined that each random number has passed the verification, determining the partial private key share corresponding to each first node according to each private key factor matrix.

[0064] Among them, obtaining the random number corresponding to each first node includes: determining a first numerical value based on a node private key corresponding to each first node and a first base point corresponding to each first node; and determining the random number corresponding to each first node based on the first numerical value and a first hash function.

[0065] The random number can be determined by the elliptic curve parameters, and the first base point can be found in the elliptic curve corresponding to the elliptic curve parameters, and the random number of the first node can be determined according to the first base point. The random number is generated by the above scheme, and then the random number is used to generate the subsequent private key, which can enhance the security of the cryptographic system corresponding to the target key.

[0066] Among them, the legitimacy verification of each random number includes: determining a first verification integer and a second verification integer corresponding to each first node; determining whether the first verification integer and the second verification integer are consistent; when it is determined that the first verification integer is consistent with the second verification integer, determining that the random number corresponding to each first node passes the legitimacy verification; when it is determined that the first verification integer is inconsistent with the second verification integer, determining that the random number corresponding to each first node fails to pass the legitimacy verification.

[0067] Among them, obtaining the first verification integer corresponding to each first node includes: obtaining the first hash value corresponding to the target block in the blockchain, and determining the temporary random number corresponding to each first node; mapping the first hash value to the elliptic curve corresponding to each first node according to the second hash function to generate the second base point of the elliptic curve corresponding to each first node; determining the second numerical value corresponding to each first node according to the temporary random number corresponding to each first node and the first base point, and determining the third numerical value corresponding to each first node according to the temporary random number corresponding to each first node and the second base point; determining the first verification integer corresponding to each first node according to the third hash function, the second numerical value and the third numerical value.

[0068] Among them, obtaining the second verification integer corresponding to each first node includes: mapping the first hash value to the elliptic curve corresponding to each first node according to a fourth hash function to generate a third base point of the elliptic curve corresponding to each first node; determining a fourth numerical value according to the first verification integer, the temporary random number and the node private key of each first node; determining a fifth numerical value according to the fourth numerical value, the first base point, the first verification integer and the node public key corresponding to each first node, and determining a sixth numerical value according to the fourth numerical value, the third base point, the first verification integer and the first numerical value; determining the second verification integer corresponding to each first node according to the fifth hash function, the fifth numerical value and the sixth numerical value.

[0069] It is understandable that the random number in each first node needs to be verified for legality. If the random number is determined to be legal, it can be determined that the first node is a node in the first node set. If the random number is determined to be illegal, the first node needs to be removed from the first node set and it is determined whether a new node needs to be selected in the blockchain to replace the first node. Specifically:

[0070] (1) Obtain a verifiable random number (i.e., the random number of this application) and a verifiable random number certificate.

[0071] 1) Take the hash value (i.e., the first hash value) of the last block (i.e., the target block) of the blockchain as the input random number, and obtain the input value: the node private key corresponding to each first node.

[0072] 2) Select a temporary random number;

[0073] 3) Use the second hash function (which may be Hash1) to map the first hash value to the elliptic curve to obtain the second base point of the elliptic curve;

[0074] 4) Calculate the product of the temporary random number and the first base point to obtain a second value; and calculate the product of the temporary random number and the second base point to obtain a third value;

[0075] 5) Use a third hash function (which may be Hash2) to map the second value and the third value into an integer, namely, the first verification integer;

[0076] 6) determining a fourth value according to the temporary random number, the first verification integer, and the node private key of each first node;

[0077] 7) Determine a first value according to the first base point of the node private key of each first node;

[0078] 8) Use the first hash function (which can be Hash3) and the first value to determine a random number (also called a verifiable random number), and combine the first value, the fourth value, and the first verification integer to form a verifiable random number certificate. That is, output a random number and a verifiable random number certificate.

[0079] (2) Verify the verifiable random number.

[0080] 1) Input the first hash value and the verifiable random number proof;

[0081] 2) Use a fourth hash function (which may be the same as the second hash function, both are Hash1) to map the first hash value to the elliptic curve to generate a third base point;

[0082] 3) determining a fifth value based on the fourth value, the first base point, the first verification integer, and the node public key corresponding to each first node, and determining a sixth value based on the fourth value, the third base point, the first verification integer, and the first value;

[0083] 4) Calculate a second verification integer according to a fifth Hash function (which may be consistent with the third Hash function, both are Hash2), the fifth value, and the sixth value;

[0084] 5) Determine whether the first verification integer and the second verification integer are equal;

[0085] If they are equal, the random number is determined to be valid and the verification is passed; if they are not equal, the random number is determined to be invalid and the verification is failed. That is, the verification result of the random number is output.

[0086] Optionally, the above-mentioned step S206 of determining the partial private key share corresponding to each first node according to each private key factor matrix includes: determining the private key factor sequence corresponding to each first node in the private key factor matrix of each node; determining the weight factor corresponding to each first node according to each private key factor sequence and the random number corresponding to each first node; and determining the partial private key share corresponding to each first node according to each private key factor sequence and each weight factor.

[0087] It is understandable that after determining the private key factor sequence, the weight factor corresponding to each first node can be determined based on the private key factor sequence and the random number, and then the partial private key share corresponding to each first node can be determined based on the weight factor and the private key factor sequence set. In other words, after obtaining the private key factor matrix and random number of each first node, the partial private key share of each first node can be determined. Through the combination of the private key factor matrix and the random number, the partial private key share of each first node can be determined without directly exposing the entire private key. This method can effectively reduce the risk of private key leakage and enhance the security of the private key.

[0088] Wherein, determining the private key factor sequence corresponding to each first node in the private key factor matrix of each node includes: obtaining the identity of the target object; determining a first number of private key factor matrix selection sequences according to the identity, wherein the first number is consistent with the number of nodes in the first node set; selecting a second number of private key factors in each first node according to each private key factor matrix selection sequence; and determining the private key factor sequence corresponding to each first node according to the second number of private key factors in each first node.

[0089] It is understandable that multiple private key factor matrix selection sequences can be determined by the identity identifier of the target object, and a certain number of private key factors for generating private keys can be selected in the private key factor matrix corresponding to each first node according to the multiple private key factor matrix selection sequences. That is, not all private key factors in the private key factor matrix are used to generate private keys, but a part of them can be selected to generate private keys. This improves the security of the generated private key.

[0090] Among them, obtaining the identity of the target object includes: obtaining the identity attributes of the target object, wherein the identity attributes include at least one of the following: the identification number of the target object, the date of birth of the target object; performing identity mapping on the identity attributes according to a hash algorithm to generate the identity.

[0091] It is understandable that the identity of the target object can be determined based on the identity attributes of the target object. The identity attributes can be the identity card number of the target object, the mobile phone number of the target object, and other related attributes that can prove the identity of the target object. Then, the identity of the target object can be determined by the hash algorithm based on the identity attributes. The irreversibility and uniqueness of the hash algorithm make the generated identity identifier highly secure and accurate.

[0092] Optionally, the step S206 of determining the partial private key share corresponding to each first node according to each private key factor sequence and each weight factor includes: determining the weight factor corresponding to each first node by a target formula, wherein the target formula includes: , is the weight factor corresponding to the zth first node, is the private key factor sequence corresponding to the zth first node, is the random number corresponding to the zth first node.

[0093] It is understandable that the weight factor corresponding to the first node can be generated by the above target formula, which includes: the private key factor sequence corresponding to each first node, and the random number corresponding to each first node. That is, the weight factor corresponding to each node can be determined by the private key factor matrix corresponding to each node and the random number corresponding to each node.

[0094] Through the embodiments of the present application, it can be ensured that the weight factor of each first node is uniquely determined and can only be calculated through the private key factor matrix and random numbers, thereby ensuring that the weight factor of the first node is safe and reliable.

[0095] Optionally, the above-mentioned step S208 of generating the target key according to the partial private key share includes: encrypting the partial private key share; sending the encrypted partial private key share to the target object, so that the target object generates the target key according to the encrypted partial private key share.

[0096] It is understandable that after encrypting part of the private key share and sending it to the target object, the target object can generate the target key based on the encrypted part of the private key share. That is, the target object can generate the target key based on the encrypted private key share without waiting for confirmation from other participants or centralized institutions, which improves the flexibility and convenience of key generation.

[0097] In order to better understand the process of the above-mentioned key generation method, the implementation process of the above-mentioned key generation method is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.

[0098] In order to ensure the security of data transmission, data storage, user access, business operations, etc., cryptographic technology plays an increasingly important role. The key management system (KMS) related to cryptographic technology is the basis for ensuring information security, providing services such as secure key custody and cryptographic operations. The key is the core of the entire key management system. Once the key is leaked or the key management system collapses, the entire business system will be threatened.

[0099] At present, key generation includes PKI, IBC, CPK and other methods. PKI is an authentication technology developed from public key theory, which can provide key and certificate management transparently. PKI uses a trusted third-party CA as an endorsement to ensure the security of the public key. However, this scheme is still limited by the centralized single-point certificate authority (CA). The IBC system is proposed because the PKI mechanism cannot get rid of the cumbersome certificate system. Compared with traditional PKI, the IBC identity authentication scheme uses user identity information as the public key. Then, IBC generates a private key through a private key generator (PKG). IBC's PKG is still a centralized organization. With the increase in the number of users, PKG faces greater pressure on operation and maintenance.

[0100] CPK, or combined public key cryptography, is an authentication algorithm based on identity. By introducing the public key factor matrix and the private key factor matrix, and using the elliptic curve cryptography algorithm, a large number of key factor pairs are generated based on the elliptic curve base point. The key factors can be combined into a new key pair through linear combination in its cyclic group. Then, a mapping relationship between the key and the user identity is established, so that the system can perform verification immediately without any external support (such as a trusted third party).

[0101] In view of the problem that the generated keys in the related technologies rely on a centralized single point to generate keys, resulting in the risk of private key exposure, the optional embodiment of the present application provides a distributed key generation and management method based on blockchain, which mainly uses blockchain technology and Trusted Execution Environment (TEE) and other related technologies, wherein:

[0102] (1) With the rapid development of blockchain technology, its distributed consensus feature provides a new solution for centralized key management. Blockchain is a structure based on distributed ledgers, which adopts the concept of decentralization and relies on consensus mechanism to achieve consistency among multiple nodes. The distributed, tamper-proof and traceable features of blockchain enable it to tolerate the existence of some faulty nodes, becoming the key to solving the defects of centralized key management.

[0103] (2) Trusted Execution Environment: A secure area is built in the CPU through software and hardware methods to ensure that the programs and data loaded inside are protected in terms of confidentiality and integrity.

[0104] In other words, in order to address the defects of current key generation such as PKI, IBC, and CPK, avoid the reliance of key management systems on centralized single points, and improve the security of key management, an optional embodiment of the present application proposes a distributed key generation and management method based on blockchain. The optional embodiment of the present application introduces blockchain and a trusted execution environment into the key management system, and uses CPK technology to generate corresponding private key factor matrices and public key factor matrices in the trusted execution environment of each blockchain node. Then, the user selects a limited number of nodes in the blockchain network as nodes for generating private keys through identity identification. Based on these blockchain nodes, the final public and private keys are constructed by weighting.

[0105] By introducing blockchain, the traditional key management system is transformed from centralized to distributed, and each blockchain node only has partial key generation authority. At the same time, since the generation of keys depends on multiple peer nodes in the blockchain, key management has stronger security features and can effectively improve the security strength of keys.

[0106] At the same time, the combined characteristics of the combined public key and the decentralized characteristics of the blockchain enable the key management system to generate a large number of random key pairs of comparable strength in a short period of time. The optional embodiment of the present application allows each blockchain node to generate its own different key factor matrix based on the same set of elliptic curve parameters, and ultimately allows the user to randomly select a limited number of private key factor matrices and public key factor matrices to generate public and private keys. Specifically:

[0107] Figure 3 is a block chain-based distributed key management system structure diagram according to an optional embodiment of the present application, such as Figure 3 As shown:

[0108] The distributed key management system based on blockchain of an optional embodiment of the present application includes: an identification generation module on the user side and a blockchain network.

[0109] Among them, the blockchain network consists of many blockchain nodes (i.e. Figure 3The key management module manages the operation of the entire key management system, responds to requests from users, manages key generation, update, destruction and other services, and is responsible for uploading information such as the public key factor matrix and user identity to the public database.

[0110] The user first inputs his or her identity information (i.e., various identity attributes) into the identification generation module, and uses the hash function (Hash4) of the identification generation module to perform identity mapping to obtain the identity identification, and then calls the private key generation function to map out a k-number of private key factor matrix selection sequences. K represents the use of k nodes specified in the blockchain network to generate the final private key together, which is negotiated and set by the user and the blockchain network.

[0111] In the distributed key management system based on blockchain in the optional embodiment of the present application, the key management module generates elliptic curve cryptographic parameters, and the elliptic curve cryptographic parameters are chained through the blockchain consensus algorithm to ensure that the elliptic curve cryptographic parameters are open, transparent and cannot be tampered with. The key matrix generation module generates a corresponding fixed number of public and private key factors according to the elliptic curve cryptographic parameters set in advance, and then forms the corresponding private key factor matrix and public key factor matrix. The private key factor matrix generated by each node is different and has randomness. Even if the private key factor matrix of a certain node is obtained, the private key factor matrix of other nodes cannot be derived through the elliptic curve cryptographic parameters. At the same time, each blockchain node has the same elliptic curve base point G. The public and private key factor matrices of each node have a one-to-one correspondence. According to the sequence selected for each private key factor matrix, the partial private key generation module generates the corresponding partial private key initial share through the elliptic curve summation operation. Among them, weights are set for k blockchain nodes, and their weights are applied to the partial private key initial share to form a partial private key share. Then the k weighted partial private key shares are encrypted and forwarded to the user through the key management module, and the user constructs the final private key by himself. At the same time, the blockchain network key management module calls the consensus algorithm to record the public key factor matrix and corresponding weight factors of each blockchain node to construct the corresponding public key.

[0112] Figure 4 is a flowchart of a distributed key management method based on blockchain according to an optional embodiment of the present application, which is applied to Figure 3 In the system, such as Figure 4 As shown:

[0113] Among them, step S401 to step S403 are preparation steps:

[0114] Step S401, obtaining an identity.

[0115] The user (i.e., the target object of this application) first inputs his / her identity information (various identity attributes) into the identification generation module, and performs identity mapping through the hash function (Hash4) of the identification generation module to obtain an identity identifier (HID (hash identifier) ​​= Hash4 (identity information)).

[0116] Step S402, determining the number of nodes participating in private key generation.

[0117] The user determines the number of nodes required for private key generation (i.e., the number of first nodes in the first node set in this application). For example, the user decides that the private key factor matrices of k blockchain nodes are required to participate in this private key generation. The number of nodes k and the negotiation request are sent to the blockchain. At the same time, the key management module of the blockchain determines the size of the private key factor matrix of each blockchain node (i.e., the matrix size of this application) through a consensus algorithm (e.g., the dimension of the matrix is ​​set to 32*32).

[0118] Step S403, setting elliptic curve cryptography parameters.

[0119] The key management module on each blockchain node generates elliptic curve cryptographic parameters, including p, q, E, and G, where p and q are large prime numbers and E is defined in the finite field F. p G is the base point of order q on the elliptic curve E. The key management module sends the elliptic curve cryptographic parameters and the size of the private key factor matrix to the key matrix generation module.

[0120] Step S404: Generate a private key factor matrix and a public key factor matrix.

[0121] Each blockchain node calls the key matrix generation module to generate a 32*32 size private key factor matrix and a public key factor matrix. Including:

[0122] 1) Set the public parameters on the elliptic curve, including p, q, E and G, where p and q are large prime numbers and E is defined in the finite field F. p G is the base point of order q on the elliptic curve E.

[0123] 2) The private key factor is set to ,in , , m represents the mth blockchain node. Represents the private key factor of the i-th row and j-th column in the private key factor matrix generated by the m-th blockchain node.

[0124] 3) The public key factor is .

[0125] 4) Return , .

[0126] 5) Figure 5 is a schematic diagram of a private key factor selection process according to an optional embodiment of the present application, such as Figure 5 As shown, SSK m Represents the private key factor matrix generated by the mth blockchain node, PPK m Represents the public key factor matrix generated by the mth blockchain node. SSK is generated through the hash function (Hash4) m and the public key factor matrix PPK m The private key factor matrix SSK of the mth blockchain node on the blockchain m and the public key factor matrix PPK m They are:

[0127] ; .

[0128] Among them, each private key factor in each private key factor matrix is ​​random, and each private key factor matrix is ​​different. The private key factor matrix of each blockchain node is always in a trusted execution environment built on confidential computing, and after generation, it is only used by some private key generation modules.

[0129] In order to determine which nodes in the blockchain participate in the generation of the user's private key, it is necessary to use a verifiable random number method to determine the k nodes in the blockchain that participate in the private key generation. The key management module of each blockchain node can obtain a unique random number using a verifiable random number, and select the k nodes with the smallest random number as the nodes participating in the private key generation this time. Specifically:

[0130] Step S405, the blockchain node generates a verifiable random number.

[0131] 1) Input: The hash value of the last block of the blockchain is used as the input random number, and the private key corresponding to each blockchain node .

[0132] 2) Output: random number and proof .

[0133] 3) Select a random number (where r is equivalent to the temporary random number of this application).

[0134] 4) Use hash functions (i.e. the second hash function of this application) maps the hash value of the last block (i.e. the first hash value of this application) to a point on the elliptic curve (equivalent to the second basis point of this application), the calculation formula is: , at this time G1 is also a base point of the elliptic curve.

[0135] 5) Calculation (equivalent to the second numerical value of this application); (equivalent to the third numerical value of this application).

[0136] 6) Use hash functions (i.e., the third hash function of this application) maps the input into an integer s (i.e., the first verification integer of this application), and the calculation formula is: .

[0137] 7) Calculation (t is the fourth numerical value of this application).

[0138] 8) Calculation (V is a point on the elliptic curve, i.e., the first value of this application).

[0139] 9) Use hash functions (i.e., the first hash function of this application) maps a point on the elliptic curve to an integer to obtain a random number or , proved to be .

[0140] 10) Return and .

[0141] In summary, the verifiable random number is generated based on the hash value of the last block, so the size of the verifiable random number of each blockchain node in different blocks is different. This ensures that each blockchain node has the opportunity to participate in the generation of the user's private key, ensures the randomness of the user's private key generation, and improves the security of the key generation process.

[0142] The key management module will be the elliptic curve public parameters, the number of blockchain nodes involved in the private key generation k, and the verifiable random number and proof , all public key factor matrices are recorded on the blockchain through the blockchain consensus algorithm.

[0143] The user receives the dimension of the private key factor matrix (32*32) sent by the key management module, and the random number that can be verified by k blockchain nodes and proof First, the user verifies that k blockchain nodes can verify the random number and proof , to ensure the legitimacy of the verifiable random numbers of the k blockchain nodes involved in the generation of this private key. Specifically:

[0144] Step S406, verify the legitimacy of the verifiable random number of the node participating in the private key generation.

[0145] 1) Input: hash value of the last block in the blockchain, proof .

[0146] 2) Output: Legality.

[0147] 3) Use hash functions (i.e. the fourth hash function of this application) maps the hash value of the last block to a point on the elliptic curve (i.e. the third basis point of this application), calculate .

[0148] 4) Calculation . (ie the fifth value of this application)

[0149] 5) Calculation . (i.e. the sixth value of this application)

[0150] 6) Calculation . (i.e. the second verification integer of this application)

[0151] 7) Determine whether s is equal to .

[0152] If s is equal to , then execute step S407.

[0153] If s is not equal to , then the process ends.

[0154] Step S407, calculating a private key factor matrix selection sequence.

[0155] Since the dimension of the private key factor matrix of each blockchain node is 32*32, the user needs to select 32*5=160 bits from the identity obtained in step S401 to calculate the private key factor matrix selection sequence. Figure 6 is a schematic diagram of an identity identification and private key factor matrix selection sequence according to an optional embodiment of the present application, such as Figure 6 As shown in the figure, 5 binary bits can represent 0-32, and a private key factor can be selected from a row in the private key factor matrix. Since the private key factor matrix has 32 rows, 32*5=160 bits are required.

[0156] Since it is necessary to use the private key factor matrices of k blockchain nodes to construct the user's private key, the optional embodiment of the present application adopts a window sliding method to select k private key factor matrix selection sequences. The specific implementation process includes: the user calls the private key factor matrix selection sequence FID of the identification generation module z=f(z, HID) algorithm, each time sliding back one bit from the identity identifier to generate k private key factor matrices to select the sequence FID1, FID2, ..., FID k (i.e. the private key factor sequence of this application).

[0157] Step S408, determining the weight factors corresponding to the nodes participating in the generation of the private key.

[0158] The user selects the k private key factor matrices in the sequence FID1, FID2, ..., FID z , ..., FID k Send it to the blockchain. At the same time, the k nodes on the blockchain that participate in the private key calculation use the partial key generation module to generate their own weight factors:

[0159] ;

[0160] in, Represents the random number of the zth node among the k nodes participating in the private key calculation. This random number is always stored in the trusted execution environment.

[0161] Step S409, calculate partial private key shares and partial public key shares.

[0162] FID z Split and combine, FID z =(fid z,1 , fid z,2 ,……,fid z,32 ). At this time, the partial key generation modules of the k nodes participating in the private key calculation each use the weight factor and the private key factor matrix and the public key factor matrix to generate the corresponding partial private key share and partial public key share:

[0163] (partial private key share); (Partial public key share).

[0164] Step S410, calculating the final public key and private key.

[0165] The partial key generation modules of the k nodes participating in the private key calculation will encrypt their respective partial private key shares. Then the k weighted partial private key shares are forwarded to the user through the key management module, and the user constructs the final private key sk by himself: .

[0166] The partial key generation modules of the k nodes participating in the private key calculation publish their partial public key shares to their respective key management modules. At the same time, their respective key management modules upload their partial public key shares to the blockchain. When the public key needs to be used, the k partial public key shares can be queried from the blockchain and the public key pk can be calculated:

[0167] Through the optional embodiment of the present application, the trusted execution environment is introduced into the key management system, the key matrix generation module and the partial key generation module are placed in the trusted execution environment based on the confidential computing technology, the private key factor is always in the trusted execution environment, and the security of the private key is guaranteed; each blockchain node is allowed to generate different key factor matrices based on the same set of elliptic curve parameters, so the key matrix generated by the key matrix generation module of each blockchain node is different and random. Based on the verifiable random number technology, a limited number of blockchain nodes on the blockchain are selected to participate in the generation of private keys, avoiding the dependence of the key management system on a centralized single point, improving the security of key management, and combining the combination characteristics of the public key with the decentralized characteristics of the blockchain, so that the key management system can generate a large number of random key pairs with comparable strength in a short time. The limited number of blockchain nodes participating in the generation of private keys is not a simple addition of points on the elliptic curve, but a weighted summation. In this way, the contribution of each blockchain node participating in the private key calculation to the private key is not average. At the same time, the generation of weights is related to the user identity and the verifiable random number based on the hash of the current block, ensuring that the weights of different blocks and different users are random, and improving the security strength of key generation. The user generates the user's identity through the Hash function. At the same time, based on the identity, the sliding window technology is used to generate a private key factor matrix selection sequence for different blockchain nodes.

[0168] That is, the optional embodiments of the present application can be based on blockchain technology to avoid the key management system's reliance on centralization, improve system reliability, and reduce operating costs; utilize trusted execution environment technology to improve the security of each private key factor matrix on the blockchain, which can effectively prevent leakage; utilize verifiable random number technology to effectively select a limited number of blockchain nodes to participate in the generation of the final private key, which can improve system efficiency and reduce system access pressure; the combined characteristics of the public key combined with the decentralized characteristics of the blockchain enable the key management system to generate a large number of random key pairs of comparable strength in a short period of time; weight-based technology allows blockchain nodes participating in private key generation to have different contributions to the private key, thereby improving the security of the private key; the leakage of the private key factor matrix of a single blockchain node does not lead to the risk of leakage of the user's private key.

[0169] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0170] In the present embodiment, a key generation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0171] Figure 7 is a structural block diagram of a key generation device according to an embodiment of the present application, such as Figure 7 As shown, the device comprises:

[0172] A first determination module 72 is used to determine a first node set that is allowed to generate a target key, wherein the first node set is a node set on the blockchain, and the target key includes: a target private key;

[0173] Among them, the blockchain includes multiple nodes. The embodiment of the present application can select some nodes in the blockchain to participate in the process of generating the target private key, or can select all nodes in the blockchain to participate in the process of generating the blockchain.

[0174] The number of first nodes in the above first node set is greater than or equal to 2.

[0175] A second determination module 74, configured to determine a private key factor matrix of each first node in the first node set;

[0176] A third determination module 76, configured to determine the partial private key share corresponding to each first node according to each private key factor matrix;

[0177] The generating module 78 is used to generate the target key according to the partial private key share.

[0178] Through the key generation device of the present application, determine the first node set in the blockchain that is allowed to generate the target private key; determine the private key factor matrix of each first node in the first node set; determine the partial private key share corresponding to each first node according to the private key factor matrix of each first node; generate the target key according to the partial private key share corresponding to each first node. In other words, the embodiment of the present application generates the target private key through multiple first nodes on the blockchain, rather than only generating the target private key through a centralized single point; and then generate a partial private key share according to the private key factor matrix corresponding to each first node to generate the target key. Through the embodiment of the present application, the problem of the risk of private key exposure caused by relying on a centralized single point to generate keys in the related art can be solved, and then the target key is generated by multiple first nodes, so that the generated target key is more secure and the risk of exposure of the generated target private key is reduced.

[0179] In an exemplary embodiment, the first determination module 72 is further used to receive a negotiation request sent by a target object; determine a plurality of first nodes from all nodes on the blockchain according to the negotiation request; and determine the first node set according to the plurality of first nodes.

[0180] It is understandable that the target object can send a negotiation request to the blockchain, and multiple first nodes are determined by the negotiation request sent by the target object and the situation of the blockchain itself. For example: if the negotiation request is used to indicate that nodes 1 and 2 in the blockchain are requested to participate in the process of generating the target private key, but node 1 in the blockchain does not have the ability to generate the target private key (node ​​1 may have been occupied by other tasks), then it is necessary to renegotiate the first node in the first node set in the blockchain. For another example: if the negotiation request is used to indicate that nodes 3, 4, and 5 in the blockchain are requested to participate in the process of generating the target private key, and nodes 3, 4, and 5 in the blockchain are all idle nodes and can participate in the process of generating the target private key, then it can be determined that the first node set includes: node 3, node 4, and node 5.

[0181] In an exemplary embodiment, the second determination module 74 is further used to obtain the elliptic curve cryptographic parameters corresponding to each of the first nodes; and determine the matrix size of the private key factor matrix to be determined for each of the first nodes according to the consensus algorithm; and generate the private key factor matrix of each of the first nodes according to the elliptic curve cryptographic parameters and the matrix size.

[0182] It can be understood that the specific steps of generating the private key factor matrix of each first node are:

[0183] 1) Obtain the elliptic curve cryptographic parameters corresponding to each first node. That is, it is necessary to determine the parameters required for public key and private key exchange on the elliptic curve, such as the equation, base point, modulus, etc. of the elliptic curve.

[0184] 2) Determine the matrix size of the private key factor matrix to be determined for each first node according to the consensus algorithm. That is, determine the dimension and size of the private key factor matrix according to a specific consensus algorithm so as to generate and exchange private keys in the cryptographic protocol.

[0185] 3) Generate the private key factor matrix of each first node according to the elliptic curve cryptographic parameters and matrix size. That is, using the determined elliptic curve cryptographic parameters and matrix size, generate the private key factor matrix required by each first node to ensure a secure private key exchange and communication process.

[0186] In an exemplary embodiment, the second determination module 74 is further used to obtain a large prime number of the elliptic curve corresponding to each first node from the elliptic curve cryptographic parameters corresponding to each first node; determine a plurality of private key factors corresponding to each first node based on the large prime number and each first node; and generate a private key factor matrix for each first node based on the plurality of private key factors corresponding to each first node and the matrix size.

[0187] It is understandable that a large prime number can be obtained according to the elliptic curve cryptographic parameters corresponding to each first node, and multiple private key factors corresponding to each first node can be determined based on this, and then a private key factor matrix can be generated according to the private key factors corresponding to each first node and the matrix size. This can effectively improve the security and performance of the cryptographic system, and can also better manage and maintain the private key factors to ensure the reliability and stability of the system.

[0188] In an exemplary embodiment, the second determination module 74 is further configured to determine a plurality of public key factors in each first node according to each private key factor in the private key factor matrix; and generate a public key factor matrix of each first node according to the plurality of public key factors.

[0189] In an exemplary embodiment, the second determination module 74 is further used to obtain the first base point of the elliptic curve corresponding to each elliptic curve cryptographic parameter; and determine the product of each private key factor corresponding to each first node and the first base point as multiple public key factors corresponding to each first node.

[0190] In an exemplary embodiment, the second determination module 74 is further used to determine the partial public key share corresponding to each first node based on the public key factor matrix of each first node, wherein a target public key corresponding to the partial public key share corresponds to the target private key; and store the partial public key share in the blockchain.

[0191] It is understandable that, while generating a partial private key share, a partial public key share can also be generated, and further, the partial public key share can be stored in the blockchain. When information needs to be encrypted, the partial public key share can be obtained in the blockchain, and the information can be encrypted according to the public key corresponding to the partial public key share, wherein the generated private key can decrypt the encrypted information. The blockchain is a decentralized distributed database in which the data is encrypted and linked together to form an unalterable data structure. Once the public key share is stored on the blockchain, any tampering with the data will be immediately detected and cannot be modified, ensuring the security and integrity of the data.

[0192] In an exemplary embodiment, the second determination module 74 is further used to obtain a random number corresponding to each of the first nodes; perform legitimacy verification on each random number; and when it is determined that each of the random numbers has passed the verification, determine a partial private key share corresponding to each of the first nodes according to each private key factor matrix.

[0193] In an exemplary embodiment, the second determination module 74 is further used to obtain a hash value corresponding to the target block in the blockchain; map the hash value to the elliptic curve corresponding to each first node according to a hash function to generate a second base point of the elliptic curve corresponding to each first node; and determine a random number corresponding to each first node according to the second base point.

[0194] The random number can be determined by the elliptic curve parameters, and the second base point can be found in the elliptic curve corresponding to the elliptic curve parameters. This second base point can be used as the random number of the first node. The random number is generated by the above scheme, and then the random number is used to generate the subsequent private key, which can enhance the security of the cryptographic system corresponding to the target key.

[0195] In an exemplary embodiment, the second determination module 74 is further used to obtain the elliptic curve cryptographic parameters corresponding to each first node; obtain the first base point of the elliptic curve corresponding to each elliptic curve cryptographic parameter; determine the random number range corresponding to each first node based on the first base point and the second base point; and verify the legitimacy of each random number corresponding to each first node based on the random number range.

[0196] In an exemplary embodiment, the second determination module 74 is further used to determine whether each of the random numbers is within the random number range; when it is determined that each of the random numbers is within the random number range, determine whether there is a second random number consistent with the first random number among the multiple random numbers, wherein the first random number is any random number among the multiple random numbers; when it is determined that the second random number does not exist among the multiple random numbers, determine that each of the random numbers has passed the verification.

[0197] It is understandable that the legitimacy of the random number in each first node needs to be verified. Only when it is determined that the random number is legal can it be determined that the first node is a node in the first node set. When it is determined that the random number is illegal, the first node needs to be removed from the first node set, and it is determined whether a new node needs to be selected in the blockchain to replace the first node.

[0198] In an exemplary embodiment, the third determination module 76 is also used to determine the private key factor sequence corresponding to each first node in the private key factor matrix of each node; determine the weight factor corresponding to each first node based on each private key factor sequence and the random number corresponding to each first node; determine the partial private key share corresponding to each first node based on each private key factor sequence and each weight factor.

[0199] It is understandable that after determining the private key factor sequence, the weight factor corresponding to each first node can be determined based on the private key factor sequence and the random number, and then the partial private key share corresponding to each first node can be determined based on the weight factor and the private key factor sequence set. In other words, after obtaining the private key factor matrix and random number of each first node, the partial private key share of each first node can be determined. Through the combination of the private key factor matrix and the random number, the partial private key share of each first node can be determined without directly exposing the entire private key. This method can effectively reduce the risk of private key leakage and enhance the security of the private key.

[0200] In an exemplary embodiment, the third determination module 76 is also used to obtain an identity identifier of the target object; determine a first number of private key factor matrix selection sequences based on the identity identifier, wherein the first number is consistent with the number of nodes in the first node set; select a second number of private key factors in each first node based on each private key factor matrix selection sequence; and determine a private key factor sequence corresponding to each first node based on the second number of private key factors in each first node.

[0201] It is understandable that multiple private key factor matrix selection sequences can be determined by the identity identifier of the target object, and a certain number of private key factors for generating private keys can be selected in the private key factor matrix corresponding to each first node according to the multiple private key factor matrix selection sequences. That is, not all private key factors in the private key factor matrix are used to generate private keys, but a part of them can be selected to generate private keys. This improves the security of the generated private key.

[0202] In an exemplary embodiment, the third determination module 76 is also used to obtain the identity attributes of the target object, wherein the identity attributes include at least one of the following: the identification number of the target object, the date of birth of the target object; and perform identity mapping on the identity attributes according to a hash algorithm to generate the identity identifier.

[0203] It is understandable that the identity of the target object can be determined based on the identity attributes of the target object. The identity attributes can be the identity card number of the target object, the mobile phone number of the target object, and other related attributes that can prove the identity of the target object. Then, the identity of the target object can be determined by the hash algorithm based on the identity attributes. The irreversibility and uniqueness of the hash algorithm make the generated identity identifier highly secure and accurate.

[0204] In an exemplary embodiment, the third determination module 76 is further configured to determine the weight factor corresponding to each first node through a target formula, wherein the target formula includes: , is the weight factor corresponding to the zth first node, is the private key factor sequence corresponding to the zth first node, is the random number corresponding to the zth first node.

[0205] It is understandable that the weight factor corresponding to the first node can be generated by the above target formula, which includes: the private key factor sequence corresponding to each first node, and the random number corresponding to each first node. That is, the weight factor corresponding to each node can be determined by the private key factor matrix corresponding to each node and the random number corresponding to each node.

[0206] Through the embodiments of the present application, it can be ensured that the weight factor of each first node is uniquely determined and can only be calculated through the private key factor matrix and random numbers, thereby ensuring that the weight factor of the first node is safe and reliable.

[0207] In an exemplary embodiment, the generating module 78 is further used to encrypt the partial private key share; and send the encrypted partial private key share to the target object, so that the target object generates the target key according to the encrypted partial private key share.

[0208] It is understandable that after encrypting part of the private key share and sending it to the target object, the target object can generate the target key based on the encrypted part of the private key share. That is, the target object can generate the target key based on the encrypted private key share without waiting for confirmation from other participants or centralized institutions, which improves the flexibility and convenience of key generation.

[0209] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0210] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0211] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:

[0212] S1, determining a first node set that is allowed to generate a target key, wherein the first node set is a node set on a blockchain, and the target key includes: a target private key;

[0213] S2, determining a private key factor matrix of each first node in the first node set;

[0214] S3, determining the partial private key share corresponding to each first node according to each private key factor matrix;

[0215] S4, generating the target key according to the partial private key share.

[0216] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in the above method embodiment.

[0217] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0218] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0219] S1, determining a first node set that is allowed to generate a target key, wherein the first node set is a node set on a blockchain, and the target key includes: a target private key;

[0220] S2, determining a private key factor matrix of each first node in the first node set;

[0221] S3, determining the partial private key share corresponding to each first node according to each private key factor matrix;

[0222] S4, generating the target key according to the partial private key share.

[0223] An embodiment of the present application further provides a computer program product, including a computer program, which is implemented to perform the steps in the above method embodiment when executed by a processor.

[0224] Optionally, in this embodiment, the computer program product may be executed by a processor to perform the following steps:

[0225] S1, determining a first node set that is allowed to generate a target key, wherein the first node set is a node set on a blockchain, and the target key includes: a target private key;

[0226] S2, determining a private key factor matrix of each first node in the first node set;

[0227] S3, determining the partial private key share corresponding to each first node according to each private key factor matrix;

[0228] S4, generating the target key according to the partial private key share.

[0229] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0230] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0231] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for generating a key, characterized in that: include: Determine a first node set that is allowed to generate a target key, wherein the first node set is a node set on a blockchain, and the target key includes: a target private key; Determine a private key factor matrix of each first node in the first set of nodes; Determine, according to each private key factor matrix, a partial private key share corresponding to each first node; Generate the target key according to the partial private key share; Wherein, determining the private key factor matrix of each first node in the first node set includes: Obtaining elliptic curve cryptographic parameters corresponding to each first node; and Determine the matrix size of the to-be-determined private key factor matrix of each first node according to the consensus algorithm; Generate a private key factor matrix of each first node according to the elliptic curve cryptographic parameters and the matrix size; The step of generating the private key factor matrix of each first node according to the elliptic curve cryptographic parameters and the matrix size includes: Obtaining a large prime number of the elliptic curve corresponding to each first node from the elliptic curve cryptographic parameters corresponding to each first node; Determine a plurality of private key factors corresponding to each first node according to the large prime number and each first node; A private key factor matrix of each first node is generated according to each first node and a plurality of private key factors corresponding to the matrix size.

2. The method according to claim 1, characterized in that Determining a first set of nodes that are allowed to generate a target key includes: Receive a negotiation request sent by the target object; Determine the number of first nodes in the first node set to be generated according to the negotiation request; and Determine random numbers for all nodes on the blockchain, wherein each node on the blockchain corresponds to a random number; The plurality of random numbers are sorted from small to large, and the first nodes of the number of nodes are sequentially determined in the blockchain according to the order of the plurality of random numbers to generate the first node set.

3. The method according to claim 1, characterized in that After determining the private key factor matrix of each first node in the first set of nodes, the method further includes: Determine a plurality of public key factors in each first node according to each private key factor in the private key factor matrix; A public key factor matrix of each first node is generated according to the multiple public key factors.

4. The method according to claim 2, characterized in that: Determining a plurality of public key factors in each first node according to each private key factor in the private key factor matrix includes: Get the first base point of the elliptic curve corresponding to each elliptic curve cryptographic parameter; The product of each private key factor corresponding to each first node and the first base point is determined as a plurality of public key factors corresponding to each first node.

5. The method according to claim 3, characterized in that: After generating the public key factor matrix of each first node according to the multiple public key factors, the method further includes: Determine a partial public key share corresponding to each first node according to the public key factor matrix of each first node, wherein a target public key corresponding to the partial public key share has a corresponding relationship with the target private key; The partial public key share is stored in the blockchain.

6. The method according to claim 1, characterized in that After determining the private key factor matrix of each first node in the first set of nodes, the method further includes: Obtaining a random number corresponding to each first node; Verify the legitimacy of each random number; When it is determined that each random number has passed the verification, the partial private key share corresponding to each first node is determined according to each private key factor matrix.

7. The method according to claim 6, characterized in that Obtaining a random number corresponding to each first node includes: Determine a first value according to a node private key corresponding to each first node and a first base point corresponding to each first node; A random number corresponding to each first node is determined according to the first value and the first Hash function.

8. The method according to claim 7, characterized in that Verify the legitimacy of each random number, including: Determine a first verification integer and a second verification integer corresponding to each first node; Determining whether the first verification integer and the second verification integer are consistent; In a case where it is determined that the first verification integer is consistent with the second verification integer, determining that the random number corresponding to each first node passes the legitimacy verification; When it is determined that the first verification integer is inconsistent with the second verification integer, it is determined that the random number corresponding to each first node fails the legitimacy verification.

9. The method according to claim 8, characterized in that Obtaining a first verification integer corresponding to each first node includes: Obtain a first hash value corresponding to a target block in the blockchain, and determine a temporary random number corresponding to each first node; Mapping the first hash value to the elliptic curve corresponding to each first node according to a second hash function to generate a second base point of the elliptic curve corresponding to each first node; Determine a second value corresponding to each first node according to the temporary random number corresponding to each first node and the first base point, and determine a third value corresponding to each first node according to the temporary random number corresponding to each first node and the second base point; A first verification integer corresponding to each first node is determined according to a third Hash function, the second value and the third value.

10. The method according to claim 9, characterized in that Obtaining a second verification integer corresponding to each first node includes: Mapping the first hash value to the elliptic curve corresponding to each first node according to a fourth hash function to generate a third base point of the elliptic curve corresponding to each first node; Determine a fourth value according to the first verification integer, the temporary random number, and the node private key of each first node; determining a fifth value according to the fourth value, the first base point, the first verification integer, and a node public key corresponding to each first node, and determining a sixth value according to the fourth value, the third base point, the first verification integer, and the first value; A second verification integer corresponding to each first node is determined according to the fifth Hash function, the fifth value and the sixth value.

11. The method according to claim 6, characterized in that Determining the partial private key share corresponding to each first node according to each private key factor matrix includes: Determining a private key factor sequence corresponding to each first node in the private key factor matrix of each node; Determine a weight factor corresponding to each first node according to each private key factor sequence and a random number corresponding to each first node; The partial private key share corresponding to each first node is determined according to each private key factor sequence and each weight factor.

12. The method according to claim 11, characterized in that Determining a private key factor sequence corresponding to each first node in the private key factor matrix of each node includes: Get the target object's identity. Determining a first number of private key factor matrix selection sequences according to the identity identifier, wherein the first number is consistent with the number of nodes in the first node set; selecting a second number of private key factors at each of the first nodes according to each private key factor matrix selection sequence; A private key factor sequence corresponding to each first node is determined according to the second number of private key factors in each first node.

13. The method according to claim 12, characterized in that Get the target object's identity, including: Acquire the identity attribute of the target object, wherein the identity attribute includes at least one of the following: the identity card number of the target object, the date of birth of the target object; The identity attributes are mapped to the identity according to a hash algorithm to generate the identity identifier.

14. The method according to claim 11, characterized in that Determining the partial private key share corresponding to each first node according to each private key factor sequence and each weight factor includes: The weight factor corresponding to each first node is determined by a target formula, wherein the target formula includes: , is the weight factor corresponding to the zth first node, is the private key factor sequence corresponding to the zth first node, is the random number corresponding to the zth first node.

15. The method according to claim 1, characterized in that Generating the target key according to the partial private key share includes: Encrypting the portion of the private key share; The encrypted partial private key share is sent to the target object, so that the target object generates the target key according to the encrypted partial private key share.

16. A key generation device, characterized in that: include: A first determination module is used to determine a first node set that is allowed to generate a target key, wherein the first node set is a node set on a blockchain, and the target key includes: a target private key; A second determination module, used to determine a private key factor matrix of each first node in the first node set; A third determination module, configured to determine the partial private key share corresponding to each first node according to each private key factor matrix; A generating module, used for generating the target key according to the partial private key share; The second determination module is further used to obtain the elliptic curve cryptographic parameters corresponding to each of the first nodes; and determine the matrix size of the to-be-determined private key factor matrix of each of the first nodes according to the consensus algorithm; and generate the private key factor matrix of each of the first nodes according to the elliptic curve cryptographic parameters and the matrix size; Among them, the second determination module is also used to obtain the large prime number of the elliptic curve corresponding to each first node from the elliptic curve cryptographic parameters corresponding to each first node; determine the multiple private key factors corresponding to each first node according to the large prime number and each first node; and generate the private key factor matrix of each first node according to the multiple private key factors corresponding to each first node and the matrix size.

17. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 15 when executed by a processor.

18. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 15 are implemented.

Citation Information

Patent Citations

  • Key generation method and device

    CN111385098A

  • Hierarchical identification password key generation method based on global hash

    CN112929164A