Distributed key management method, system and medium applicable to government blockchain network
By deploying smart contracts in the government blockchain network, using key polynomial encoding and fault-tolerant reconstruction technology, the security and permission control problems of key management in the government blockchain network are solved, hidden storage and flexible management of keys are realized, cross-chain communication is supported, and the robustness and practicality of the system are improved.
Patent Information
- Application Number
- CN202510122802.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-26
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-01-26
AI Technical Summary
Traditional key management methods cannot adapt to the decentralized and distributed storage characteristics of government blockchain networks, pose security risks, and it is difficult to manage the permissions and cross-chain communication needs of users at different levels.
By deploying smart contracts in government blockchain networks, using key polynomial encoding and fault-tolerant reconstruction technologies, distributed management of keys, including access control of data fragments and digital identity management, supports error-free and fault-tolerant reconstruction, and performs accurate or functional repair.
It realizes the secure and reliable management of keys, ensures the hidden storage of data fragments, supports flexible permission control and cross-chain communication of multiple keys, and improves the robustness and engineering practicality of the system.
Smart Images

Figure CN119966619B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of distributed key management technology, and in particular to a distributed key management method applicable to government blockchain networks. Background Art
[0002] With the continuous development of government blockchain networks, traditional key security management methods can no longer meet the needs of government blockchain networks. Specifically, the following situations exist:
[0003] One issue is that traditional Key Distribution Centers (KDCs) struggle to adapt to the unique characteristics of government blockchain networks. This is because traditional KDCs require the establishment of a trusted authority for key distribution. When secure communication is needed, the KDC distributes keys to each party through a secure channel, allowing secure encrypted communication.
[0004] However, government blockchain networks feature decentralization, distributed storage, no central hardware or authority, equal rights and responsibilities for all nodes, and data maintained by all nodes. In this environment, it's impossible to establish an authoritative KDC node, let alone a so-called "secure channel." Therefore, traditional key distribution center key management methods are no longer suitable for the actual needs of government blockchains. Research is needed on key management methods tailored to government blockchain networks.
[0005] The second issue is that the key management of most government blockchain network nodes currently presents serious security risks. For example, most government blockchain nodes store private keys used for digital signatures or encrypted transmissions in plaintext in configuration files. System errors, human errors, hacker attacks, and other similar scenarios can easily lead to the leakage of these private and secret keys, compromising the security of the entire government blockchain network. While some network nodes use encryption to store used keys, managing the encryption keys remains a difficult problem.
[0006] The third scenario is that the user characteristics of government blockchain networks present new challenges for key management. Users in government blockchain networks are often government departments rather than individuals. Organizations formed by government departments often have hierarchical relationships within them. The importance of organizational levels varies, and users at different levels within an organization have varying permissions to access the organization's keys. For example, some keys can be used by a single user, while others require the combined use of two users. Furthermore, organizations often need to manage and use multiple keys simultaneously, not just a single one, each with its own unique permissions and requirements. These new requirements present unprecedented challenges for key management in government blockchain networks.
[0007] The fourth scenario is that cross-chain scenarios within government blockchain networks make key management crucial. Government blockchain networks often have both homogeneous and heterogeneous architectures. Different government blockchain networks need to connect and communicate with each other, and it's even more crucial to address differences in consensus mechanisms between them to ensure data consistency and reliability.
[0008] In order to achieve communication and interaction between different heterogeneous government blockchains, it is very important to establish a verifiable distributed key management mechanism that is adaptable to different heterogeneous chains to enable secure and reliable communication and interaction.
[0009] Based on this, the present invention provides a distributed key management method, system and medium suitable for government blockchain networks to solve the problem of how to securely manage keys in government blockchain network scenarios, which is a technical problem that needs to be solved urgently. Summary of the Invention
[0010] The purpose of the present invention is to overcome the shortcomings of the existing technology and provide a distributed key management method, system and medium suitable for the government blockchain network. The present invention can deploy smart contracts in the government blockchain network and securely manage the distributed keys in the government blockchain network through smart contracts.
[0011] In order to solve the existing technical problems, the present invention provides the following technical solutions:
[0012] A distributed key management method applicable to a government blockchain network, deploying at least one smart contract into the government blockchain network, and managing the distributed keys in the government blockchain network through the smart contract, wherein the management performs access control management and digital identity management on the data fragments obtained after the key is encoded according to preset key usage permissions.
[0013] Further, the method comprises the steps of:
[0014] Obtain at least one key and process it; the processing includes constructing at least one key polynomial P(X) for the at least one key, and storing at least one data fragment obtained by the aforementioned key polynomial P(X) in a node of the government blockchain network; wherein, before obtaining the key, a key generation step S110 is also included, as follows: S111, using a random number generator or a pseudo-random number generator to generate k keys key0, ..., key k-1 , where k is an integer greater than 1; S112, when the k keys have different lengths, select an integer h = max(log2(key0), ..., log2(key k-1 )) is the bit length of the longest key among the k keys; S113, select a secure prime number p with a bit length greater than or equal to h to construct a finite field Make finite field There are p different elements in total And the length of each element is bits; S114, mapping k keys key0, ..., key k-1 is a finite field The last k distinct elements
[0015] Obtain data fragments from the government blockchain network based on preset key usage permissions;
[0016] When the number of data fragments obtained is greater than or equal to a minimum threshold for allowing key reconstruction, determining whether key reconstruction is required; wherein, determining whether the collected data fragments may contain errors based on whether the source of the collected data fragments is trustworthy;
[0017] When none of the collected data segments contain errors, an error-free reconstruction step is performed to obtain the correct key; when at least one of the collected data segments may contain errors, a fault-tolerant reconstruction step is performed; wherein, when the number of erroneous data segments is less than or equal to a preset number, the fault-tolerant reconstruction step can locate the erroneous data segments while reconstructing the correct key;
[0018] For the data segment in which an error occurs, an error handling step is performed according to the preset key repair requirements; when executing the error handling step, the accuracy repair step or the functional repair step is selected to complete the key reconstruction; wherein, the data segment repaired by the aforementioned accuracy repair step is exactly the same as the original data segment, and the corresponding function and data segment value are the same; the data segment value repaired by the said functional repair step is different from the original data segment value, but the function achieved is the same.
[0019] Furthermore, the parameters configured in the method include:
[0020] The number of data segments n, the minimum number of reconstructed segments k, and the secure strong prime number p, and the maximum number of erroneous data segments allowed in n data segments e;
[0021] The above parameters are all positive integers and satisfy 1≤k≤n≤p-1 and Alternatively, 1≤k≤n≤p-1 and n=k+2e are satisfied simultaneously; wherein the strong prime number p can be selected as a safe prime number whose bit length is greater than or equal to h.
[0022] Furthermore, after step S110 and before obtaining the key, a key encoding step S120 is also included, as follows:
[0023] S121: Construct at least one k-1 order key polynomial based on the number of keys k to be managed. The coefficients of the key polynomial P(X) are the aforementioned finite field elements Right now Among them, the Representing a finite field The set of all key polynomials P(X) on ;
[0024] S122, Select a Finite Field The last n distinct non-zero elements As an independent variable, and calculate P(α i ), i∈[n], get n key-value pairs As the encoded n data fragments.
[0025] Further, determining whether the key needs to be reconstructed includes executing the reconstruction condition determination step S130 as follows:
[0026] S131, counting the number of obtained data segments;
[0027] S132, when the number of obtained data segments is greater than or equal to the minimum number of reconstructed segments k, determining whether the aforementioned collected data segments may contain errors;
[0028] S133: If the determination result is no, the error-free reconstruction step is executed; otherwise, the fault-tolerant reconstruction step is executed.
[0029] Furthermore, the error-free reconstruction step S140 includes:
[0030] S141, for the obtained n error-free data segments In the definition of y i =P(α i ), i∈[n] represents all the acquired data segments, and k data segments are randomly selected as input to the error-free reconstruction step;
[0031] S142, construct k k-1 order polynomials The reconstructed key polynomial is expressed as The coefficients of the key polynomial P(X) are the reconstructed key.
[0032] Furthermore, the fault-tolerant reconstruction step S150 includes:
[0033] S151, for all i∈[n] let P(α i )=y i , y=(y1,...,y n ), get n data fragments
[0034] S152, construct an e-order non-zero polynomial L(X) and obtain the error location polynomial When the error location polynomial L(X) satisfies L(α i )=0 if and only if y i ≠P(α i ), among the n data segments collected, the α of all the data segments with errors i ∈{y i ≠P(α i )} are all roots of the incorrectly located polynomial L(X);
[0035] S153, assume that the expansion of the error locator polynomial L(X) is L(X)=b0+b1X 1 +…+b e-1 X e-1 +b e X e , combined with Determine the highest order term X of the above L(X) e The coefficient is b e =1, then determine the remaining e unknown coefficients b0, b1, ..., b in L(X). e-1 , and then determine L(X);
[0036] S154, construct a k+e-1 order non-zero polynomial N(X) that satisfies y i L(α i )=N(α i ),i∈[n], let the coefficients of N(X) be a0,a1,...,a k+e-1 , then the expanded form of N(X) is expressed as N(X)=a0+a1X 1 +…+a k+e-1 X k+e-1 , by determining the k+e unknown coefficients a0, a1, ..., a of N(X) k+e-1 , and then determine the expansion of N(X);
[0037] S155, due to the equation P(α i )=y i holds for all i∈[n], and when y i ≠P(α i ), i∈[n] when L(α i )=0, so y i L(α i )=L(α i )P(α i ) holds for all i∈[n], that is, N(α i )=L(α i )P(α i ) holds for all i∈[n];
[0038] S156, due to N(α i )=L(α i )P(α i ) holds for all i∈[n], so we establish a system of equations with k+2e equations and k+2e unknowns, and obtain: Solve the above equations and get a0, a1, ..., a k+e-1 and b0, b1, ..., b e-1 The value of , thereby determining the non-zero polynomial N(X) and the error location polynomial L(X);
[0039] S157, after determining the aforementioned N(X) and L(X), when Δ(y, (P(α i )) i )≤e, the number of erroneous data fragments is less than or equal to the value e, which can be calculated by Reconstruct the key polynomial P(X) to obtain the key; conversely, Δ(y, (P(α i )) i )>e, the number of erroneous data fragments is greater than the aforementioned e value, and since P(X) cannot be reconstructed, the key cannot be obtained.
[0040] Furthermore, when executing the aforementioned step S157, an error handling step S160 can also be executed simultaneously; the error handling step S160 includes an error locating step S161 and an error repairing step S162; after executing the error locating step S161 to locate the erroneous data segment, the error repairing step S162 is executed to obtain the correct data segment; wherein, the error repairing step S162 selects to execute the accuracy repairing step S1621 or the functionality repairing step S1622 according to the repair requirements of the aforementioned erroneous data segment; wherein,
[0041] The error location step S161 is configured as follows: locating the data segment where the error occurs by using the aforementioned error location polynomial L(X), detecting the n data segments collected Among them, all α i ∈{L(α i )=0, i∈[n]} are all data fragments with errors;
[0042] The error repair step S162 is configured as follows: the key polynomial reconstructed by the fault-tolerant reconstruction step Calculate the correct value of the data segment; according to the repair requirements of the data segment, perform the accuracy repair step S1621 or the functionality repair step S1622 in the above error repair step; wherein,
[0043] The accuracy repair step S1621 refers to the position of the data segment corresponding to the error, that is, α i ∈{L(α i )=0,i∈[n]}restore the original data segment; the functional repair step S1622 refers to selecting the position of the unused data segment Calculate a new And use the new data segment (α j , P(α j )) replaces the erroneous data fragment; wherein, the data fragment that has undergone the functional repair step is a legal data fragment that can be used to reconstruct the key, and the data fragment that has undergone the functional repair step is stored in the node of the government blockchain network.
[0044] A distributed key management system suitable for a government blockchain network, comprising:
[0045] Nodes of the government blockchain network are used to store data fragments obtained after key encoding;
[0046] Smart contracts are used for access control management of key-encoded data fragments and user digital identity management;
[0047] A system server connected to a node of the government blockchain network;
[0048] The system server is configured to: deploy at least one smart contract into the government blockchain network, and manage the distributed keys in the government blockchain network through the smart contract, wherein the management performs access control management and digital identity management on the data fragments obtained after the key encoding according to the preset key usage permissions.
[0049] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the implementation steps of any of the above methods.
[0050] Based on the above advantages and positive effects, the advantage of the present invention is that it is suitable for the management of keys by hierarchical government departments in the government blockchain network, wherein the keys are encoded and stored in the government blockchain network in the form of data fragments.
[0051] Furthermore, a smart contract is designed and deployed to the aforementioned government blockchain network, and the smart contract code is set corresponding to the steps in the method; and then, through the smart contract, access control management and digital identity management are performed on the data fragments obtained after key encoding according to the preset key usage permissions.
[0052] Furthermore, when the total number of valid data fragments obtained is greater than or equal to the minimum number of data fragments k required to reconstruct the key, the key can be reconstructed. Furthermore, because the key is stored in the blockchain network as data fragments rather than plaintext throughout its lifecycle, it can achieve "available but invisible" management of multiple keys.
[0053] Furthermore, since the preset key fault-tolerant reconstruction step of the present invention can also locate erroneous data fragments and, based on the preset key repair requirements, perform accurate or functional repair on the erroneous data fragments when executing the key repair step, it has extremely high practicality and robustness in engineering.
[0054] Furthermore, it is implemented by smart contracts across government blockchains, thereby solving the key management and application problems in cross-chain application scenarios in government blockchains. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 A flowchart of a method provided by an embodiment of the present invention.
[0056] Figure 2 A schematic diagram of another method provided by an embodiment of the present invention.
[0057] Figure 3 A schematic diagram of the structure of a system provided in an embodiment of the present invention.
[0058] Description of reference numerals:
[0059] System 200, node 201, smart contract 202, system server 203. DETAILED DESCRIPTION
[0060] The following is a further detailed description of a distributed key management method, system and medium applicable to a government blockchain network disclosed in the present invention in conjunction with the accompanying drawings and specific embodiments. It should be noted that the technical features or combinations of technical features described in the following embodiments should not be considered isolated, and they can be combined with each other to achieve better technical effects. In the drawings of the following embodiments, the same reference numerals appearing in each drawing represent the same features or components, which can be applied to different embodiments. Therefore, once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.
[0061] It should be noted that the structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the contents disclosed in the specification for people familiar with this technology to understand and read, and are not intended to limit the conditions under which the invention can be implemented. Any structural modification, change in proportional relationship, or adjustment of size should fall within the scope of the technical content disclosed in the invention without affecting the efficacy and purpose of the invention. The scope of the preferred embodiments of the present invention includes alternative implementations, in which the functions can be performed in a non-described or discussed order, including performing the functions in a substantially simultaneous manner or in a reverse order according to the functions involved, which should be understood by those skilled in the art of the art to which the embodiments of the present invention belong.
[0062] Technologies, methods, and apparatus known to persons of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the specification. In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not limiting. Therefore, other examples of the exemplary embodiments may have different values.
[0063] Example
[0064] This embodiment preferably constructs at least one government blockchain network. Specifically, at least one smart contract is deployed in the government blockchain network. The smart contract manages distributed keys in the government blockchain network. The smart contract performs access control and digital identity management on data fragments obtained by key encoding according to preset key usage permissions.
[0065] The deployment operation preferably involves writing smart contract code to deploy at least one smart contract to the aforementioned government blockchain network. In this embodiment, the smart contract code is configured to correspond to the steps in the method. In other words, all steps in this embodiment can be implemented by writing smart contract code.
[0066] The government blockchain network refers to a consortium of government departments using blockchain technology. These departments use the network to synchronize business data, digital identities, access controls, and operational records in real time, ensuring data consistency and consensus across all nodes.
[0067] At the same time, various government departments convert relevant business agreements into executable smart contract codes and deploy them on the government blockchain network. This enables various government departments to intelligently and automatically perform relevant smart contracts in accordance with pre-set business rules and operating logic, and achieve efficient cross-departmental business collaboration through the government blockchain network.
[0068] In this embodiment, the smart contracts deployed in the aforementioned government blockchain network are primarily used to implement identity authentication and access control. Specifically, smart contracts store and verify the identity information of each user in the government blockchain network. Each user in the government blockchain network can set operational permissions to restrict the access rights of the accessee to, access to, and use of the data held by the accessee. Furthermore, each user in the government blockchain network can use smart contracts to manage and control the access rights of the accessee to specific resources, such as file storage, digital content, and data fragments.
[0069] The users include but are not limited to various government departments, their cooperating departments, and their collaborative departments.
[0070] It’s worth noting that, in terms of network and data security, the permission control logic of smart contracts within government blockchain networks should be integrated with the data security management of government departments outside the blockchain. This is because smart contracts define the business logic for permission control and preventing data leaks, thus strictly denying unauthorized access.
[0071] By way of example and not limitation, for example, directly opening a local database to browse government blockchain data is strictly prohibited. Government departments must carefully design and implement permissions at the smart contract and interface levels to ensure data is not leaked within the systems corresponding to the government blockchain network. Unauthorized access to the government blockchain at the application layer, display interface, reports, logs, databases, and other links is prohibited, thereby eliminating potential internal operational risks.
[0072] In addition, the running logic of the smart contract on each node is consistent, so no matter which node the request is sent to, the result obtained is the same.
[0073] See Figure 1 FIG. 1 is a flow chart of a method provided in this embodiment. The implementation step S100 of the method is as follows:
[0074] S101: Obtain at least one key and process it.
[0075] The processing includes constructing at least one key polynomial P(X) for at least one key, and storing at least one data fragment obtained by the aforementioned key polynomial P(X) in a node of the government blockchain network.
[0076] Among them, because the keys are stored in the government blockchain network in the form of data fragments rather than plain text, it is possible to achieve "available but invisible" for multiple keys, which has excellent practicality and robustness in engineering practice.
[0077] S102, obtaining data fragments from the government blockchain network according to the preset key usage permissions.
[0078] S103, when the number of obtained data fragments is greater than or equal to the minimum threshold value allowing key reconstruction, determine whether key reconstruction is required; wherein, based on whether the source of the collected data fragments is credible, determine whether the aforementioned collected data fragments may have errors.
[0079] S104: When all collected data segments are error-free, an error-free reconstruction step S140 is performed to obtain the correct key. When at least one of the collected data segments may contain errors, an error-tolerant reconstruction step S150 is performed. When the number of erroneous data segments is less than or equal to a preset number, the error-tolerant reconstruction step S150 can locate the erroneous data segments while reconstructing the correct key.
[0080] S105: For the data segment in which the error occurred, according to the preset key repair requirements, execute the error handling step S160. When executing the error handling step S160, choose to execute the accuracy repair step S1621 or the functionality repair step S1622 to complete the key reconstruction. The data segment repaired by the accuracy repair step S1621 is exactly the same as the original data segment, and the corresponding function and data segment value are the same; the data segment repaired by the functionality repair step S1622 has a different value from the original data segment, but implements the same function.
[0081] By way of example and not limitation, see Figure 2 As shown in the figure, a schematic diagram of a method provided by this embodiment is provided. Assume that there are s keys that need to be managed in an organization formed by various government departments. The organization groups these s keys according to the government departments' access rights to the keys, and establishes a key polynomial for each group for management. Therefore, it is divided into t key polynomials P i (X), i∈{1, 2,...,t}.
[0082] Taking one of the key polynomials P1(X) as an example, the key polynomial P1(X) can be used to manage three keys, which means that the organization's management requirements for these three keys are the same, and it also means that the minimum number of data fragments required to reconstruct the key polynomial P1(X) is at least three.
[0083] This embodiment preferably uses Figure 2 For example, the key polynomial P1(X) in the example is used to show the whole process of key management. In order to show the generality, the key polynomial P1(X) is represented by P(X), and the minimum number of reconstruction fragments k i Indicated by k.
[0084] Since each key polynomial P(X) of degree k-1 can manage at least k keys, taking any key polynomial P(X) as an example, before obtaining the key, a key generation step S110 is also included.
[0085] The key generation step S110 includes:
[0086] S111, use a random number generator or a pseudo-random number generator to generate k keys key0, ..., key k-1 , where k is an integer greater than 1.
[0087] The key is preferably displayed in PKCS#1 format or PKCS#8 format. The key generation step supports the use of mainstream public key encryption algorithms and symmetric encryption algorithms in the prior art, including but not limited to the national secret algorithm, elliptic curve encryption algorithm, RSA algorithm, etc.
[0088] In this embodiment, it is assumed that the organization generates three random keys in the key generation step, whose binary representations are "1111011", "11101010" and "101011001", and the three keys need to be managed.
[0089] S112, when the k keys have different lengths, select an integer h = max(log2(key0), ..., log2(key k-1 )) is the bit length of the longest key among the k keys.
[0090] In this embodiment, among the three randomly generated keys, the longest key has a bit length of 9 bits, that is, h = 9. In practical applications, ensure that h is an integer multiple of 8, and if it is less than 8, add 0 to fill it.
[0091] S113, select a secure prime number p with a bit length greater than or equal to h to construct a finite field Make finite field There are p different elements in total And the length of each element is bit.
[0092] For the convenience of explanation, in this embodiment, a prime number p=997 with a length of 10 bits is selected to construct a finite field Then the finite field There are 997 unique elements on Then the length of each element is 10 bits; in practical applications, strong prime numbers are often used to enhance the security of the system, such as p = 2 128 +12451.
[0093] S114, mapping k keys key0, ..., key k-1 is a finite field The last k distinct elements
[0094] Using finite field elements m0, ..., m k-1 As polynomial coefficients, construct a finite field The k-1 order key polynomial P(X) on , the polynomial P(X) is called the key polynomial or encoding polynomial.
[0095] In this embodiment, the original keys "1111011", "11101010" and "101011001" are mapped to the finite field The elements on are m0=123, m1=234 and m2=345 respectively.
[0096] Preferably, the parameters configured by the method described in this embodiment include: the number of encoded data segments n, the minimum number of reconstructed segments k, and a secure strong prime number p, and the maximum number of erroneous data segments e allowed in the n data segments.
[0097] The above parameters are all positive integers and satisfy 1≤k≤n≤p-1 and Alternatively, 1≤k≤n≤p-1 and n=k+2e are satisfied simultaneously; wherein the strong prime number p can be selected as a safe prime number whose bit length is greater than or equal to h.
[0098] In this embodiment, the integers k = 3, n = 5, and e = 1 are selected to satisfy 5 = 3 + 2 * 1. This means that the three original keys are encoded into five data fragments, of which at most one data fragment is allowed to be erroneous. In other words, even if one of the five data fragments is erroneous, the fault-tolerant reconstruction step can still reconstruct the correct key and locate the erroneous data fragment.
[0099] Preferably, after step S110 and before obtaining the key, a key encoding step S120 is further included. The key encoding step S120 includes:
[0100] S121: Construct at least one k-1 order key polynomial based on the number of keys k to be managed. The coefficients of the key polynomial P(X) are the aforementioned finite field elements Right now Among them, the Representing a finite field The set of all key polynomials P(X) over .
[0101] It is worth emphasizing that in this embodiment, the number k of keys managed by the organization as needed is the minimum number k of reconstruction fragments configured in the corresponding method of this embodiment, so as to ensure that k keys can be managed.
[0102] In this embodiment, the aforementioned organization can construct one or more key polynomials according to the number of keys to be managed. As an example, since we need to manage three keys, we construct a 2nd order coding polynomial, namely At the same time, taking m0=123, m1=234 and m2=345 as the coefficients of the polynomial P(X), we get P(X)=123+234X+345X 2 (mod997).
[0103] S122, Select a Finite Field The last n distinct non-zero elements As an independent variable, and calculate P(α i ), i∈[n], get n key-value pairs As the encoded n data fragments.
[0104] In this embodiment, a finite field is selected The 5 different non-zero elements above are selected because we want to locate the data segment where the error occurs. This is to facilitate the location of the data segment where the error occurs, and there is no mandatory requirement for the selection of non-zero elements.
[0105] As an example and not a limitation, for example, the calculation process of the key code is as follows:
[0106]
[0107] Correspondingly, 5 data fragments are obtained: [1, 702], [2, 974], [3, 939], [4, 597], and [5, 945]. These data fragments are stored in the nodes of the government blockchain network, and permission groups are established through smart contracts to manage and control access rights to the data fragments. Figure 2 As shown, see Figure 2The arrows of the data segments in the figure point to the access rights of the data segments to be assigned via the permission groups.
[0108] As one of the preferred implementations of this embodiment, dynamic plugin authorization is implemented through smart contracts to meet the need to manage and control access rights to data segments by establishing permission groups. Dynamic plugin authorization can improve system flexibility and security while reducing maintenance costs. Specifically, plugin authorization is implemented through predefined permission rules and conditions. When a user calls a plugin, the smart contract determines whether to allow the plugin to execute based on the current user's permission status and the plugin's authorization rules.
[0109] Compared to traditional static authorization methods, this authorization method offers greater flexibility and can be dynamically adjusted based on actual needs. This flexibility is crucial for government blockchain networks because users in these networks are often government departments rather than individuals. Organizations formed by government departments often have hierarchical relationships within them, and the importance of organizational hierarchies varies. Users at different levels within an organization have varying permissions to access the organization's keys. For example, some keys can be used by a single user, while others require the combined use of two users. Furthermore, organizations often need to manage and use multiple keys simultaneously, not just one, each with its own permissions and requirements.
[0110] Establishing a permission group is one of the predefined permission rules and conditions for plug-in authorization, which has extremely high flexibility. By establishing a permission group, you can decide which government departments in the organization can obtain how many data fragments, and then realize the management of different keys of the organization. For example: if a key is encoded into 3 data fragments, two permission groups can be established. Users who join one of the permission groups can obtain 3 data fragments. For example, the administrator of the organization can obtain 3 data fragments by joining the permission group, so the administrator can reconstruct and use the key alone; at the same time, establish another permission group. Users in the group can only obtain 2 data fragments at most. For example, ordinary users in the organization except administrators can join the permission group. Because the number of data fragments obtained by every 2 ordinary users exceeds 3, the management requirement that only two users can use the key together can be met.
[0111] Furthermore, the immutability of smart contracts ensures the security of authorization information. With the continuous development of government blockchain technology, smart contract plug-in authorization mechanisms can also be applied to scenarios such as digital identity authentication and data sharing. Existing technologies apply artificial intelligence and machine learning to smart contract plug-in authorization to achieve more intelligent and automated authorization management, which helps improve system performance and user experience. The application of artificial intelligence and machine learning to smart contract plug-in authorization is already existing technology, so we will not elaborate on this in detail.
[0112] It's also worth noting that, based on the organization's key management requirements, some data fragments can be stored on the government blockchain network, while others can be stored off-chain and managed by dedicated personnel. Information related to the data fragments stored on the government blockchain (such as creation time, validity period, and usage status) is automatically managed by the aforementioned smart contract.
[0113] Preferably, determining whether the key needs to be reconstructed includes executing a reconstruction condition determination step S130. The reconstruction condition determination step S130 includes:
[0114] S131, counting the number of obtained data segments.
[0115] Since users within the aforementioned organization (i.e., various government departments) can obtain a corresponding number of data fragments by joining different permission groups in the government blockchain network, the way to collect data fragments can come from the blockchain network or from local storage off-chain.
[0116] S132: When the number of acquired data segments is greater than or equal to the minimum number of reconstructed segments k, determine whether the aforementioned collected data segments may contain errors.
[0117] Considering that the total number of data fragments obtained by users within the aforementioned organization is greater than or equal to the minimum number of reconstruction fragments k required to reconstruct the key, the requirement for the number of data fragments required for key reconstruction is met. However, the impact of possible errors or incompleteness of the data fragments on reconstructing the correct key is still under consideration. Therefore, it is necessary to determine whether the collected data fragments may contain errors or data integrity issues.
[0118] S133: If the determination result is negative, the error-free reconstruction step S140 is executed; otherwise, the fault-tolerant reconstruction step S150 is executed.
[0119] It is worth noting that when the aforementioned collected data fragments all originate from the aforementioned government blockchain network, because the data integrity of the government blockchain network can be guaranteed by the tamper-proof nature of the data, the aforementioned error-free reconstruction step S140 can be executed to obtain the correct key; on the contrary, when the aforementioned collected data fragments have off-chain sources, it is necessary to determine whether the aforementioned collected data fragments may contain errors or data integrity issues, and therefore it is preferred to execute the fault-tolerant reconstruction step S150.
[0120] As one of the preferred implementations of this embodiment, the error-free reconstruction step S140 includes:
[0121] S141, for the obtained n error-free data segments In the definition of y i =P(α i ), i∈[n] represents all the acquired data segments, and k data segments are randomly selected As input to the error-free reconstruction step.
[0122] Among them, the error-free reconstruction step does not require obtaining all n error-free data fragments. The correct key can be reconstructed when the minimum number of reconstruction fragments k≤n required to reconstruct the key is obtained.
[0123] In this embodiment, the user obtains 5 data fragments for reconstructing the key. After determining that the 5 data fragments are all from credible sources, it is preferred to perform the aforementioned error-free reconstruction step to obtain the correct key, and arbitrarily select 3 data fragments from the 5 data fragments, for example, select data fragments [1, 702], [2, 974], and [3, 939] to reconstruct the key.
[0124] S142, construct k k-1 order polynomials The reconstructed key polynomial is expressed as The coefficients of the key polynomial P(X) are the reconstructed key.
[0125] In this embodiment, it is preferred to construct three second-order polynomials:
[0126] and
[0127] At this point, the reconstructed key polynomial is as follows:
[0128]
[0129] The polynomial coefficients are the key. In this embodiment, the error-free key reconstruction process can also be achieved through matrix calculation. After expressing the reconstructed key as a column vector, it is multiplied by the unit diagonal matrix to obtain a specific key. Since the matrix calculation method is a conventional technology, it will not be detailed here.
[0130] As another preferred implementation of this embodiment, when there may be errors in the n collected data fragments, for example, when the integrity and legality of the data fragments cannot be determined, it is preferred to perform the fault-tolerant reconstruction step S150. The fault-tolerant reconstruction step S150 includes:
[0131] S151, for all i∈[n] let P(α i )=y i , y=(y1,...,y n ), get n data fragments
[0132] Assume that users in the aforementioned organization obtain n data fragments. If for all i∈[n], we assume that P(α i )=y i That is, y=(y1,...,y n ), then the n data fragments can be expressed as
[0133] At this point, there may be an erroneous data fragment among the n data fragments obtained, but it is not clear which data fragment has the error; assuming that there are at most e data fragments with errors among the n data fragments, satisfying When , the fault-tolerant reconstruction step needs to locate e erroneous data segments in order to reconstruct the correct key.
[0134] In this example, the user obtains five data segments for key reconstruction. Assume that one of these segments is erroneous, for example, data segment [5, 945] becomes [5, 0]. In other words, the data segments ultimately used to reconstruct the key are [1, 702], [2, 974], [3, 939], [4, 597], and [5, 0]. In this case, assume that y represents all the data segments used to reconstruct the key, i.e., y = (702, 974, 939, 597, 0). Accordingly, in order to reconstruct the correct key from y, the fault-tolerant reconstruction step must also detect that the erroneous data segment is [5, 0].
[0135] S152, construct an e-order non-zero polynomial L(X) and obtain the error location polynomial When the error location polynomial L(X) satisfies L(α i )=0 if and only if y i ≠P(α i), among the n data segments collected, the α of all the data segments with errors i ≠{y i ≠P(α i )} all incorrectly locate the roots of the polynomial L(X), that is, the polynomial L(X) has at most e roots.
[0136] Since the parameters in this embodiment satisfy both 1≤≤n≤p-1 and Therefore, when constructing the error localization polynomial L(X), the specific location of the data segment where the error occurred is not known. However, if the error localization polynomial L(X) can be determined, the error can be located. This is because the preset parameter e=1 is preferably set in this embodiment, so the fault-tolerant reconstruction step requires constructing a first-order non-zero polynomial L(X).
[0137] S153, assume that the expansion of the error locator polynomial L(X) is L(X)=b0b1X 1 +…+b e-1 X e-1 +b e X e , combined with the error location polynomial L(X), it can be expressed as Determine the highest order term X of the above L(X) e The coefficient is b e =1, then determine the remaining e unknown coefficients b0, b1, ..., b in L(X). e-1 , and then determine L(X).
[0138] Among them, due to the error location polynomial It is the first polynomial, so the highest order term X of the error location polynomial L(X) can be determined e The coefficient must be b e =1, therefore, L(X) can be expressed as L(x)=b0+b1X 1 +…+b e-1 X e-1 +X e .
[0139] Based on this, considering that if the other e unknown coefficients b0, b1, ..., b of L(X) can be determined e-1 , then the error location polynomial L(X) can be determined, and all roots α of L(X) i ∈{y i ≠P(α i )} is the location of the data segment where the error occurred.
[0140] Therefore, in this embodiment, since e=1, the coefficient of L(X) is set to b0, then L(X)=X-b0. In other words, if the value of b0 can be determined, L(X) can be determined, thereby determining the location where the error occurred and correcting the data segment where the error occurred.
[0141] S154, construct a k+e-1 order non-zero polynomial N(X) that satisfies y i L(α i )=N(α i ), i∈[n], let the coefficients of N(X) be a0, a1, ..., a k+e-1 , then the expanded form of N(X) is expressed as N(X)=a0+a1X 1 +…+a k+e-1 X k+e-1 , by determining the k+e unknown coefficients a0, a1, ..., a of N(X) k+e-1 , and then determine the expansion of N(X).
[0142] In N(X)=a0+a1X 1 +…+a k+e-1 X k+e-1 When we know that the polynomial N(X) has k+e unknown coefficients a0, a1, ..., a k+e-1 If we can determine a0, a1, ..., a k+e-1 , then the polynomial N(X) can be determined.
[0143] In this embodiment, a third-order polynomial N(X) is constructed to satisfy y i L(α i )=N(α i ), i∈[5]. Assuming that the coefficients of the polynomial N(X) are a0, a1, a2, a3, then the polynomial N(X)=a0+a1X 1 +a2X 2 +a3X 3 There are 4 unknowns in total. If we can determine the values of a0, a1, a2, and a3, we can determine the polynomial N(X).
[0144] S155, due to the equation P(α i )=y i holds for all i∈[n], and when y i ≠P(α i ), i∈[n] when L(α i )=0, so y i L(α i )=L(α i )P(α i ) holds for all i∈[n], that is, N(α i )=L(αi )P(α i ) holds for all i∈[n].
[0145] That is to say, among the n data fragments collected, when a data fragment is error-free, the equation P(α i )=y i Established; when there is an error in a data segment, the error location polynomial L(α i )=0, then equation y i L(α i )=L(α i )P(α i ) Both sides are equal to 0, the equation y i L(α i )=L(α i )P(α i ) also holds true, and because y is defined i L(α i )=N(α i ), i∈[n], so N(α i )=L(α i )P(α i ) holds for all i∈[n].
[0146] S156, due to N(α i )=L(α i )P(α i ) holds for all i∈[n], so we establish a system of equations with k+2e equations and k+2e unknowns, and obtain: Solve the above equations and get a0, a1, ..., a k+e-1 and b0, b1, ..., b e-1 The value of , thereby determining the non-zero polynomial N() and the error location polynomial L(x).
[0147] Since the above equations have k+2e equations and a total of k+2e unknowns, solving this equation can simultaneously obtain the coefficients a0, a1, ..., a of the polynomials N(X) and L(X). k+e-1 and b0, b1, ..., b e-1 , thereby determining the non-zero polynomial N(X) and the error location polynomial L(X).
[0148] If this system of equations has no solution, it means that the number of erroneous data fragments exceeds ∈. At this time, it is impossible to reconstruct the key and locate the erroneous data fragments.
[0149] In this embodiment, because y i L(α i )=L(αi )P(α i ), i∈[5] holds, that is, N(α i )=L(α i )P(α i ), i∈[5] holds, so it is preferable to establish a system of five equations to solve the five unknowns a0, a1, a2, a3 and b0:
[0150] a0+a1+a2+a3≡702(1-b0)(mod997)
[0151] a0+2a1+4a2+8a3≡974(2-b0)(mod997
[0152] a0+3a1+9a2+27a3≡939(3-b0)(mod997)
[0153] a0+4a1+14a2+64a3≡597(4-b0)(mod997)
[0154] a0+5a1+25a2+125a3≡0(5-b0)(mod997)
[0155] The above equations are solved using a matrix to solve the five unknowns a0, a1, a2, a3 and b0 as follows:
[0156]
[0157] We then obtain a0=382, a1=947, a2=503, a3=345 and b0=5.
[0158] S157, after determining the aforementioned N(X) and L(X), when Δ(y,(P(α i )) i )≤e, the number of erroneous data fragments is less than or equal to the value e, which can be calculated by Reconstruct the key polynomial P(X) to obtain the key; conversely, Δ(y,(P(α i )) i )>e, the number of erroneous data fragments is greater than the aforementioned e value, and since P(X) cannot be reconstructed, the key cannot be obtained.
[0159] In this embodiment, solving the above equations can yield the polynomial N(X)=382+947X 1 +503X 2 +345X 3 ,L(X)=X-5=992+X(mod 997).
[0160] Since the number of erroneous data segments is less than or equal to the aforementioned e=1, the key polynomial P(X) can be reconstructed, namely:
[0161]
[0162] It is also worth noting here that when executing the aforementioned step S157, the error handling step S160 can also be executed simultaneously; the error handling step S160 includes an error location step S161 and an error repair step S162; after executing the error location step S161 and locating the erroneous data segment, the error repair step S162 is executed to obtain the correct data segment; wherein, the error repair step S162 chooses to execute the accuracy repair step S1621 or the functional repair step S1622 according to the repair requirements of the aforementioned erroneous data segment.
[0163] As one of the preferred implementations of this embodiment, the error handling step S160 includes:
[0164] Error location step S161, locate the data segment where the error occurs by using the aforementioned error location polynomial L(X), and detect the collected n data segments Among them, all α i ∈{L(α i )=0, i∈[n]} are all erroneous data segments, that is, the roots of all the aforementioned error location polynomials L(X) are the erroneous data segments.
[0165] In this embodiment, the data segment [5, 0] where the error occurs, according to the error locator polynomial L(5)=5-5=992+5=0 (mod 997), it can be known that the position of the data segment where the error occurs is the root of the error locator polynomial L(X).
[0166] Error repair step S162, the key polynomial reconstructed by the fault-tolerant reconstruction step The correct value of the data segment is calculated; according to the repair requirements of the data segment, the accuracy repair step S1621 or the functionality repair step S1622 in the above-mentioned error repair step is executed.
[0167] The accuracy repair step S1621 refers to the position of the data segment corresponding to the error, that is, α i ∈{L(α i )=0,i∈[n]}Restore the original data fragment. That is, recalculate α i ∈{L(α i )=0,i∈[n]}; the original value of the erroneous data segment can be accurately repaired (α i ,P(αi )),α i ∈{L(α i )=0,i∈[n]}.
[0168] The functional repair step S1622 is to select an unused data segment location Calculate a new And use the new data segment (α j , P(α j )) replaces the erroneous data fragment; wherein, the data fragment that has undergone the functional repair step is a legal data fragment that can be used to reconstruct the key, and the data fragment that has undergone the functional repair step is stored in the node of the government blockchain network.
[0169] In this embodiment, the accuracy repair step can be performed by calculating (5, P(5)) to obtain the original value [5, 945] of the erroneous data segment; the functional repair step can be performed by selecting an unused data segment position, such as selecting an unused new data segment position 6, and calculating (6, P(6)), thereby obtaining a new data segment [6, 986] to replace the original value [5, 0] of the erroneous data segment; the new data segment [6, 986] is functionally identical to the original data segment, can be used to reconstruct the legitimate data segment of the key, and is stored in the government blockchain network.
[0170] Other technical features are described in the previous embodiments and will not be repeated here.
[0171] In addition, see Figure 3 As shown, the present invention also provides an embodiment, which provides a distributed key management system 200 applicable to a government blockchain network, including:
[0172] Node 201 of the government blockchain network is used to store data fragments obtained after key encoding.
[0173] Smart contract 202 is used for access control management of key-encoded data segments and user digital identity management.
[0174] System server 203, the system server 203 is connected to node 201 of the government blockchain network.
[0175] The system server 203 is configured to: deploy at least one smart contract into the government blockchain network, and manage the distributed keys in the government blockchain network through the smart contract, wherein the management performs access control management and digital identity management on the data fragments obtained after the key encoding according to the preset key usage permissions.
[0176] For other technical features, please refer to the previous embodiments and will not be repeated here.
[0177] In addition, an embodiment of the present invention also provides a computer-readable storage medium on which a program is stored for use in the aforementioned distributed key management system applicable to a government blockchain network. When the program is executed by a processor, it can implement any of the steps of the above-mentioned distributed key management method applicable to a government blockchain network.
[0178] For other technical features, please refer to the previous embodiments and will not be repeated here.
[0179] In the above description, the components may be selectively and operatively combined in any number within the scope of the intended protection of the present disclosure. In addition, terms such as "include," "encompass," and "have" should be interpreted as inclusive or open-ended rather than exclusive or closed by default, unless expressly defined to the contrary. All technical, technological, or other terms have the meanings understood by those skilled in the art, unless they are defined to the contrary. Common terms found in dictionaries should not be interpreted in an overly idealized or unrealistic manner in the context of the relevant technical documentation, unless expressly defined to that extent by the present disclosure.
[0180] Although example aspects of the present disclosure have been described for illustrative purposes, those skilled in the art will appreciate that the foregoing description is merely a description of preferred embodiments of the present invention and does not limit the scope of the present invention in any way. The scope of the preferred embodiments of the present invention includes alternative implementations in which functions may be performed out of the order in which they appear or are discussed. Any changes or modifications made by those skilled in the art based on the foregoing disclosure are intended to fall within the scope of the claims.
Claims
1. A distributed key management method applicable to a government blockchain network, characterized in that: Deploy at least one smart contract to a government blockchain network, and manage distributed keys in the government blockchain network through the smart contract, wherein the management performs access control management and digital identity management on data fragments obtained after key encoding according to preset key usage permissions; The method comprises the steps of: Obtain at least one key and process it; the processing includes constructing at least one key polynomial P(X) for the at least one key, and storing at least one data fragment obtained by the aforementioned key polynomial P(X) in a node of the government blockchain network; wherein, before obtaining the key, a key generation step S110 is also included, as follows: S111, using a random number generator or a pseudo-random number generator to generate k keys key0, ..., key k-1 , where k is an integer greater than 1; S112, when the k keys have different lengths, select an integer h = max(log2(key0), ..., log2(key k-1 )) is the bit length of the longest key among the k keys; S113, select a secure prime number p with a bit length greater than or equal to h to construct a finite field Make finite field There are p different elements in total And the length of each element is bits; S114, mapping k keys key0, ..., key k-1 is a finite field The last k distinct elements Obtain data fragments from the government blockchain network based on preset key usage permissions; When the number of data fragments obtained is greater than or equal to a minimum threshold for allowing key reconstruction, determining whether key reconstruction is required; wherein, determining whether the collected data fragments may contain errors based on whether the source of the collected data fragments is trustworthy; When all the collected data segments are free of errors, an error-free reconstruction step is performed to obtain the correct key; when at least one of the collected data segments may have errors, a fault-tolerant reconstruction step is performed; wherein, when the number of data segments with errors is less than or equal to a preset number, the fault-tolerant reconstruction step can locate the data segments with errors while reconstructing the correct key; the error-free reconstruction step S140 includes: S141, for the n error-free data segments obtained, In the definition of y i =P(α i ), i∈[n] represents all the acquired data segments, and k data segments are randomly selected As input to the error-free reconstruction step; S142, construct k k-1 order polynomials The reconstructed key polynomial is expressed as The coefficients of the key polynomial P(X) are the reconstructed keys; the fault-tolerant reconstruction step S150 includes: S151, for all i∈[n], set P(α i )=y i , y=(y1,...,y n ), get n data fragments S152, construct an e-order non-zero polynomial L(X) and obtain the error location polynomial When the error location polynomial L(X) satisfies L(α i )=0 if and only if y i ≠P(α i ), among the n data segments collected, the α of all the data segments with errors i ∈{y i ≠P(α i )} are all roots of the error locator polynomial L(X); S153, assume that the expansion of the error locator polynomial L(X) is L(X)=b0+b1X 1 +…+b e-1 X e-1 +b e X e , combined with Determine the highest order term X of the above L(X) e The coefficient is b e =1, then determine the remaining e unknown coefficients b0, b1, ..., b in L(X). e-1 , and then determine L(X); S154, construct a k+e-1 order non-zero polynomial N(X) that satisfies y i L(α i )=N(α i ), i∈[n], let the coefficients of N(X) be a0, a1, ..., a k+e-1 , then the expanded form of N(X) is expressed as N(X)=a0+a1X 1 +…+a k+e-1 X k+e-1 , by determining the k+e unknown coefficients a0, a1, ..., a of N(X) k+e-1 , and then determine the expansion of N(X); S155, due to the equation P(α i )=y i holds for all i∈[n], and when y i ≠P(α i ), i∈[n] when L(α i )=0, so y i L(α i )=L(α i )P(α i ) holds for all i∈[n], that is, N(α i )=L(α i )P(α i ) holds for all i∈[n]; S156, since N(α i )=L(α i )P(α i ) holds for all i∈[n], so we establish a system of equations with k+2e equations and k+2e unknowns, and obtain: Solve the above equations and get a0, a1, ..., a k+e-1 and b0, b1, ..., b e-1 The value of , thereby determining the non-zero polynomial N (X) and the error location polynomial L (X); S157, after determining the aforementioned N (X) and L (X), when Δ (y, (P (α i )) i )≤e, the number of erroneous data fragments is less than or equal to the value e, which can be calculated by Reconstruct the key polynomial P(X) to obtain the key; conversely, Δ(y, (P(α i )) i )>e, the number of erroneous data fragments is greater than the aforementioned e value, and P(X) cannot be reconstructed, and the key cannot be obtained; For the data segment in which an error occurs, an error handling step is performed according to the preset key repair requirements; when executing the error handling step, the accuracy repair step or the functional repair step is selected to complete the key reconstruction; wherein, the data segment repaired by the aforementioned accuracy repair step is exactly the same as the original data segment, and the corresponding function and data segment value are the same; the data segment value repaired by the said functional repair step is different from the original data segment value, but the function achieved is the same.
2. The method according to claim 1, characterized in that The parameters configured in the method include: The number of data segments n, the minimum number of reconstructed segments k, and the secure strong prime number p, and the maximum number of erroneous data segments allowed in n data segments e; The above parameters are all positive integers and satisfy 1≤k≤n≤p-1 and Alternatively, 1≤k≤n≤p-1 and n=k+2e are satisfied simultaneously; wherein the strong prime number p can be selected as a safe prime number whose bit length is greater than or equal to h.
3. The method according to claim 1, wherein After step S110 and before obtaining the key, a key encoding step S120 is also included, as follows: S121: Construct at least one k-1 order key polynomial based on the number of keys to be managed. The coefficients of the key polynomial P(X) are the aforementioned finite field elements Right now Among them, the Representing a finite field The set of all key polynomials P(X) on ; S122, Select a Finite Field The last n distinct non-zero elements As an independent variable, and calculate P(α i ), i∈[n], get n key-value pairs As the encoded n data fragments.
4. The method according to claim 1, wherein Determining whether the key needs to be reconstructed includes executing the reconstruction condition determination step S130 as follows: S131, counting the number of obtained data segments; S132, when the number of obtained data segments is greater than or equal to the minimum number of reconstructed segments k, determining whether the aforementioned collected data segments may contain errors; S133, when the determination is no, executing the error-free reconstruction step; Otherwise, perform the fault-tolerant reconstruction step.
5. The method according to claim 1, wherein When executing the aforementioned step S157, an error handling step S160 can also be executed simultaneously; the error handling step S160 includes an error locating step S161 and an error repairing step S162; After executing the error location step S161 to locate the erroneous data segment, the error repair step S162 is executed to obtain the correct data segment; wherein, the error repair step S162 selects to execute the accuracy repair step S1621 or the functionality repair step S1622 according to the repair requirements of the aforementioned erroneous data segment; wherein, The error location step S161 is configured as follows: locating the data segment where the error occurs by using the aforementioned error location polynomial L(X), detecting the n data segments collected Among them, all α i ∈{L(α i )=0, i∈[n]} are all data fragments with errors; The error repair step S162 is configured as follows: the key polynomial reconstructed by the fault-tolerant reconstruction step Calculate the correct value of the data segment; according to the repair requirements of the data segment, perform the accuracy repair step S1621 or the functionality repair step S1622 in the above error repair step; wherein, The accuracy repair step S1621 refers to the position of the data segment corresponding to the error, that is, α i ∈{L(α i )=0,i∈[n]}restore the original data segment; the functional repair step S1622 refers to selecting the position of the unused data segment Calculate a new And use the new data segment (α j , P(α j )) replaces the erroneous data fragment; wherein, the data fragment that has undergone the functional repair step is a legal data fragment that can be used to reconstruct the key, and the data fragment that has undergone the functional repair step is stored in the node of the government blockchain network.
6. A distributed key management system applicable to a government blockchain network according to the method according to any one of claims 1 to 5, characterized in that: include: Nodes of the government blockchain network are used to store data fragments obtained after key encoding; Smart contracts are used for access control management of key-encoded data fragments and user digital identity management; A system server connected to a node of the government blockchain network; The system server is configured to: deploy at least one smart contract to the government blockchain network, and manage the distributed keys in the government blockchain network through the smart contract, wherein the management performs access control management and digital identity management on the data fragments obtained after the key encoding according to the preset key usage permissions; the management method includes the steps of: obtaining at least one key and processing it; the processing includes constructing at least one key polynomial P(X) for at least one key, and storing at least one data fragment obtained by the aforementioned key polynomial P(X) in a node of the government blockchain network; wherein, before obtaining the key, it also includes a key generation step S110, as follows: S111, using a random number generator or a pseudo-random number generator to generate k keys key0,...,key k-1 , where k is an integer greater than 1; S112, when the k keys have different lengths, select an integer h = max(log2(key0), ..., log2(key k-1 )) is the bit length of the longest key among the k keys; S113, select a secure prime number p with a bit length greater than or equal to h to construct a finite field Make finite field There are p different elements in total And the length of each element is |log2p| bits; S114, map k keys key0,...,key k-1 is a finite field The last k distinct elements Obtain data fragments from the government blockchain network according to the preset key usage authority; when the number of data fragments obtained is greater than or equal to the minimum threshold value allowing reconstruction of the key, determine whether the key needs to be reconstructed; wherein, based on whether the source of the collected data fragments is credible, determine whether the aforementioned collected data fragments may have errors; when there are no errors in the collected data fragments, perform an error-free reconstruction step to obtain the correct key; when at least one of the aforementioned collected data fragments may have errors, perform a fault-tolerant reconstruction step; wherein, when the number of erroneous data fragments is less than or equal to the preset number, the aforementioned fault-tolerant reconstruction step can locate the erroneous data fragments while reconstructing the correct key; the error-free reconstruction step S140 includes: S141, for the n error-free data fragments obtained In the definition of y i =P(α i ), i∈[n] represents all the acquired data segments, and k data segments are randomly selected As input to the error-free reconstruction step; S142, construct k k-1 order polynomials The reconstructed key polynomial is expressed as The coefficients of the key polynomial P(X) are the reconstructed keys; the fault-tolerant reconstruction step S150 includes: S151, for all i∈[n], set P(α i )=y i , y=(y1,...,y n ), get n data fragments S152, construct an e-order non-zero polynomial L(X) and obtain the error location polynomial When the error location polynomial L(X) satisfies L(α i )=0 if and only if y i ≠P(α i ), among the n data segments collected, the α of all the data segments with errors i ∈{y i ≠P(α i )} are all roots of the error locator polynomial L(X); S153, assume that the expansion of the error locator polynomial L(X) is L(X)=b0+b1X 1 +…+b e-1 X e -1 +b e X e , combined with Determine the highest order term X of the above L(X) e The coefficient is b e =1, then determine the remaining e unknown coefficients b0, b1, ..., b in L(X). e-1 , and then determine L(X); S154, construct a k+e-1 order non-zero polynomial N(X) that satisfies y i L(α i )=N(α i ), i∈[n], let the coefficients of N(X) be a0, a1, ..., a k+e-1 , then the expanded form of N(X) is expressed as N(X)=a0+a1X 1 +…+a k+e-1 X k+e-1 , by determining the k+e unknown coefficients a0, a1, ..., a of N(X) k+e-1 , and then determine the expansion of N(X); S155, due to the equation P(α i )=y i holds for all i∈[n], and when y i ≠P(α i ), i∈[n] when L(α i )=0, so y i L(α i )=L(α i )P(α i ) holds for all i∈[n], that is, N(α i )=L(α i )P(α i ) holds for all i∈[n]; S156, since N(α i )=L(α i )P(α i ) holds for all i∈[n], so we establish a system of equations with k+2e equations and k+2e unknowns, and obtain: Solve the above equations and get a0, a1, ..., a k+e-1 and b0, b1, ..., b e-1 The value of , thereby determining the non-zero polynomial N (X) and the error location polynomial L (X); S157, after determining the aforementioned N (X) and L (X), when Δ (y, (P (α i )) i )≤e, the number of erroneous data fragments is less than or equal to the value e, which can be calculated by Reconstruct the key polynomial P(X) to obtain the key; conversely, Δ(y, (P(α i )) i )>e, the number of erroneous data segments is greater than the aforementioned e value, and since P(X) cannot be reconstructed, the key cannot be obtained; for the erroneous data segments, an error handling step is performed according to the preset key repair requirements; when performing the error handling step, either an accuracy repair step or a functionality repair step is selected to complete the key reconstruction; wherein, the data segments repaired by the aforementioned accuracy repair step are exactly the same as the original data segments, and the corresponding functions are the same as the data segment values; the data segments repaired by the functional repair step have different values from the original data segments, but the functions implemented are the same.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Industrial Internet of Things security data sharing method based on block chain
CN116015828A
Key escrow method and system and electronic equipment
CN118199869A