Internet-of-things terminal data sharing method and device based on Shamir algorithm and storage medium
By segmenting IoT terminal data into multiple secret fragments and distributing them under near-field communication using the Shamir algorithm, the shortcomings of IoT terminal devices in terms of data security and integrity are solved, and the secure and efficient transmission of data can be achieved even if some devices are lost, thus enabling the recovery of complete data.
Patent Information
- Application Number
- CN202511130311.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-13
- Publication Date
- 2025-11-18
AI Technical Summary
Existing IoT terminal devices have shortcomings in data security and integrity protection. In particular, in large-scale deployments, key management is complex, encryption speed is slow, and hardware security vulnerabilities are easily exploited, making it difficult to guarantee the security of data transmission and storage.
The Shamir secret sharing algorithm is used to segment data into multiple secret fragments and distribute them to different terminal devices through near-field communication methods such as Bluetooth, Wi-Fi, and cellular networks. The original data can only be recovered after a certain number of fragments have been distributed, thus enhancing the security and integrity of the data.
Even if some terminal devices are hacked or lost, the complete data can still be recovered through other terminals, which improves data security and integrity, reduces storage resource requirements, and adapts to the data transmission needs of different scenarios.
Smart Images

Figure CN120979645A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of cryptography and Internet of Things (IoT) technology, specifically relating to a data sharing method, device, and storage medium for IoT terminals based on the Shamir algorithm. Background Technology
[0002] Symmetric encryption algorithm: A symmetric encryption algorithm is an encryption method in which the same key is used for both encryption and decryption.
[0003] Asymmetric encryption algorithms, also known as public-key encryption algorithms, use a pair of keys: a public key and a private key. The public key can be shared publicly and used to encrypt data; the private key must be kept secret and used to decrypt data.
[0004] AES (Advanced Encryption Standard) is currently the most commonly used symmetric encryption algorithm. It uses a fixed-length key (128 bits, 192 bits, or 256 bits) to encrypt and decrypt data. The core of AES is a substitution operation and a shift operation, which are repeatedly applied to achieve encryption and decryption.
[0005] RSA (Rivest-Shamir-Adleman): One of the most widely used asymmetric encryption algorithms, it uses a public-key and a private-key pair to encrypt and decrypt data. At its core, RSA is a product of large prime numbers and a special function. Invented in 1977 by Ron Rivest, Adi Shamir, and Leonard Adleman, it is widely used for data security protection.
[0006] Shamir's algorithm, proposed by Adi Shamir in 1979, is a secure multi-party computation technique in cryptography. It's a secret information segmentation algorithm that divides a single secret message into multiple fragments, and the original secret message can be reassembled using only a portion of these fragments. Shamir's algorithm provides a secure way to share secrets; even if some shares are lost or obtained by an attacker, the overall security of the system remains unaffected.
[0007] With the vigorous development of IoT technology and the large-scale access of IoT terminal devices, the rapid expansion of the market has brought about the problem of uneven product quality. This may not only cause system crashes and data loss due to hardware failures or defects, affecting user experience, but also raise higher requirements for the security and authenticity of data collection and transmission due to the generation of a large amount of sensitive data.
[0008] Some shortcomings of mainstream IoT security technologies:
[0009] Existing IoT terminal devices focus on functionality, while traditional equipment manufacturers lack security capabilities and have poor data integrity protection. Or, considering factors such as time and cost, they generally ignore these issues in terminal design.
[0010] The mainstream security technologies for the Internet of Things (IoT) include data encryption, identity authentication and access control, secure communication protocols, key management, firmware and software security, etc.
[0011] These technologies have some disadvantages and drawbacks. For example, encryption and decryption operations in encryption technologies may increase the computational burden and affect the performance of IoT devices; in large-scale IoT deployments, key generation, distribution, and updates may become complex and error-prone; the distributed nature of IoT devices may make firmware and software updates difficult; users and manufacturers may lack awareness of the importance of IoT security, leading to the neglect of security measures; hardware-level security vulnerabilities may be exploited to carry out side-channel attacks, such as obtaining sensitive information by analyzing power consumption or electromagnetic leakage. With the collection of massive amounts of data, how to protect data security has become an issue that needs serious attention.
[0012] Existing IoT terminal data encryption technologies are mainly divided into symmetric encryption and asymmetric encryption, which have the following shortcomings:
[0013] The security of symmetric encryption algorithms (such as AES) heavily relies on the confidentiality and randomness of the key. Key management is a challenge in symmetric encryption because the key needs to be securely shared between the communicating parties, and managing a large number of keys becomes increasingly complex as the number of users increases.
[0014] The security of asymmetric encryption algorithms (such as RSA) relies on the difficulty of mathematical problems, such as large integer factorization or discrete logarithm problems. They are slow to encrypt and are not suitable for encrypting large amounts of data.
[0015] Such encryption technologies all require generating a key to encrypt plaintext data. The encrypted ciphertext is then transmitted and stored. The use of the key ensures that only authorized individuals can access or decrypt the data, thereby protecting the data from unauthorized third parties.
[0016] Traditional IoT terminals require a series of processes to transmit data to a processing center or cloud platform:
[0017] First, IoT devices collect the necessary data through sensors or other means. Then, the collected data undergoes preprocessing operations such as cleaning, filtering, and formatting. To ensure data security, encryption algorithms are used to encrypt the data, which is then encapsulated into messages or data packets for network transmission. Devices establish network connections via communication methods such as Wi-Fi, cellular networks, LoRa, and ZigBee. When connecting to a network or server, devices may need to authenticate to ensure secure communication. Appropriate data transmission protocols, such as MQTT, CoAP, and HTTP, are selected based on requirements. The selected protocol is used to send data from the device to a gateway or directly to a cloud server. In complex networks, data may need to pass through multiple intermediate nodes or routers for routing. Cloud servers or data centers receive the data from IoT devices. If the data is encrypted, it needs to be decrypted on the server side using the appropriate key. Further processing and analysis are performed on the data to extract useful information. The processed data is then stored in a database or other storage system. Summary of the Invention
[0018] This invention addresses the shortcomings of existing technologies by providing a data sharing method, device, and storage medium for IoT terminals based on the Shamir algorithm. After data collection and processing by IoT terminal devices, during the data encryption and transmission phase, the Shamir secret sharing algorithm is used to ensure information security. This algorithm divides the secret data into a preset number of fragments and uploads these fragments to different terminal devices within a certain range using near-field communication methods such as Bluetooth, Wi-Fi, and cellular networks. Once a certain number of secret fragments are collected, reaching a set threshold, the complete original data can be recovered even if the number of fragments is incomplete. Applying the Shamir algorithm to IoT terminal devices solves the problem that even if a single or partial IoT terminal device is hacked or damaged and loses some data under various network environments, the complete data can still be recovered by integrating the remaining terminal data fragments, ensuring data integrity. Furthermore, secret fragments obtained through intrusion, below the threshold number, cannot be used to decipher the complete data information, thus enhancing data storage security.
[0019] To achieve the above objectives, the present invention adopts the following technical solution:
[0020] A data sharing method for IoT terminals based on the Shamir algorithm includes the following steps:
[0021] The data collected by IoT terminals is a secret that needs to be shared. The IoT terminals are divided into one main terminal and multiple sub-terminals.
[0022] Set the threshold value k;
[0023] Based on the Shamir algorithm, the secret is divided into several secret fragments and distributed to IoT terminals. Each sub-terminal holds one secret fragment, and the main terminal holds the remaining secret fragments.
[0024] Recover the secret by taking k secret fragments.
[0025] To optimize the above technical solution, the specific measures also include:
[0026] Furthermore, the specific steps of dividing the secret into several secret fragments based on the Shamir algorithm are as follows:
[0027] Take k-1 random numbers (a1, a2, ..., a...) k-1 Construct a polynomial:
[0028] f(x) = S + a1x + a2x 2 +...+a k-1 x k-1
[0029] In the formula, S represents the secret to be shared, all operations are performed in the finite field of mod(p), where p is a prime number and mod(p) represents taking the modulus of p; the independent variable x is used to input the identifier of different secret fragments; the value of f(x) after inputting the identifier of the secret fragment represents the subkey;
[0030] Suppose the data is divided into n secret segments, and n non-zero and distinct integers x1, x2, ..., xn are chosen. n These are used to identify different secret fragments. Substituting them into the polynomial yields n subkeys f(x1), f(x2), ..., f(x... i ), ..., f(x) n ); together with their respective secret fragment identifiers, form n secret fragments (x1, f(x1)), (x2, f(x2)), ..., (x... n f(x) n )).
[0031] Furthermore, the distribution of the secret fragment to the IoT terminal specifically involves:
[0032] If the IoT terminals are statically deployed, the network status of the IoT terminals under the same local area network is statistically sorted, and the IoT terminal devices with the highest interaction transmission speed are grouped together to prioritize the sharing of secret fragments.
[0033] If the IoT terminal is in a mobile scenario, the status of the IoT terminal is scanned periodically. Based on three indicators, namely distance, network environment, and interference intensity, each indicator is statistically ranked and assigned different weights. Finally, the weighted scores are summed and the IoT terminal devices with the highest total scores are divided into cluster-shared secret segments. The IoT terminals are dynamically grouped periodically according to their status.
[0034] Furthermore, the threshold value k is set according to the security of the deployment environment of the main terminal, the security of the deployment environment of the sub-terminals, and the number of sub-terminals.
[0035] Furthermore, the specific steps of recovering the secret by taking k secret fragments are as follows:
[0036] Based on the relationship between the number of secret fragments held by the main terminal, the threshold value k, and the sum of the number of secret fragments held by all sub-terminals, k secret fragments are selected from which IoT terminals to recover the secret, specifically as follows:
[0037] If the number of secret fragments held by the main terminal is greater than or equal to the threshold value k, and the sum of the number of secret fragments held by all sub-terminals is greater than the sum of the number of secret fragments held by all sub-terminals, then k secret fragments are selected from the main terminal.
[0038] If the number of secret fragments held by the main terminal is greater than or equal to the sum of the number of secret fragments held by all sub-terminals and greater than or equal to the threshold value k, then k secret fragments can be randomly selected from all available IoT terminals.
[0039] If the sum of the number of secret fragments held by all sub-terminals is greater than or equal to the number of secret fragments held by the main terminal and greater than or equal to the threshold value k, then k secret fragments can be randomly selected from all available IoT terminals.
[0040] If the sum of the number of secret fragments held by all sub-terminals is greater than or equal to the threshold value k, and the number of secret fragments held by the main terminal is greater than or equal to the number of secret fragments held by the main terminal, then k secret fragments are selected from the sub-terminals or k secret fragments are selected from both the sub-terminals and the main terminal.
[0041] If the threshold value k > the number of secret fragments held by the main terminal ≥ the sum of the number of secret fragments held by all sub-terminals, then k secret fragments are selected from the sub-terminals and the main terminal.
[0042] If the threshold value k > the sum of the number of secret fragments held by all sub-terminals ≥ the number of secret fragments held by the main terminal, then k secret fragments are selected from the sub-terminals and the main terminal.
[0043] The secret is recovered using k secret fragments, specifically:
[0044] Given k secret fragments (x1, f(x1)), (x2, f(x2)), ..., x) k f(x) k Substituting into the polynomial f(x) = S + a1x + a2x2 +...+a k-1 x k-1 ,get:
[0045]
[0046] Solve for the polynomial coefficients (a1, a2, ..., a... j-1 );
[0047] Then substitute x = 0 into the polynomial to solve for the secret S.
[0048] The present invention also proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the IoT terminal data sharing method based on the Shamir algorithm as described above.
[0049] The present invention also proposes a computer-readable storage medium storing a computer program that enables a computer to execute the IoT terminal data sharing method based on the Shamir algorithm as described above.
[0050] The beneficial effects of this invention are:
[0051] 1. This invention proposes applying the Shamir algorithm for data transmission in IoT terminals operating in multi-device environments. If data is lost by individual terminals, the lost complete data can be recovered using secret fragments uploaded by a number of devices greater than or equal to a threshold. Terminals with fewer than the threshold data acquisition attempts will also be unable to decipher the original information based on the acquired secret fragments. The secure application of the Shamir algorithm based on IoT terminals can significantly improve data security and integrity.
[0052] 2. This invention proposes that in large-scale IoT device usage scenarios, secret data fragments can be shared by fixing a small number of secret holders. Instead of splitting the data collected by a single device and uploading it to each IoT terminal for storage, the secret data is shared among a few terminal devices with good and stable transmission status or the closest proximity, thus saving storage resources and improving data transmission efficiency.
[0053] 3. This invention proposes different secret data fragment allocation schemes to meet the application needs of various scenarios. IoT terminals can divide data into secret fragments of varying numbers to accommodate different terminals, and then transmit them to each device in an unevenly distributed manner. Terminals can be prioritized based on the number of secret fragments they hold. Primary terminals holding more secret fragments can be configured with more memory and placed in a more secure area, while secondary terminals holding only a single fragment can have their hardware configuration costs reduced and be placed in more dangerous or more vulnerable areas. By flexibly configuring the fragment allocation scheme and threshold values, applications in some extreme environmental scenarios can be achieved. The application of the Shamir algorithm can also optimize IoT terminal products, enabling more secure and complete data transmission in the same scenario. Attached Figure Description
[0054] Figure 1 This is a schematic diagram of the Shamir algorithm. Detailed Implementation
[0055] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0056] Example 1
[0057] This invention proposes a data sharing method for IoT terminals based on the Shamir algorithm, comprising the following steps:
[0058] The data collected by IoT terminals is a secret that needs to be shared. The IoT terminals are divided into one main terminal and multiple sub-terminals.
[0059] Set a threshold value k (the threshold for the number of data fragments obtained after splitting the original data that can still recover the original data); set it according to the security of the deployment environment of the main terminal, the security of the deployment environment of the sub-terminals, and the number of sub-terminals.
[0060] The Shamir algorithm divides the secret into several secret fragments and distributes these fragments to IoT terminals. Each sub-terminal holds one secret fragment, while the main terminal holds the remaining fragments. The principle of the Shamir algorithm is as follows: Figure 1 As shown. The specific process of dividing the secret into several secret fragments based on the Shamir algorithm is as follows:
[0061] Take k-1 random numbers (a1, a2, ..., a...) k-1 Construct a polynomial:
[0062] f(x) = S + a1x + a2x 2 +...+a k-1 x k-1
[0063] In the formula, S represents the secret to be shared, all operations are performed in the finite field of mod(p), where p is a prime number and mod(p) represents taking the modulus of p; the independent variable x is used to input the identifier of different secret fragments; the value of f(x) after inputting the identifier of the secret fragment represents the subkey;
[0064] Suppose the data is divided into n secret segments, and n non-zero and distinct integers x1, x2, ..., xn are chosen. n These are used to identify different secret fragments. Substituting them into the polynomial yields n subkeys f(x1), f(x2), ..., f(x... i ), ..., f(x) n ); together with their respective secret fragment identifiers, form n secret fragments (x1, f(x1)), (x2, f(x2)), ..., (x... n f(x) n )).
[0065] Large-scale IoT devices can be grouped for transmission and storage, with a fixed number of shared data segments, selecting the best-performing terminals to share data fragments. When facing large-scale IoT terminal clusters, to save storage resources and improve data transmission efficiency, the IoT terminal cluster can be divided into terminal groups that meet the required number, reducing the number of secret data holders. Alternatively, the number of secret holders can be fixed, and the distance and communication environment between terminals can be analyzed before uploading secret fragments to share them with designated IoT terminals using the most stable and secure transmission channel. This reduces the high data storage requirements caused by the increased number of IoT terminals when using the Shamir algorithm. The specific process of distributing secret fragments to IoT terminals is as follows:
[0066] If the IoT terminals are statically deployed, the network status of the IoT terminals under the same local area network is statistically sorted, and the IoT terminal devices with the highest interaction transmission speed are grouped together to prioritize the sharing of secret fragments.
[0067] If the IoT terminal is in a mobile scenario, the status of the IoT terminal is scanned periodically. Based on three indicators, namely distance, network environment, and interference intensity, each indicator is statistically ranked and assigned different weights. Finally, the weighted scores are summed and the IoT terminal devices with the highest total scores are divided into cluster-shared secret segments. The IoT terminals are dynamically grouped periodically according to their status.
[0068] Recover the secret by extracting k secret fragments. Specifically:
[0069] Based on the relationship between the number of secret fragments held by the main terminal, the threshold value k, and the sum of the number of secret fragments held by all sub-terminals, k secret fragments are selected from which IoT terminals to recover the secret, specifically as follows:
[0070] If the number of secret fragments held by the main terminal is greater than or equal to the threshold value k, and the sum of the number of secret fragments held by all sub-terminals is greater than the sum of the number of secret fragments held by all sub-terminals, then k secret fragments are selected from the main terminal.
[0071] If the number of secret fragments held by the main terminal is greater than or equal to the sum of the number of secret fragments held by all sub-terminals and greater than or equal to the threshold value k, then k secret fragments can be randomly selected from all available IoT terminals.
[0072] If the sum of the number of secret fragments held by all sub-terminals is greater than or equal to the number of secret fragments held by the main terminal and greater than or equal to the threshold value k, then k secret fragments can be randomly selected from all available IoT terminals.
[0073] If the sum of the number of secret fragments held by all sub-terminals is greater than or equal to the threshold value k, and the number of secret fragments held by the main terminal is greater than or equal to the number of secret fragments held by the main terminal, then k secret fragments are selected from the sub-terminals or k secret fragments are selected from both the sub-terminals and the main terminal.
[0074] If the threshold value k > the number of secret fragments held by the main terminal ≥ the sum of the number of secret fragments held by all sub-terminals, then k secret fragments are selected from the sub-terminals and the main terminal.
[0075] If the threshold value k > the sum of the number of secret fragments held by all sub-terminals ≥ the number of secret fragments held by the main terminal, then k secret fragments are selected from the sub-terminals and the main terminal.
[0076] The secret is recovered using k secret fragments, specifically:
[0077] Given k secret fragments (x1, f(x1)), (x2, f(x2)), ..., (x... k f(x) k Substituting into the polynomial f(x) = S + a1x + a2x 2 +...+a k-1 x k-1 ,get:
[0078]
[0079] Solve for the polynomial coefficients (a1, a2, ..., a... k-1 );
[0080] Then substitute x = 0 into the polynomial to solve for the secret S.
[0081] Traditional Shamir algorithms, when applied to IoT terminals, distribute secret fragments evenly across each terminal, i.e., the secret holder device, for storage. This paper proposes an improved secret fragment distribution scheme. A primary terminal device holds multiple secret fragments, while the remaining sub-terminal devices each hold one secret fragment. Deployed in a relatively secure environment, the aim is to increase the proportion of secret fragments held by the primary terminal, thereby enhancing the system's security and reliability.
[0082] In a scenario with one main terminal and multiple sub-terminals, the following allocation schemes are used to determine the number of secret fragments and the threshold value (the threshold value k is less than or equal to the sum of the total number of secret fragments by default):
[0083] (1) Use Case 1: The original secret can only be recovered using the main terminal. Even with data from all sub-terminals, the secret fragment allocation requirement still cannot be met:
[0084] The number of secret fragments held by the main terminal ≥ threshold k > the sum of the number of secret fragments held by all sub-terminals
[0085] It is mainly suitable for scenarios where the main terminal deployment environment is extremely secure and stable, the sub-terminal deployment risk is high, or the main terminal data needs to be deleted and destroyed in a timely manner under special circumstances, so that the secret fragments cannot be recovered from the original secret.
[0086] (2) Use Case 2: The original secret can be recovered by holding either the main terminal data or the sub-terminal data.
[0087] ① The secret fragment allocation requirement must meet the following conditions:
[0088] The number of secret fragments held by the main terminal ≥ the sum of the number of secret fragments held by all sub-terminals ≥ the threshold value k
[0089] It is primarily applicable to scenarios where the main terminal deployment environment is relatively secure, with the main terminal as the primary driver, but the data recovery does not solely depend on the main terminal, and provides a variety of secret fragment recovery solutions.
[0090] ② The secret fragment allocation requirement must meet the following conditions:
[0091] The sum of the number of secret fragments held by all sub-terminals ≥ the number of secret fragments held by the main terminal ≥ the threshold value k
[0092] It is mainly suitable for scenarios where there are a large number of sub-terminal devices, the main terminal deployment environment is relatively secure, the data recovery does not depend solely on the sub-terminals, the main terminal occupies a large amount of data fragments but the original secret can be recovered by relying only on the data from the sub-terminals, and it provides multiple secret fragment recovery solutions.
[0093] (3) Use Case 3: The original secret cannot be recovered by holding the main terminal data alone; the secret data can be recovered by using the sub-terminal data or by combining the main terminal data.
[0094] The secret fragment allocation requirement must meet the following conditions:
[0095] The sum of the number of secret fragments held by all sub-terminals ≥ threshold k > the number of secret fragments held by the main terminal
[0096] It is primarily suitable for scenarios with a large number of sub-terminal devices, a relatively secure main terminal deployment environment, and where data recovery does not solely rely on the main terminal. It can recover the original secrets by combining fragmented data from the main terminal, or it can recover data solely from sub-terminal data. While improving data security and reliability, it also enhances the risk tolerance of the main terminal due to the high proportion of data fragments.
[0097] (4) Use Case 4: The original secret cannot be recovered by holding only the main terminal or only the sub-terminal data. The data from both the main terminal and the sub-terminal must be combined for recovery.
[0098] ① The secret fragment allocation requirement must meet the following conditions:
[0099] Threshold value k > Number of secret fragments held by the main terminal ≥ Sum of the number of secret fragments held by all sub-terminals
[0100] It is mainly suitable for scenarios where the main terminal deployment environment is extremely secure, the sub-terminal deployment environment has low risk, and the overall environment is stable.
[0101] ② The secret fragment allocation requirement must meet the following conditions:
[0102] Threshold value k > Sum of secret fragment holdings of all sub-terminals ≥ Number of secret fragments held by the main terminal
[0103] It is mainly suitable for scenarios where there are a large number of sub-terminals, the deployment environment of the main terminal is relatively less risky than the deployment environment of the other sub-terminals, and the overall environment has certain risks.
[0104] The above scenarios apply to different deployment schemes with one main terminal and multiple sub-terminals. In the smart water application scenario, a total of 11 smart water terminal devices were set up in the pilot area: one main device and 10 sub-devices. The threshold value k was set to 7, and the number of segmented secret fragments was set to 15. At this time, 5 of the 15 segmented secret fragments collected by each terminal are uploaded to the main device, while the remaining 10 sub-devices each hold one secret fragment. The main device is placed in a safe area on the ground to prevent damage, while the sub-devices are deployed in the water quality monitoring area. If any device is damaged, its complete data can be restored as long as more than two sub-devices are retrieved. In cases where some IoT terminals are easily damaged or data is lost, the number and extent of the segmented secret fragments can be flexibly allocated. For example, when observing the ecosystem of a certain marine area, it is necessary to deploy a large number of terminal sensors in the seawater to collect various data. However, due to the activities of various marine organisms, small terminals are easily swallowed by giant marine creatures such as whales, making them impossible to retrieve, or they may be damaged during predation. In this case, a main IoT terminal device can be set up in a relatively safe area such as an island, reef, ship hull, or beacon, while the remaining sub-IoT terminal devices are deployed normally. Even if an emergency occurs and the main device is damaged, the data can be recovered by the large number of sub-devices. Moreover, even if each individual IoT terminal device is acquired, it cannot be deciphered to recover the secret information. The security is high and the data is not easily lost. Based on the secret fragment allocation mechanism, applications such as multiple main terminals and multiple sub-terminals, with different terminals holding different numbers of secret fragments, can also be derived. The specific solution can be flexibly adjusted according to actual needs.
[0105] Example 2
[0106] This invention proposes an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the IoT terminal data sharing method based on the Shamir algorithm as described in Embodiment 1.
[0107] Example 3
[0108] This invention proposes a computer-readable storage medium storing a computer program that enables a computer to execute the IoT terminal data sharing method based on the Shamir algorithm as described in Embodiment 1.
[0109] This invention incorporates the Shamir algorithm in the application of data storage security across multiple IoT terminal devices, bringing the following advantages:
[0110] It can use near-field communication technology to divide the data collected by IoT terminal devices into several parts and transmit them to other nearby IoT devices in scenarios with no network or weak signal. If you want to recover the secret data, you must collect enough data fragments that meet the quantity requirements. Cracking a single IoT terminal alone cannot obtain the complete secret data.
[0111] Even if a terminal system crashes or is damaged by external forces, the data it collects will not be lost. By integrating the fragmented data that has been transmitted to other terminal devices, the secret data can be completely reproduced.
[0112] Based on the fundamental information theory security principles of the Shamir algorithm, its application in IoT terminals for data transmission security and integrity can be effectively guaranteed. Furthermore, the algorithm allows for flexible adjustment of parameters such as the number of terminals distributing secret information, the number of information fragments, and threshold values, to meet the needs of IoT applications in different scenarios and environments.
[0113] In the embodiments disclosed in this application, a computer storage medium may be a tangible medium that may contain or store programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of computer storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0114] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0115] The above are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should be considered within the scope of protection of the present invention.
Claims
1. A data sharing method for IoT terminals based on the Shamir algorithm, characterized in that, Includes the following steps: The data collected by IoT terminals is a secret that needs to be shared. The IoT terminals are divided into one main terminal and multiple sub-terminals. Set the threshold value k; Based on the Shamir algorithm, the secret is divided into several secret fragments and distributed to IoT terminals. Each sub-terminal holds one secret fragment, and the main terminal holds the remaining secret fragments. Recover the secret by taking k secret fragments.
2. The IoT terminal data sharing method based on the Shamir algorithm as described in claim 1, characterized in that, The specific steps of dividing the secret into several secret fragments based on the Shamir algorithm are as follows: Take k-1 random numbers (a1, a2, ..., a...) k-1 Construct a polynomial: f(x)=S+a1x+a2x 2 +...+a k-1 x k-1 In the formula, S represents the secret to be shared, all operations are performed in the finite field of mod(p), where p is a prime number and mod(p) represents taking the modulus of p; the independent variable x is used to input the identifier of different secret fragments; the value of f(x) after inputting the identifier of the secret fragment represents the subkey; Suppose the data is divided into n secret segments, and n non-zero and distinct integers x1, x2, ..., xn are chosen. n These are used to identify different secret fragments. Substituting them into the polynomial yields n subkeys f(x1), f(x2), ..., f(x... i ), ..., f(x) n ); together with their respective secret fragment identifiers, form n secret fragments (x1, f(x1)), (x2, f(x2)), ..., (x... n f(x) n )).
3. The IoT terminal data sharing method based on the Shamir algorithm as described in claim 1, characterized in that, The specific steps of distributing the secret fragment to the IoT terminal are as follows: If the IoT terminals are statically deployed, the network status of the IoT terminals under the same local area network is statistically sorted, and the IoT terminal devices with the highest interaction transmission speed are grouped together to prioritize the sharing of secret fragments. If the IoT terminal is in a mobile scenario, the status of the IoT terminal is scanned periodically. Based on three indicators, namely distance, network environment, and interference intensity, each indicator is statistically ranked and assigned different weights. Finally, the weighted scores are summed and the IoT terminal devices with the highest total scores are divided into cluster-shared secret segments. The IoT terminals are dynamically grouped periodically according to their status.
4. The IoT terminal data sharing method based on the Shamir algorithm as described in claim 1, characterized in that, The threshold value k is set according to the security of the deployment environment of the main terminal, the security of the deployment environment of the sub-terminals, and the number of sub-terminals.
5. The IoT terminal data sharing method based on the Shamir algorithm as described in claim 2, characterized in that, The specific steps for recovering the secret by taking k secret fragments are as follows: Based on the relationship between the number of secret fragments held by the main terminal, the threshold value k, and the sum of the number of secret fragments held by all sub-terminals, k secret fragments are selected from which IoT terminals to recover the secret, specifically as follows: If the number of secret fragments held by the main terminal is greater than or equal to the threshold value k, and the sum of the number of secret fragments held by all sub-terminals is greater than the sum of the number of secret fragments held by all sub-terminals, then k secret fragments are selected from the main terminal. If the number of secret fragments held by the main terminal is greater than or equal to the sum of the number of secret fragments held by all sub-terminals and greater than or equal to the threshold value k, then k secret fragments can be randomly selected from all available IoT terminals. If the sum of the number of secret fragments held by all sub-terminals is greater than or equal to the number of secret fragments held by the main terminal and greater than or equal to the threshold value k, then k secret fragments can be randomly selected from all available IoT terminals. If the sum of the number of secret fragments held by all sub-terminals is greater than or equal to the threshold value k, and the number of secret fragments held by the main terminal is greater than or equal to the number of secret fragments held by the main terminal, then k secret fragments are selected from the sub-terminals or k secret fragments are selected from both the sub-terminals and the main terminal. If the threshold value k > the number of secret fragments held by the main terminal ≥ the sum of the number of secret fragments held by all sub-terminals, then k secret fragments are selected from the sub-terminals and the main terminal. If the threshold value k > the sum of the number of secret fragments held by all sub-terminals ≥ the number of secret fragments held by the main terminal, then k secret fragments are selected from the sub-terminals and the main terminal. The secret is recovered using k secret fragments, specifically: Given k secret fragments (x1, f(x1)), (x2, f(x2)), ..., (x... k f(x) k Substituting into the polynomial f(x) = S + a1x + a2x 2 +...+a k-1 x k-1 ,get: Solve for the polynomial coefficients (a1, a2, ..., a... k-1 ); Then substitute x = 0 into the polynomial to solve for the secret S.
6. An electronic device, characterized in that, include: The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the IoT terminal data sharing method based on the Shamir algorithm as described in any one of claims 1-5.
7. A computer-readable storage medium storing a computer program, characterized in that, The computer program causes the computer to execute the IoT terminal data sharing method based on the Shamir algorithm as described in any one of claims 1-5.