Key sharding method, device, storage medium and electronic device
By using multiple random factor sets to perform lightweight logical operations during the key sharding process, key sharding is generated, and the problems of low computing efficiency and high expansion rate of key sharding in the prior art are solved, and the density is improved The security and computing efficiency of key storage.
Patent Information
- Application Number
- CN202211274355.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-18
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2042-10-18
AI Technical Summary
The prior art has low computing efficiency in calculating key sharding, and the expansion rate of key sharding is high, which increases the transmission bandwidth.
Through multiple random factor sets and the original key, multiple lightweight logical operations are performed, multiple key shards are obtained, and a random factor set is introduced, so that the key storage party cannot obtain the random factor set, even if all keys are stored Fang conspired to recover the original key.
It improves the security of original key storage, reduces the computing power requirements and the size of key shards, and solves the problem of low computing efficiency in the process of calculating key shards.
Smart Images

Figure CN115643013B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of key management, and in particular, to a key sharding method, device, storage medium and electronic device. Background Art
[0002] In the era of network interconnection, for the secure storage or sharing of data, keys are usually used to encrypt data to ensure data security and store keys securely. There is a risk of single point failure in the above process. In other words, if the device storing the key fails or is attacked by the outside world, the key will become unavailable or lost. Therefore, the idea of distributed key storage is more suitable for practical applications.
[0003] At present, most of the existing solutions use additive homomorphic cryptographic algorithms to implement key sharding and distributed storage, dividing the original key into multiple subkeys, encrypting each subkey with the public key of the original key recipient to obtain multiple key shards, which are stored by multiple shard storage devices. After obtaining multiple key shards, the recipient uses the private key to decrypt to obtain multiple subkeys, and the original key is restored by merging the subkeys. However, the process of calculating the key shards in the related art solution requires high algorithm capabilities, takes a long time to calculate, has low calculation efficiency, and has a high expansion rate of the obtained key shards, which increases the transmission bandwidth in the process of transmitting the key shards. Therefore, there is a problem of low calculation efficiency in the process of calculating the key shards in the related art.
[0004] With regard to the problem of low computational efficiency in the process of calculating key shards existing in related technologies, no effective solution has been proposed so far. Summary of the invention
[0005] The embodiments of the present invention provide a key sharding method, device, storage medium and electronic device to at least solve the problem of low computational efficiency in the key sharding process existing in the related art.
[0006] According to one embodiment of the present invention, a key sharding method is provided, comprising: obtaining an original key, wherein the original key includes N original key elements, and N is greater than or equal to 1; obtaining multiple random factor sets, wherein each of the random factor sets includes N random factors; and obtaining a key sharding set of the original key based on the original key and the multiple random factor sets.
[0007] In an exemplary embodiment, obtaining a key shard set of the original key based on the original key and multiple sets of random factors includes: obtaining a preset number of key shards; and obtaining a key shard set of the original key based on the number of key shards, the original key, and multiple sets of random factors.
[0008] In an exemplary embodiment, when the number of key shards is 4, the key shard set of the original key is obtained according to the number of key shards, the original key and the multiple random factor sets, including: performing a first logical operation on a first random factor set and a second random factor set to obtain a first key shard, wherein the multiple random factor sets include the first random factor set and the second random factor set; performing a second logical operation on the first random factor set and the second random factor set to obtain a second key shard; performing a third logical operation on the second random factor set and a target generated key to obtain a third key shard, wherein the target generated key is a key generated according to the original key, the first random factor set and the third random factor set, and the target generated key includes N generated key elements; performing a fourth logical operation on the second random factor set and the target generated key to obtain a fourth key shard; wherein the key shard set includes the first key shard, the second key shard, the third key shard and the fourth key shard.
[0009] In an exemplary embodiment, the obtaining the first key shard by performing a first logical operation on the first random factor set and the second random factor set includes: performing a negation operation on each random factor in the first random factor set to obtain a first conversion factor set; performing an AND operation on each conversion factor in the first conversion factor set and a corresponding random factor in the second random factor set to obtain the first key shard;
[0010] In an exemplary embodiment, the second key shard is obtained by performing a second logical operation on the first random factor set and the second random factor set, including: performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; and performing an AND operation on each conversion factor in the second conversion factor set and the corresponding random factor in the first random factor set to obtain the second key shard.
[0011] In an exemplary embodiment, performing a third logical operation on the second random factor set and the target generated key to obtain a third key shard includes: performing a negation operation on each generated key element in the target generated key to obtain a first transformed key, wherein the first transformed key includes N transformed key elements; performing an AND operation on each transformed key element in the first transformed key and a corresponding random factor in the second random factor set to obtain the third key shard;
[0012] In an exemplary embodiment, a fourth key shard is obtained by performing a fourth logical operation on the second random factor set and the target generation key, including: performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; and performing an AND operation on each conversion factor in the second conversion factor set and the corresponding generation key in the target generation key to obtain the fourth key shard.
[0013] In an exemplary embodiment, when the number of key shards is 2, the key shard set of the original key is obtained according to the number of key shards, the original key and the multiple random factor sets, including: obtaining the fifth key shard by performing a fifth logical operation on the first random factor set and the second random factor set; obtaining the sixth key shard by performing a sixth logical operation on the second random factor set and the target generation key, wherein the target generation key is a key generated according to the original key, the first random factor set and the third random factor set, and the target generation key includes N generation key elements; wherein the key shard set includes the fifth key shard and the sixth key shard.
[0014] In an exemplary embodiment, the obtaining of the fifth key shard by performing a fifth logical operation on the first random factor set and the second random factor set includes: performing a negation operation on each random factor in the first random factor set to obtain a first conversion factor set; performing an AND operation on each conversion factor in the first conversion factor set and a corresponding random factor in the second random factor set to obtain a first target factor set; performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; performing an AND operation on each conversion factor in the second conversion factor set and a corresponding random factor in the first random factor set to obtain a second target factor set; performing an OR operation on each factor in the first target factor set and a corresponding factor in the second target factor set to obtain the fifth key shard;
[0015] In an exemplary embodiment, the sixth logical operation is performed on the second random factor set and the target generation key to obtain the sixth key shard, including: performing a negation operation on each generation key element in the target generation key to obtain a first conversion key, wherein the first conversion key includes N conversion key elements; performing an AND operation on each conversion key element in the first conversion key and a corresponding random factor in the second random factor set to obtain a third target factor set; performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; performing an AND operation on each conversion factor in the second conversion factor set and a corresponding generation key element in the target generation key to obtain a fourth target factor set; performing an OR operation on each factor in the third target factor set and a corresponding factor in the fourth target factor set to obtain the sixth key shard.
[0016] In an exemplary embodiment, the method further includes: performing an XOR operation on each original key element in the original key with a corresponding random factor in the third random factor set to obtain a first generated key, wherein the first generated key includes N generated key elements; performing an XOR operation on each generated key element in the first generated key with a corresponding random factor in the first random factor set to obtain the target generated key.
[0017] According to another embodiment of the present invention, a key recovery method is also provided, comprising: obtaining a key shard set and a third random factor set of an original key, wherein each key shard in the key shard set includes N key shard elements, and the third random factor set includes N random factors; and recovering the original key according to the key shard set and the third random factor set.
[0018] In an exemplary embodiment, when the number of key shards in the key shard set is 4, recovering the original key based on the key shard set and the third random factor set includes: performing an OR operation on each key shard element in the first key shard with a corresponding key shard element in the second key shard to obtain a first converted key shard, wherein the first converted key shard includes N converted key elements; performing an OR operation on each key shard element in the third key shard with a corresponding key shard element in the fourth key shard to obtain a second converted key shard, wherein the second converted key shard includes N converted key elements; performing an XOR operation on each converted key element in the first converted key shard, the corresponding converted key element in the second converted key shard, and the corresponding random factor in the third random factor to obtain the original key; wherein the key shard set includes the first key shard, the second key shard, the third key shard and the fourth key shard.
[0019] In an exemplary embodiment, when the number of key shards in the key shard set is 2, recovering the original key based on the key shard set and the third random factor set includes: performing an XOR operation on each key shard element in the fifth key shard, the corresponding key shard element in the sixth key shard, and the corresponding random factor in the third random factor set to obtain the original key; wherein the key shard set includes the fifth key shard and the sixth key shard.
[0020] According to another embodiment of the present invention, a key sharding device is provided, including: a first acquisition module, used to obtain an original key, wherein the original key includes N original key elements, and N is greater than or equal to 1; a second acquisition module, used to obtain multiple random factor sets, wherein each of the random factor sets includes N random factors; and a sharding module, used to obtain a key sharding set of the original key based on the original key and the multiple random factor sets.
[0021] According to another embodiment of the present invention, a key recovery device is also provided, including: a third acquisition module, used to obtain a key shard set and a third random factor set of an original key, wherein each key shard in the key shard set includes N key shard elements, and the third random factor set includes N random factors; a recovery module, used to recover the original key based on the key shard set and the third random factor set.
[0022] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when run.
[0023] According to yet another embodiment of the present invention, there is provided an electronic device, 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 any one of the above method embodiments.
[0024] Through the present invention, multiple random factor sets are used to perform multiple lightweight logical operations with the original key to obtain multiple key shards, and a random factor set is introduced. The key storage party cannot obtain the random factor set, and even if all key storage parties conspire, the original key cannot be restored, further improving the security of the original key storage, and avoiding the use of complex cryptographic algorithms (such as encrypting the key shards through symmetric encryption) in the process of calculating the key shards, effectively reducing the computing power requirements and the size of the key shards. Therefore, the problem of low computing efficiency in the process of calculating key shards in the related art is solved, thereby achieving the effect of improving the computing efficiency of calculating key shards. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a block diagram of the hardware structure of a mobile terminal according to a key sharding method according to an embodiment of the present invention;
[0026] Figure 2 is a flow chart of a key sharding method according to an embodiment of the present invention;
[0027] Figure 3 Schematic diagram of an optional key sharding system according to an embodiment of the present invention Figure 1 ;
[0028] Figure 4 Schematic diagram of an optional key sharding system according to an embodiment of the present invention Figure 2 ;
[0029] Figure 5 is a flow chart of a key sharding method according to an embodiment of the present invention;
[0030] Figure 6 is a structural block diagram of a key sharding device according to an embodiment of the present invention;
[0031] Figure 7 is a structural block diagram of a key recovery device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0032] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with the embodiments.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0034] 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 mobile terminal as an example, Figure 1 1 is a block diagram of the hardware structure of a mobile terminal according to the key sharding method of an embodiment of the present invention. Figure 1 As shown, the mobile 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 mobile terminal may also include a transmission device 106 and an input / 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 mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0035] 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 key sharding method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. 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 may be connected to the mobile 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 combinations thereof.
[0036] 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 the mobile 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.
[0037] In this embodiment, a key sharding method is provided. Figure 2 is a flow chart of a key sharding method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0038] Step S202, obtaining an original key, wherein the original key includes N original key elements, where N is greater than or equal to 1;
[0039] Step S204, obtaining a plurality of random factor sets, wherein each of the random factor sets includes N random factors;
[0040] Step S206: Obtain a key shard set of the original key according to the original key and the multiple sets of random factors.
[0041] In this embodiment, the above method is applied to a key distributor, and the key distributor converts the original key into a key shard set according to a plurality of random factor sets, wherein the key shard set includes a plurality of key shards, and the plurality of key shards are respectively sent to corresponding key storage parties, and the key storage parties store the key shards. For example, the key shard set includes a first key shard, a second key shard, a third key shard, and a fourth key shard, and the first key shard is sent to a first key storage party, the second key shard is sent to a second key storage party, the third key shard is sent to a third key storage party, and the fourth key shard is sent to a fourth key storage party.
[0042] The original key is a plaintext key, N is the length of the original key, and the original key contains N original key elements. The original key can be converted into a base form, such as binary, hexadecimal, etc., and cached in an array. The array form of the original key is Arry0 = {a1, a2...a i ……a n}, where a iRepresents the ith original key element in the original key, where. For example, if the original key is 123456789, the length of the original key is 9, and the original key contains 9 elements, namely 1, 2, 3, 4, 5, 6, 7, 8, 9. These 9 elements are converted into hexadecimal and cached in the array Arry0 = {1, 2, 3, 4, 5, 6, 7, 8, 9}. The elements in the array Arry0 are recorded as the original key elements.
[0043] The number of random factors in a random factor set is consistent with the number of original key elements in the original key, including N random factors. The key distributor randomly generates a string of numbers whose length is consistent with the original key, converts the string of numbers into a base form, such as binary or hexadecimal, and caches it in an array. The array is a random factor set, and each element in the array is a random factor.
[0044] By performing multiple lightweight logical operations on multiple random factor sets generated by the key distributor and the original key, multiple key shards are generated, so that the data of the original key is stored in multiple key shards respectively. An original key can be distributedly stored through multiple key shards.
[0045] Through the above steps, multiple random factor sets and the original key perform multiple lightweight logical operations to obtain multiple key shards. The random factor set is introduced, and the key storage party cannot obtain the random factor set. Even if all key storage parties conspire, the original key cannot be restored, which further improves the security of the original key storage. In the process of calculating the key shards, the use of complex cryptographic algorithms (such as encrypting the key shards through symmetric encryption) is avoided, which effectively reduces the computing power requirements and the size of the key shards. The problem of low computing efficiency in the process of calculating key shards in the related technology is solved, and the computing efficiency is improved.
[0046] In an optional embodiment, obtaining a key shard set of the original key based on the original key and multiple sets of random factors includes: obtaining a preset number of key shards; and obtaining a key shard set of the original key based on the number of key shards, the original key, and multiple sets of random factors.
[0047] In this embodiment, before sharding the original key, the number of key shards must first be determined. The number of key shards represents how many key shards the original key is to be divided into. The number of key shards is set according to the number of key storage parties, that is, if the number of key storage parties is 4, the number of key shards is set to 4, and if the number of key storage parties is 3, the number of key shards is set to 3. A key shard set of the original key is obtained according to the number of key shards, the original key, and a plurality of random factor sets. The number of key shards in the key shard set is equal to the preset number of key shards.
[0048] When the preset number of key shards is 4, the finally generated key shard set includes 4 key shards, namely, the first key shard, the second key shard, the third key shard and the fourth key shard. Figure 3 Schematic diagram of an optional key sharding system according to an embodiment of the present invention Figure 1 ,like Figure 3 As shown, it includes: a key distributor, four key storage parties, and a key recovery party. The key distributor is used to generate a key shard set of the original key, and send the key shards in the key shard set to the corresponding key storage parties respectively, that is, the key shard set includes the first key shard, the second key shard, the third key shard, and the fourth key shard. The first key shard is sent to the first key storage party, the second key shard is sent to the second key storage party, the third key shard is sent to the third key storage party, and the fourth key shard is sent to the fourth key storage party. The key recovery party is used to recover the original key. In actual applications, the key distributor can also be the key recovery party.
[0049] When the preset number of key shards is 2, the finally generated key shard set includes 2 key shards, namely, the fifth key shard and the sixth key shard. Figure 4 Schematic diagram of an optional key sharding system according to an embodiment of the present invention Figure 2 ,like Figure 4 As shown, it includes: a key distributor, two key storage parties, and a key recovery party. The key distributor is used to generate a key shard set of the original key, send the key shards in the key shard set to the corresponding key storage parties, send the fifth key shard to the fifth key storage party, and send the sixth key shard to the sixth key storage party. The key recovery party is used to recover the original key. In actual applications, the key distributor can also be the key recovery party.
[0050] In an optional embodiment, when the number of key shards is 4, the key shard set of the original key is obtained according to the number of key shards, the original key and the multiple random factor sets, including: performing a first logical operation on a first random factor set and a second random factor set to obtain a first key shard, wherein the multiple random factor sets include the first random factor set and the second random factor set; performing a second logical operation on the first random factor set and the second random factor set to obtain a second key shard; performing a third logical operation on the second random factor set and a target generated key to obtain a third key shard, wherein the target generated key is a key generated according to the original key, the first random factor set and the third random factor set, and the target generated key includes N generated key elements; performing a fourth logical operation on the second random factor set and the target generated key to obtain a fourth key shard; wherein the key shard set includes the first key shard, the second key shard, the third key shard and the fourth key shard.
[0051] In this embodiment, when the number of preset key shards is different, the method of generating the key shard set is also different.
[0052] Among them, the logical operations for calculating each key shard are different. The first key shard is obtained by performing a first logical operation on a first random factor set and a second random factor set; the second key shard is obtained by performing a second logical operation on the first random factor set and a second random factor set.
[0053] Before calculating the third key shard and the fourth key shard, first calculate a target generation key, where the target generation key is generated according to the original key, the first random factor set, and the third random factor set, and perform an XOR operation on each original key element in the original key, a random factor corresponding to the first random factor set, and a random factor corresponding to the third random factor set to obtain the target generation key;
[0054] The third key shard is obtained by performing a third logical operation on the second random factor set and the target generation key, and the fourth key shard is obtained by performing a fourth logical operation on the second random factor set and the target generation key.
[0055] For example, the original key is Arry0 = {a1, a2...a i ……a n}, the first random factor set Arry1 = {b1, b2...b i ……b n}, b irepresents the i-th random factor in the first random factor set, and the second random factor set Arry2 = {c1, c2...c i ……c n},c i represents the i-th random factor in the second random factor set, and the third random factor set Arry3 = {d1, d2 ... d i ……d n}, d i represents the i-th random factor in the third set of random factors.
[0056] The target generation key is obtained by performing an XOR operation on each original key element in the original key, the random factor corresponding to the first random factor set, and the random factor corresponding to the third random factor set. The target generation key is Arry4 = {e1, e2 ... e i ……e n}, then Arry4=Arry0^Arry1^Arry3={e1,e2...e i ……e n}, where e i =a i ^b i ^d i , e i Represents the i-th generated key element in the target generated key, and “^” represents an OR and operation.
[0057] The first random factor set, the second random factor set and the third random factor set are all random factor sets in the above-mentioned multiple random factor sets.
[0058] In an optional embodiment, the obtaining the first key shard by performing a first logical operation on the first random factor set and the second random factor set includes: performing a negation operation on each random factor in the first random factor set to obtain a first conversion factor set; performing an AND operation on each conversion factor in the first conversion factor set and a corresponding random factor in the second random factor set to obtain the first key shard;
[0059] In this embodiment, the first key shard is obtained by performing a first logical operation on the first random factor set and the second random factor set. The first logical operation includes: inverting each random factor in the first random factor set to obtain a first conversion factor set, expressed as ~Arry1={~b1,~b2……~b i ...~b n}, where ~b i represents the i-th conversion factor in the first conversion factor set, and “~” represents the negation operation;
[0060] Each conversion factor in the first conversion factor set is ANDed with the corresponding random factor in the second random factor set to obtain the first key shard. The first key shard is represented by S1=~Arry1&Arry2={~b1&c1,~b2&c2…~b i &c i ...~b n &c n}={f1,f2……f i ……f n}, where f i represents the i-th key shard element in the first key shard, f i =~bi&ci.
[0061] In an optional embodiment, the second key shard is obtained by performing a second logical operation on the first random factor set and the second random factor set, including: performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; and performing an AND operation on each conversion factor in the second conversion factor set and the corresponding random factor in the first random factor set to obtain the second key shard.
[0062] In this embodiment, the second key shard is obtained by performing a second logical operation on the first random factor set and the second random factor set, and the second logical operation includes: inverting each random factor in the second random factor set to obtain a second conversion factor set, expressed as ~Arry2={~c1,~c2...~c i ...~c n}, where ~c i represents the i-th conversion factor in the second conversion factor set, and “~” represents a negation operation;
[0063] Each conversion factor in the second conversion factor set is ANDed with the corresponding random factor in the first random factor set to obtain the second key shard. The second key shard is represented by S2=Arry1&~Arry2={b1&~c1,b2&~c2…b i &~c i ……b n &~c n}={g1,g2……g i ……g n}, where g i represents the i-th key shard element in the second key shard, g i =bi&~ci, “&” represents the AND operation.
[0064] In an optional embodiment, performing a third logical operation on the second random factor set and the target generated key to obtain a third key shard includes: performing a negation operation on each generated key element in the target generated key to obtain a first converted key, wherein the first converted key includes N converted key elements; performing an AND operation on each converted key element in the first converted key and a corresponding random factor in the second random factor set to obtain the third key shard;
[0065] In this embodiment, the third key shard is obtained by performing a third logical operation on the target generation key and the second random factor set. The third logical operation includes: inverting each generation key element in the above target generation key to obtain a first conversion key. The first conversion key is represented by ~Arry4={~e1,~e2……~e i ……~e n}, where ~e i represents the i-th conversion key element in the first conversion key, and "~" represents the negation operation;
[0066] Each conversion key element in the first conversion key is ANDed with the corresponding random factor in the second random factor set to obtain a third key shard. The third key shard is represented by S3=~Arry4&Arry2={~e1&c1,~e2&c2……~e i &c i ……~e n &c n}={h1,h2……h i ……h n}, where h i represents the i-th key shard element in the third key shard, g i =~e i &c i .
[0067] In an optional embodiment, a fourth key shard is obtained by performing a fourth logical operation on the second random factor set and the target generation key, including: performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; and performing an AND operation on each conversion factor in the second conversion factor set and the corresponding generation key in the target generation key to obtain the fourth key shard.
[0068] In this embodiment, the fourth key fragment is obtained by performing a fourth logical operation on the target generation key and the second random factor set, and the fourth logical operation includes: inverting each random factor in the second random factor set to obtain a second conversion factor set, expressed as ~Arry2={~c1,~c2...~c i ...~cn}, where ~c i represents the i-th conversion factor in the second conversion factor set, and “~” represents a negation operation;
[0069] Each conversion factor in the second conversion factor set is ANDed with the corresponding generation key in the target generation key to obtain a fourth key shard. The fourth key shard is represented by S4=Arry4&~Arry2={e1&~c1,e2&~c2……e i &~c i ……e n &~c n}={l1,l2……l i …… n}, where l i represents the i-th key shard element in the third key shard, l i =e i &~c i .
[0070] In an optional embodiment, when the number of key shards is 2, the key shard set of the original key is obtained according to the number of key shards, the original key and the multiple random factor sets, including: performing a fifth logical operation on the first random factor set and the second random factor set to obtain a fifth key shard; performing a sixth logical operation on the second random factor set and the target generation key to obtain a sixth key shard, wherein the target generation key is a key generated according to the original key, the first random factor set and the third random factor set, and the target generation key includes N generation key elements; wherein the key shard set includes the fifth key shard and the sixth key shard.
[0071] In this embodiment, when the preset number of key shards is 2, the finally generated key shard set includes 2 key shards, namely, the fifth key shard and the sixth key shard.
[0072] Among them, the logical operations for calculating each key shard are different. The fifth key shard is obtained by performing the fifth logical operation on the first random factor set and the second random factor set; the sixth key shard is obtained by performing the sixth logical operation on the second random factor set and the target generated key.
[0073] In an optional embodiment, the obtaining the fifth key shard by performing a fifth logical operation on the first random factor set and the second random factor set includes: performing a negation operation on each random factor in the first random factor set to obtain a first conversion factor set; performing an AND operation on each conversion factor in the first conversion factor set and a corresponding random factor in the second random factor set to obtain a first target factor set; performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; performing an AND operation on each conversion factor in the second conversion factor set and a corresponding random factor in the first random factor set to obtain a second target factor set; performing an OR operation on each factor in the first target factor set and a corresponding factor in the second target factor set to obtain the fifth key shard;
[0074] In this embodiment, the fifth key shard is obtained by performing a fifth logical operation on the first random factor set and the second random factor. The fifth logical operation includes: inverting each random factor in the first random factor set to obtain a first conversion factor set. The first conversion factor set is represented by ~Arry1={~b1,~b2……~b i ...~b n}, where ~b i represents the i-th conversion factor in the first conversion factor set, and “~” represents a negation operation; each conversion factor of the first conversion factor set is ANDed with the corresponding random factor in the second random factor set to obtain a first target factor set, which is represented by:
[0075] ~Arry1&Arry2={~b1&c1,~b2&c2......~b i &c i ...~b n &c n};
[0076] Among them, ~b i &c i represents the i-th factor in the first target factor set;
[0077] Each random factor in the second random factor set is inverted to obtain a second conversion factor set, which is expressed as ~Arry2={~c1,~c2……~c i ...~c n}, where ~c i represents the i-th conversion factor in the second conversion factor set, and “~” represents a negation operation; each conversion factor in the second conversion factor set is ANDed with the corresponding random factor in the first random factor set to obtain a second target factor set, which is expressed as:
[0078] Arry1&~Arry2={b1&~c1,b2&~c2……b i &~c i ……b n &~c n};
[0079] Among them, b i &~c i represents the i-th factor in the second target factor set;
[0080] Each factor in the first target factor set is ORed with the corresponding factor in the second target factor set to obtain the fifth key shard. The second key shard is represented by S5=(~Arry1&Arry2)|(Arry1&~Arry2)={(~b1&c1)|(b1&~c1),(~b2&c2)|(b2&~c2),……(~b i &c i )|(b i &~c i ),……(~b n &c n )|(b n &~c n )}={x1,x2……x i ……x n}, where x i represents the i-th key shard element in the fifth key shard, x i =(~b i &c i )|(b i &~c i ).
[0081] In an optional embodiment, the sixth logical operation is performed on the second random factor set and the target generation key to obtain the sixth key shard, including: performing a negation operation on each generation key element in the target generation key to obtain a first conversion key, wherein the first conversion key includes N conversion key elements; performing an AND operation on each conversion key element in the first conversion key and a corresponding random factor in the second random factor set to obtain a third target factor set; performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; performing an AND operation on each conversion factor in the second conversion factor set and a corresponding generation key element in the target generation key to obtain a fourth target factor set; performing an OR operation on each factor in the third target factor set and a corresponding factor in the fourth target factor set to obtain the sixth key shard.
[0082] In this embodiment, the sixth key fragment is obtained by performing a sixth logical operation on the target generation key and the second random factor, and the sixth logical operation includes: performing a negation operation on each generation key element in the target generation key to obtain a first conversion key, and the first conversion key is expressed as ~Arry4={~e1,~e2……~e i ……~e n}, where ~e i represents the i-th conversion key element in the first conversion key, and “~” represents a negation operation; each conversion key element in the first conversion key is ANDed with the corresponding random factor in the second random factor set to obtain a third target factor set, which is expressed as:
[0083] ~Arry4&Arry2={~e1&c1,~e2&c2...~e i &c i ……~e n &c n};
[0084] Among them, ~e i &c i represents the i-th factor in the third target factor set;
[0085] Each random factor in the second random factor set is inverted to obtain a second conversion factor set, which is expressed as ~Arry2={~c1,~c2……~c i ...~c n}, where ~c i represents the i-th conversion factor in the second conversion factor set, and “~” represents a negation operation; each conversion factor in the second conversion factor set is ANDed with the corresponding generation key element in the target generation key to obtain a fourth target factor set, which is represented by:
[0086] Arry4&~Arry2={e1&~c1,e2&~c2……e i &~c i ……e n &~c n};
[0087] Among them, e i &~c i represents the i-th factor in the fourth target factor set;
[0088] Each factor in the third target factor set is ORed with the corresponding factor in the fourth target factor set to obtain the sixth key shard. The second key shard is represented by S6=(~Arry4&Arry2)|(Arry4&~Arry2)={(~e1&c1)|(e1&~c1),(~e2&c2)|(e2&~c2),……(~e i &c i )|(e i &~c i )……(~e n &c n )|(e n &~c n )}={y1,y2……y i ……y n}, where y i represents the i-th key shard element in the sixth key shard, y i =(~e i &c i )|(e i &~c i ), “|” represents the OR operation.
[0089] In an optional embodiment, the method further includes: performing an XOR operation on each original key element in the original key with a corresponding random factor in the third random factor set to obtain a first generated key, wherein the first generated key includes N generated key elements; performing an XOR operation on each generated key element in the first generated key with a corresponding random factor in the first random factor set to obtain the target generated key.
[0090] In this embodiment, the first generated key is obtained by performing an XOR operation on each original key element in the original key and the corresponding random factor in the third random factor set. The first generated key is represented by Arry0^Arry3={a1^d1,a2^d2...a i ^d i ……a n ^d n}, where a i ^d i represents the i-th generated key element in the first generated key;
[0091] Perform an XOR operation on each generated key element in the first generated key and the corresponding random factor in the first random factor set to obtain a target generated key, where the target generated key is represented by Arry4=Arry0^Arry3^Arry1={a1^d1^b1,a2^d2^b2...a i ^d i ^b i……a n ^d n ^b n}={e1,e2……e i ……e n}, where e i represents the i-th generated key element in the target generated key, e i =a i ^d i ^b i .
[0092] Due to the commutative law of XOR operation, the target generated key can be expressed as:
[0093] Arry4={e1,e2……e i ……e n}={a1^b1^d1,a2^b2^d2……a i ^b i ^d i ……a n ^b n ^d n}, then Arry4=Arry0^Arry1^Arry3={e1,e2...e i ……e n}, where e i =a i ^b i ^d i , e i Represents the i-th generation key element in the target generation key, and “^” represents an exclusive OR operation.
[0094] Optionally, after the key distributor obtains the key shard set of the original key, the key shards in the key shard set are sent to the corresponding key storage parties respectively, and the key storage parties save the key shards. Then, the third random factor set in the multiple random factor sets is saved in the key distributor, and the first random factor set, the second random factor set and other process parameters are cleared.
[0095] Optionally, the key shards in the key shard set obtained by the key distributor through the above method are obtained through lightweight XOR, OR, AND, and negation operations. Therefore, the obtained key shards are small in size, easy to transmit, and have low security requirements for key storage devices. They do not require dedicated hardware (such as advanced cryptographic machines) for storage and are easier to store.
[0096] According to another embodiment of the present invention, a key recovery method is also provided. Figure 5 is a flow chart of a key sharding method according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0097] Step 502: Obtain a key shard set and a third random factor set of the original key, wherein each key shard in the key shard set includes N key shard elements, and the third random factor set includes N random factors;
[0098] Step 504: Recover the original key according to the key shard set and the third random factor set.
[0099] In this embodiment, the key shards in the key shard set are obtained by processing the original key using the key sharding method in the above embodiment and are stored in multiple key storage parties. When the original key needs to be restored, the key recovery party obtains the key shards corresponding to the original key stored in each key storage party to obtain the key shard set.
[0100] For example, the key distribution party divides the original key into a fifth key fragment and a sixth key fragment, sends the fifth key fragment to the fifth key storage party, and sends the sixth key fragment to the sixth key storage party. The key recovery party obtains the fifth key fragment from the fifth key storage party and the sixth key fragment from the sixth key storage party respectively, and obtains a key fragment set, that is, the key fragment set includes the fifth key fragment and the sixth key fragment.
[0101] After sharding, the key distributor sends the key shards in the key shard set to the corresponding key storage party, which saves the key shards, and then saves the third random factor set in the multiple random factor sets in the key distributor, and clears the first random factor set and the second random factor set and other process parameters. When restoring the original key, the key recovery party needs to obtain the third random factor set saved by the key distributor.
[0102] The original key can be recovered through the key shard set and the third random factor set. When obtaining the key shard set and the third random factor set, the key recovery party needs to be authenticated and authorized.
[0103] Through the above steps, the original key can be quickly restored through the key shard set and the third random factor set. Since the third random factor set of the key distributor needs to participate in the recovery process, the original key cannot be restored even if the key storage parties collude, thereby improving the security of the system.
[0104] In an optional embodiment, when the number of key shards in the key shard set is 4, recovering the original key according to the key shard set and the third random factor set includes: performing an OR operation on each key shard element in the first key shard with a corresponding key shard element in the second key shard to obtain a first converted key shard, wherein the first converted key shard includes N converted key elements; performing an OR operation on each key shard element in the third key shard with a corresponding key shard element in the fourth key shard to obtain a second converted key shard, wherein the second converted key shard includes N converted key elements; performing an XOR operation on each converted key element in the first converted key shard, the corresponding converted key element in the second converted key shard, and the corresponding random factor in the third random factor set to obtain the original key; wherein the key shard set includes the first key shard, the second key shard, the third key shard and the fourth key shard.
[0105] In this embodiment, different recovery methods are selected according to the number of key shards in the key shard set. When the number of key shards in the key shard set is 4, the key shard set includes a first key shard, a second key shard, a third key shard and a fourth key shard.
[0106] The first key shard is:
[0107] S1={f1,f2……f i ……f n}={~b1&c1,~b2&c2……~b i &c i ...~b n &c n};
[0108] The second key shard is:
[0109] S2={g1,g2……g i ……g n}={b1&~c1,b2&~c2……b i &~c i ……b n &~c n}={g1,g2……g i ……g n};
[0110] The third key shard is:
[0111] S3={h1,h2……h i ……h n}={~e1&c1,~e2&c2……~ei &c i ……~e n &c n};
[0112] The fourth key shard is:
[0113] S4={l1,l2……l i …… n}={e1&~c1,e2&~c2……e i &~c i ……e n &~c n};
[0114] Each key shard element in the first key shard is ORed with the corresponding key shard element in the second key shard to obtain a first transformed key shard, which is represented by:
[0115] S1|S2={f1|g1,f2|g2……f i |g i ……f n |g n}={(~b1&c1)|(b1&~c1),(~b2&c2)|(b2&~c2),……(~b i &c i )|(b i &~c i ),……(~b n &c n )|(b n &~c n )}, where f i |g i is the i-th key shard element in the first transformed key shard, f i |g i =(~b i &c i )|(b i &~c i );
[0116] Each key shard element in the third key shard is ORed with the corresponding key shard element in the fourth key shard to obtain a second transformed key shard, which is expressed as:
[0117] S3|S4={h1|l1,h2|l2……h i |l i ……h n |l n}={(~e1&c1)|(e1&~c1),(~e2&c2)|(e2&~c2),……(~ei &c i )|(e i &~c i ),……(~e n &c n )|(e n &~c n )}, where h i |l i is the i-th key shard element in the second transformed key shard, h i |l i =(~e i &c i )|(e i &~c i );
[0118] Each conversion key element in the first conversion key slice, the corresponding conversion key element in the second conversion key slice, and the corresponding random factor in the third random factor set are XORed to obtain the original key, where the third random factor set is Arry3 = {d1, d2 ... d i ……d n}, the original key is expressed as Key = (S1|S2)^(S3|S4)^Arry3 = {((~b1&c1)|(b1&~c1))^((~e1&c1)|(e1&~c1))^d1, ..., ((~b i &c i )|(b i &~c i ))^((~e i &c i )|(e i &~c i ))^d2,……,((~b n &c n )|(b n &~c n ))^((~e n &c n )|(e n &~c n ))^d1}.
[0119] Known mathematical principles make the following equation true: A^B = ((~A&R)|(A&~R))^((~B&R)|(B&~R)), where A, B, and R are positive integers.
[0120] From the above equation, we can deduce that ((~b i &c i )|(b i &~c i ))^((~e i&c i )|(e i &~c i ))=b i ^e i , then the original key is expressed as Key = {b1^e1^d1, b2^e2^d2...bi^e i ^d i ……b n ^e n ^d n}.
[0121] During the sharding process i represents the i-th generated key element in the target generated key, e i =a i ^b i ^d i =a i ^d i ^b i .
[0122] Known mathematical principle: When A^B=C, the following equation holds: A=C^B=B^C, and A, B, and C are positive integers.
[0123] Then in e i =a i ^d i ^b i In the case of i ^d i =d i ^b i ^e i =a i , then the original key is expressed as Key = {a1, a2...a i ……a n}=Arry0, the original key is restored.
[0124] In an optional embodiment, when the number of key shards in the key shard set is 2, recovering the original key based on the key shard set and the third random factor set includes: performing an XOR operation on each key shard element in the fifth key shard, the corresponding key shard element in the sixth key shard, and the corresponding random factor in the third random factor set to obtain the original key; wherein the key shard set includes the fifth key shard and the sixth key shard.
[0125] In this embodiment, the fifth key fragment is:
[0126] S5=={x1,x2……x i ……x n}={(~b1&c1)|(b1&~c1),(~b2&c2)|(b2&~c2),……(~b i &c i )|(b i &~c i ),……(~b n &c n )|(b n &~c n )};
[0127] The sixth key fragment is:
[0128] S6={y1,y2……y i ……y n}={(~e1&c1)|(e1&~c1),(~e2&c2)|(e2&~c2),……(~e i &c i )|(e i &~c i )……(~e n &c n )|(e n &~c n )};
[0129] Each key shard element in the fifth key shard, the corresponding key shard element in the sixth key shard, and the corresponding random factor in the third random factor set are XORed to obtain the original key, where the third random factor set is Arry3 = {d1, d2 ... d i ……d n}, the original key is expressed as Key = S5^S6^Arry3 = {((~b1&c1)|(b1&~c1))^((~e1&c1)|(e1&~c1))^d1, ..., ((~b i &c i )|(b i &~c i ))^((~e i &c i )|(e i &~c i ))^d2,……,((~b n &c n )|(b n &~c n ))^((~e n &c n )|(e n &~c n ))^d1}.
[0130] Known mathematical principles make the following equation true: A^B = ((~A&R)|(A&~R))^((~B&R)|(B&~R)), where A, B, and R are positive integers.
[0131] From the above equation, we can deduce that ((~b i &c i )|(b i &~c i ))^((~e i &c i )|(e i &~c i ))=b i ^e i , then the original key is expressed as Key = {b1^e1^d1, b2^e2^d2...bi^e i ^d i ……b n ^e n ^d n}.
[0132] During the sharding process i represents the i-th generated key element in the target generated key, e i =a i ^b i ^d i =a i ^d i ^b i .
[0133] Known mathematical principle: When A^B=C, the following equation holds: A=C^B=B^C, and A, B, and C are positive integers.
[0134] Then in e i =a i ^d i ^b i In the case of i ^d i =d i ^b i ^e i =a i , then the original key is expressed as Key = {a1, a2...a i ……a n}=Arry0, the original key is restored.
[0135] 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 can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, 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, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0136] In this embodiment, a key sharding device is also provided. Figure 6 is a structural block diagram of a key sharding device according to an embodiment of the present invention, such as Figure 6 As shown, the device comprises:
[0137] A first acquisition module 602 is used to acquire an original key, wherein the original key includes N original key elements, where N is greater than or equal to 1;
[0138] A second acquisition module 604 is used to acquire multiple random factor sets, wherein each of the random factor sets includes N random factors;
[0139] The sharding module 606 is configured to obtain a key sharding set of the original key according to the original key and a plurality of the random factor sets.
[0140] In an optional embodiment, the sharding module is further used to obtain a preset number of key shards; and obtain a key shard set of the original key according to the number of key shards, the original key and a plurality of random factor sets.
[0141] In an optional embodiment, the sharding module is also used to, when the number of key shards is 4, perform a first logical operation on a first random factor set and a second random factor set to obtain a first key shard, wherein the multiple random factor sets include the first random factor set and the second random factor set; perform a second logical operation on the first random factor set and the second random factor set to obtain a second key shard; perform a third logical operation on the second random factor set and a target generation key to obtain a third key shard, wherein the target generation key is a key generated based on the original key, the first random factor set, and the third random factor set, and the target generation key includes N generation key elements; perform a fourth logical operation on the second random factor set and the target generation key to obtain a fourth key shard; wherein the key shard set includes the first key shard, the second key shard, the third key shard, and the fourth key shard.
[0142] In an optional embodiment, the sharding module is further used to perform a negation operation on each random factor in the first random factor set to obtain a first conversion factor set; perform an AND operation on each conversion factor in the first conversion factor set and a corresponding random factor in the second random factor set to obtain the first key shard;
[0143] In an optional embodiment, the sharding module is further used to perform a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; and perform an AND operation on each conversion factor in the second conversion factor set and the corresponding random factor in the first random factor set to obtain the second key shard.
[0144] In an optional embodiment, the sharding module is further used to perform a negation operation on each generated key element in the target generated key to obtain a first converted key, wherein the first converted key includes N converted key elements; and perform an AND operation on each converted key element in the first converted key and a corresponding random factor in the second random factor set to obtain the third key shard;
[0145] In an optional embodiment, the above-mentioned sharding module is also used to perform a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; and perform an AND operation on each conversion factor in the second conversion factor set and the corresponding generation key in the target generation key to obtain the fourth key shard.
[0146] In an optional embodiment, the above-mentioned sharding module is also used to, when the number of key shards is 2, perform a fifth logical operation on the first random factor set and the second random factor set to obtain a fifth key shard; perform a sixth logical operation on the second random factor set and the target generation key to obtain a sixth key shard, wherein the target generation key is a key generated based on the original key, the first random factor set, and the third random factor set, and the target generation key includes N generation key elements; wherein the key shard set includes the fifth key shard and the sixth key shard.
[0147] In an optional embodiment, the sharding module is further used to perform a negation operation on each random factor in the first random factor set to obtain a first conversion factor set; perform an AND operation on each conversion factor in the first conversion factor set and a corresponding random factor in the second random factor set to obtain a first target factor set; perform a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; perform an AND operation on each conversion factor in the second conversion factor set and a corresponding random factor in the first random factor set to obtain a second target factor set; perform an OR operation on each factor in the first target factor set and a corresponding factor in the second target factor set to obtain the fifth key shard;
[0148] In an optional embodiment, the above-mentioned sharding module is also used to perform a negation operation on each generation key element in the target generation key to obtain a first conversion key, wherein the first conversion key includes N conversion key elements; perform an AND operation on each conversion key element in the first conversion key and the corresponding random factor in the second random factor set to obtain a third target factor set; perform a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; perform an AND operation on each conversion factor in the second conversion factor set and the corresponding generation key element in the target generation key to obtain a fourth target factor set; perform an OR operation on each factor in the third target factor set and the corresponding factor in the fourth target factor set to obtain the sixth key shard.
[0149] In an optional embodiment, the sharding module is further used to perform an XOR operation on each original key element in the original key with a corresponding random factor in the third random factor set to obtain a first generated key, wherein the first generated key includes N generated key elements; and perform an XOR operation on each generated key element in the first generated key with a corresponding random factor in the first random factor set to obtain the target generated key.
[0150] In this embodiment, a key sharding device is also provided. Figure 7 is a structural block diagram of a key recovery device according to an embodiment of the present invention. Figure 7 As shown, the device comprises:
[0151] A third acquisition module 702 is configured to acquire a key shard set and a third random factor set of the original key, wherein each key shard in the key shard set includes N key shard elements, and the third random factor set includes N random factors;
[0152] The recovery module 704 is used to recover the original key according to the key shard set and the third random factor set.
[0153] In an optional embodiment, the above-mentioned recovery module is also used to, when the number of key shards in the key shard set is 4, perform an OR operation on each key shard element in the first key shard with the corresponding key shard element in the second key shard to obtain a first converted key shard, wherein the first converted key shard includes N converted key elements; perform an OR operation on each key shard element in the third key shard with the corresponding key shard element in the fourth key shard to obtain a second converted key shard, wherein the second converted key shard includes N converted key elements; perform an XOR operation on each converted key element in the first converted key shard, the corresponding converted key element in the second converted key shard, and the corresponding random factor in the third random factor to obtain the original key; wherein the key shard set includes the first key shard, the second key shard, the third key shard and the fourth key shard.
[0154] In an optional embodiment, the above-mentioned recovery module is also used to perform an XOR operation on each key shard element in the fifth key shard, the corresponding key shard element in the sixth key shard, and the corresponding random factor in the third random factor set to obtain the original key when the number of key shards in the key shard set is 2; wherein the key shard set includes the fifth key shard and the sixth key shard.
[0155] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0156] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0157] 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.
[0158] An embodiment of the present invention 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 any one of the above method embodiments.
[0159] 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.
[0160] 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.
[0161] Obviously, those skilled in the art should understand that the above modules or steps of the present invention 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 than here, 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 invention is not limited to any specific combination of hardware and software.
[0162] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A key sharding method, characterized in that: include: Obtaining an original key, wherein the original key includes N original key elements, where N is greater than or equal to 1; Acquire multiple random factor sets, wherein each of the random factor sets includes N random factors; Get the preset number of key shards; A logical operation is performed on the original key and the set of random factors according to the number of key shards to obtain a set of key shards of the original key.
2. The method according to claim 1, characterized in that When the number of key shards is 4, a logical operation is performed on the original key and the set of random factors to obtain a set of key shards of the original key, including: Obtaining a first key shard by performing a first logical operation on a first random factor set and a second random factor set, wherein the plurality of random factor sets include the first random factor set and the second random factor set; Obtaining a second key shard by performing a second logical operation on the first set of random factors and the second set of random factors; performing a third logical operation on the second random factor set and a target generated key to obtain a third key shard, wherein the target generated key is a key generated according to the original key, the first random factor set, and the third random factor set, and the target generated key includes N generated key elements; Performing a fourth logical operation on the second random factor set and the target generated key to obtain a fourth key shard; The key shard set includes the first key shard, the second key shard, the third key shard and the fourth key shard.
3. The method according to claim 2, characterized in that The obtaining of the first key shard by performing a first logical operation on the first random factor set and the second random factor set comprises: performing a negation operation on each random factor in the first random factor set to obtain a first conversion factor set; performing an AND operation on each conversion factor in the first conversion factor set and a corresponding random factor in the second random factor set to obtain the first key shard; The second key shard is obtained by performing a second logical operation on the first random factor set and the second random factor set, including: performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; and performing an AND operation on each conversion factor in the second conversion factor set and the corresponding random factor in the first random factor set to obtain the second key shard.
4. The method according to claim 2, characterized in that: Performing a third logical operation on the second random factor set and the target generated key to obtain a third key shard, including: performing a negation operation on each generated key element in the target generated key to obtain a first transformed key, wherein the first transformed key includes N transformed key elements; performing an AND operation on each transformed key element in the first transformed key and a corresponding random factor in the second random factor set to obtain the third key shard; A fourth key shard is obtained by performing a fourth logical operation on the second random factor set and the target generation key, including: performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; and performing an AND operation on each conversion factor in the second conversion factor set and the corresponding generation key in the target generation key to obtain the fourth key shard.
5. The method according to claim 1, characterized in that When the number of key shards is 2, a logical operation is performed on the original key and the set of random factors to obtain a set of key shards of the original key, including: Performing a fifth logical operation on the first set of random factors and the second set of random factors to obtain a fifth key shard; performing a sixth logical operation on the second random factor set and a target generated key to obtain a sixth key shard, wherein the target generated key is a key generated according to the original key, the first random factor set, and the third random factor set, and the target generated key includes N generated key elements; The key shard set includes the fifth key shard and the sixth key shard.
6. The method according to claim 5, characterized in that The obtaining of the fifth key shard by performing a fifth logical operation on the first random factor set and the second random factor set comprises: performing a negation operation on each random factor in the first random factor set to obtain a first conversion factor set; performing an AND operation on each conversion factor in the first conversion factor set and a corresponding random factor in the second random factor set to obtain a first target factor set; performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; performing an AND operation on each conversion factor in the second conversion factor set and a corresponding random factor in the first random factor set to obtain a second target factor set; performing an OR operation on each factor in the first target factor set and a corresponding factor in the second target factor set to obtain the fifth key shard; The sixth key shard is obtained by performing a sixth logical operation on the second random factor set and the target generation key, including: performing a negation operation on each generation key element in the target generation key to obtain a first conversion key, wherein the first conversion key includes N conversion key elements; performing an AND operation on each conversion key element in the first conversion key and a corresponding random factor in the second random factor set to obtain a third target factor set; performing a negation operation on each random factor in the second random factor set to obtain a second conversion factor set; performing an AND operation on each conversion factor in the second conversion factor set and a corresponding generation key element in the target generation key to obtain a fourth target factor set; performing an OR operation on each factor in the third target factor set and a corresponding factor in the fourth target factor set to obtain the sixth key shard.
7. The method according to claim 2 or 5, characterized in that: The method further comprises: Performing an XOR operation on each original key element in the original key and a corresponding random factor in the third random factor set to obtain a first generated key, wherein the first generated key includes N generated key elements; Perform an XOR operation on each generated key element in the first generated key and a corresponding random factor in the first random factor set to obtain the target generated key.
8. A key recovery method, characterized in that: include: Obtaining a key shard set and a third random factor set of the original key, wherein each key shard in the key shard set includes N key shard elements, and the third random factor set includes N random factors; Perform a logical operation on the key shards and the third random factor set according to the number of key shards in the key shard set to recover the original key.
9. The method according to claim 8, characterized in that When the number of key shards in the key shard set is 4, performing a logical operation on the key shard and the third random factor set to recover the original key includes: ORing each key shard element in the first key shard with a corresponding key shard element in the second key shard to obtain a first transformed key shard, wherein the first transformed key shard includes N transformed key elements; ORing each key shard element in the third key shard with a corresponding key shard element in the fourth key shard to obtain a second transformed key shard, wherein the second transformed key shard includes N transformed key elements; Performing an XOR operation on each transformed key element in the first transformed key slice, the corresponding transformed key element in the second transformed key slice, and the corresponding random factor in the third random factor to obtain the original key; The key shard set includes the first key shard, the second key shard, the third key shard and the fourth key shard.
10. The method according to claim 8, characterized in that When the number of key shards in the key shard set is 2, performing a logical operation on the key shard and the third random factor set to recover the original key includes: Performing an XOR operation on each key shard element in the fifth key shard, the corresponding key shard element in the sixth key shard, and the corresponding random factor in the third random factor set to obtain the original key; The key shard set includes the fifth key shard and the sixth key shard.
11. A key sharding device, characterized in that: include: A first acquisition module, configured to acquire an original key, wherein the original key includes N original key elements, where N is greater than or equal to 1; A second acquisition module is used to acquire multiple random factor sets, wherein each of the random factor sets includes N random factors; A sharding module, used for obtaining a key sharding set of the original key according to the original key and a plurality of the random factor sets; The sharding module is further used to obtain a preset number of key shards; perform a logical operation on the original key and the random factor set according to the number of key shards to obtain a key shard set of the original key.
12. A key recovery device, characterized in that: include: a third acquisition module, configured to acquire a key shard set and a third random factor set of the original key, wherein each key shard in the key shard set includes N key shard elements, and the third random factor set includes N random factors; The recovery module is used to perform a logical operation on the key shards and the third random factor set according to the number of key shards in the key shard set to recover the original key.
13. 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 described in any one of claims 1 to 7 or 8 to 10 when executed by a processor.
14. 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 described in any one of claims 1 to 7 or 8 to 10 are implemented.
Citation Information
Patent Citations
Data security transmission method and device based on proxy node
CN114650188A
Key recovery method, device and system, storage medium and electronic device
CN115001681A