An encryption method based on edge IoT agent

By encrypting the character sequence and chaotic mapping of data in the edge IoT proxy, the problem that ciphertext statistics laws in the data encryption method in the prior art are easily cracked, and higher security and transmission efficiency are achieved.

CN118827004BActive Publication Date: 2025-01-10NANCHANG POWER SUPPLY BRANCH OF STATE GRID JIANGXI ELECTRIC POWER CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411262677.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2025-01-10
Estimated Expiration
2044-09-10

AI Technical Summary

Technical Problem

In the prior art, data encryption methods between edge nodes and Internet of Things devices or cloud platforms rely on AES algorithms, resulting in statistical rules in the ciphertexts, and attackers can crack data security through statistical analysis attacks and it is difficult to ensure.

Method used

Using an encryption method based on edge IoT proxy, convert plaintext data into character sequences, set operation length sequences and conversion key sequences, encrypt character sequences through operation lengths and conversion keys, generate ciphertext sequences, and use Logistic chaos The mapping algorithm generates chaotic sequences to increase encryption complexity.

Benefits of technology

The statistical characteristics of the ciphertext sequence have been changed, the difficulty of attackers' cracking is increased, the attacker resists brute force cracking and statistical analysis attacks have been resisted, data security has been improved, and transmission efficiency has been improved through avalanche effect and compression effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118827004B_ABST
    Figure CN118827004B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of data encryption transmission, and more specifically, to an encryption method based on an edge IoT agent, including: in the data interaction process between edge nodes and IoT devices and cloud platforms, converting plaintext data into a character sequence, assigning a codeword to each character; assigning an operation length and a conversion key to each character according to an operation length sequence and a conversion key sequence, dividing the codeword of the current character into a first codeword and a second codeword according to the operation length of the previous character, performing an operation on the last bit in the second codeword of each character and the first codeword of the next character according to the conversion key, determining the ciphertext of each character according to the operation result, which is the operation length of each character; splicing the first codeword of the first character in the character sequence and the ciphertext of all characters to obtain a ciphertext sequence. The present invention has both encryption and compression effects, good encryption effect, and can resist statistical analysis and brute force attacks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data encryption transmission, and more specifically, to an encryption method based on edge IoT agent. Background Art

[0002] In the IoT environment, edge computing pushes data processing tasks to the edge of the network to reduce the burden on central servers and improve response speed. However, with the increase in the number of IoT devices and the surge in data volume, data security issues have become particularly important. Currently, in the data interaction process between edge nodes and IoT devices or cloud platforms, encryption algorithms such as AES are usually used to encrypt the interaction data to improve data security.

[0003] For example, the patent document with announcement number CN114389642B discloses a distribution network communication method and system based on edge IoT agent. The method is equipped with a security protection module at the edge node, and the original data of the terminal is encrypted by the security protection module. The encryption processing includes converting the original data into t 3×3 matrices, encrypting the t 3×3 matrices using the AES algorithm, obtaining the ciphertext cn and the key z, and encrypting the ciphertext cn using the key z to obtain the ciphertext U.

[0004] The above method can realize the encryption of the interactive data between the edge node and the IoT device or cloud platform, but the AES algorithm relied on by the encryption method is a block encryption, which divides the plaintext into several groups of plaintext segments of the same length and encrypts them separately. The length of the ciphertext is the same as the length of the plaintext, and in the Electronic Codebook mode (ECB) of the AES algorithm, the encryption results of the plaintext segments with the same content are the same, which makes the ciphertext have certain statistical regularities. Attackers can exploit the statistical regularities in the ciphertext for statistical analysis attacks, making it difficult to ensure the security of the interactive data between the edge node and the IoT device or cloud platform. Summary of the invention

[0005] In order to solve the technical problem that attackers can mine statistical laws in ciphertexts for statistical analysis attacks, and it is difficult to ensure the security of interactive data between edge nodes and IoT devices or cloud platforms, the present invention proposes an encryption method based on edge IoT agent, which includes the following steps:

[0006] In the data interaction process between the edge node and the IoT device and the cloud platform, the plaintext data is converted into a character sequence; a codeword of the same length is assigned to each character; an operation length sequence is set, and the elements in the operation length sequence are integers whose size does not exceed the length of the codeword; a conversion key sequence is set, and the elements in the conversion key sequence are 0 or 1, which are used to represent different operation rules; an operation length and a conversion key are assigned to each character in turn according to the operation length sequence and the conversion key sequence, wherein the operation length of each character does not exceed the length of the second codeword of each character; the second codeword of the character is obtained by: bits as the first codeword of the character, and the remaining bits in the codeword corresponding to the character as the second codeword of the character, where Indicates the operation length of the character before the character; according to the conversion key of each character, the second code word of each character is bits are calculated with the first code word of the next character, and the result is concatenated at the beginning of the second code word of each character. bits later, as the ciphertext of each character, where Indicates the operation length of each character. Represents the length of the second code word of each character; concatenates the first code word of the first character in the character sequence and the ciphertexts of all characters in the order of the characters in the character sequence to obtain a ciphertext sequence.

[0007] The effect is that: the present invention operates on some bits at the end of the codeword of the previous character and some bits at the beginning of the codeword of the next character, obtains ciphertext according to the operation result, changes the statistical characteristics of the codeword of the character, so that the same ciphertext in the ciphertext sequence corresponds to different meanings and decoding results, and it is difficult for attackers to use statistical analysis attacks to crack the ciphertext sequence, thereby improving the security of interactive data between edge nodes and Internet of Things devices or cloud platforms; in the present invention, the number of bits operated between the codewords of every two adjacent characters is different, so that the length of the ciphertext corresponding to each character is different, and the length of the ciphertext sequence is irregular, and attackers cannot know the length of the plaintext data according to the ciphertext sequence, thereby increasing the attack The difficulty for attackers to carry out brute force cracking can be resisted, and the security of the interactive data between the edge node and the Internet of Things device or the cloud platform is further improved; the ciphertext sequence in the present invention has an avalanche effect. If one character in the character sequence is changed, the ciphertext of the character and all subsequent characters will change. The attacker cannot infer the relationship between the corresponding plaintext data based on different ciphertext sequences, so that the security of the interactive data between the edge node and the Internet of Things device or the cloud platform is stronger; the ciphertext sequence in the present invention is shorter than the total length of the codewords of all characters in the character sequence, and has a compression effect, which can improve the transmission efficiency of data between the edge node and the Internet of Things device or the cloud platform.

[0008] Preferably, the method further includes: using the hash value of the character sequence as a supplementary ciphertext.

[0009] The effect is that the supplementary ciphertext ensures that the ciphertext sequence is decodable.

[0010] Preferably, the setting of the operation length sequence includes: according to the first key The Logistic chaotic mapping algorithm is used to generate a The first chaotic sequence of Elements to The elements are Multiply and round the result up to get indivual Integer in the range, this integers form the operation length sequence, where Indicates the length of the character sequence, Indicates the number of character types. Indicates the round-up symbol. represents the fork parameter, Represents the initial value parameter, Represents the iteration parameter.

[0011] The effect is that the operation length sequence is set by using the chaotic mapping method, so that the element size in the operation length sequence is irregular, and the length of the ciphertext of each character is more chaotic and irregular, which increases the difficulty for attackers to carry out brute force cracking and statistical analysis attacks.

[0012] Preferably, the setting of the conversion key sequence includes: according to the second key The Logistic chaotic mapping algorithm is used to generate a The second chaotic sequence of Elements to The elements are rounded to the nearest integer, and we get A number with a value of 0 or 1, The number of them constitutes the conversion key sequence, where Indicates the length of the character sequence, represents the fork parameter, Represents the initial value parameter, Represents the iteration parameter.

[0013] Preferably, the step of assigning an operation length to each character in sequence includes: taking the first element in the operation length sequence that is not greater than the length of the second codeword of the current character as the operation length of the current character, deleting the operation length of the current character and all previous elements in the operation length sequence from the operation length sequence to update the operation length sequence; and assigning an operation length to the next character according to the updated operation length sequence.

[0014] The effect is that an operation length no greater than the second codeword length of the character is allocated to the current character, thereby ensuring that the current character can be encrypted smoothly.

[0015] Preferably, the method for allocating the conversion key is: recording the sequence number of the current character in the character sequence as , the first The element is used as the conversion key for the current character.

[0016] Preferably, the conversion key of each character is used to convert the last bits are operated with the first code word of the next character, including: in response to the conversion key of the character being 0, the latter part of the second code word of the character is converted to bits are XORed with the first code word of the next character; in response to the conversion key of the character being 1, the next bit in the second code word of the character is The bits are XORed with the first code word of the next character.

[0017] The effect is that different operations are performed on some bits of each two adjacent characters, which increases the complexity of the ciphertext sequence, so that the same ciphertext corresponds to different decoding results, further increasing the difficulty for attackers to conduct statistical analysis attacks.

[0018] Preferably, the converting of the plaintext data into a character sequence includes: using GB2312 encoding to encode the plaintext data into a binary sequence, and using Base64 encoding to encode the binary sequence into a character sequence.

[0019] Preferably, the step of assigning a codeword of the same length to each character comprises: assigning a codeword of the same length to each character according to the number of character types. Assign a binary number of the same length to each character as the codeword of each character. The length of the codeword is ,in Indicates the round-up symbol.

[0020] The present invention has the following beneficial effects:

[0021] 1. The present invention changes the statistical characteristics of the codewords of characters, so that the same ciphertext in the ciphertext sequence corresponds to different meanings and decoding results. It is difficult for attackers to use statistical analysis attacks to crack the ciphertext sequence, thereby improving the security of interactive data between edge nodes and IoT devices or cloud platforms;

[0022] 2. The length of the ciphertext sequence in the present invention is irregular, and the attacker cannot know the length of the plaintext data based on the ciphertext sequence, which increases the difficulty for the attacker to perform brute force cracking and can resist brute force cracking attacks;

[0023] 3. The ciphertext sequence in the present invention has an avalanche effect. Attackers cannot infer the relationship between corresponding plaintext data based on different ciphertext sequences, which further improves the security of interactive data between edge nodes and IoT devices or cloud platforms;

[0024] 4. The ciphertext sequence in the present invention has a compression effect, which can improve the data transmission efficiency between edge nodes and IoT devices or cloud platforms. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0026] Figure 1 It is a flowchart of the steps of an encryption method based on edge IoT agent according to an embodiment of the present invention;

[0027] Figure 2 is a schematic diagram of code words corresponding to each character in an embodiment of the present invention;

[0028] Figure 3 is a schematic diagram of the encryption process of an embodiment of the present invention;

[0029] Figure 4 is a schematic diagram of a decryption process of a decryption result according to an embodiment of the present invention;

[0030] Figure 5 It is a schematic diagram of the decryption process of another decryption result according to an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0032] The edge IoT agent is an intelligent bridge connecting objects and the Internet, responsible for data processing and management between IoT devices and cloud platforms. In the process of data interaction between edge nodes and IoT devices and cloud platforms, data needs to be encrypted to improve data security. To this end, the present invention proposes an encryption method based on edge IoT agent to encrypt the interactive data between edge nodes and IoT devices and cloud platforms. When an IoT device or cloud platform sends data to an edge node, the IoT device and cloud platform are the sending end, and the edge node is the receiving end; when an edge node sends data to an IoT device or cloud platform, the edge node is the sending end, and the IoT device and cloud platform are the receiving end.

[0033] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0034] See also Figure 1 , which shows a flowchart of an encryption method based on edge IoT agent provided by an embodiment of the present invention, the method comprising the following steps:

[0035] S001. Convert the plaintext data to be transmitted into a character sequence.

[0036] Specifically, at the transmitting end, the plaintext data to be transmitted is encoded into a binary sequence using GB2312 encoding, and the binary sequence is encoded into a character sequence using Base64 encoding. It should be noted that since the plaintext data to be transmitted may contain a variety of data types, such as numbers, English characters, Chinese characters, etc., the plaintext data to be transmitted is encoded into a binary sequence and then encoded into a character sequence, which can unify the data type and reduce the encryption difficulty. The present invention only takes GB2312 encoding and Base64 encoding as examples, and does not specifically limit the encoding method. The implementer can select the encoding method according to the actual implementation situation, such as UTF-8 encoding and ASCII code, etc.

[0037] At this point, the conversion of plaintext data is achieved and the character sequence is obtained.

[0038] S002. Allocate a code word of the same length to each character.

[0039] Specifically, according to the number of character types Assign a binary number of the same length to each character as the codeword of each character. The length of the codeword is ,in Indicates the rounding symbol. The codeword for each character is required to be different. To ensure decryption, the codeword corresponding to each character is agreed upon in advance by the sender and the receiver.

[0040] For example, when the number of character types When , the length of the codeword for each character is , when the character sequence is {A,C,A,B,A,A,E,F,V,D,V,D,A,B,B,H,S,B,A,S,S,C,G}, the codeword corresponding to each character is as follows Figure 2 The present invention only takes 10 character types as an example. In the actual implementation process, the implementer needs to determine the number of character types according to the encoding method used when encoding the binary sequence in step S001. For example, when Base64 encoding is used, Base64 encoding contains 64 characters, and the character sequence contains at most 64 different characters. ; When using ASCII code, ASCII code contains 128 characters, then the character sequence contains at most 128 different characters, so the number of character types is .

[0041] At this point, the code word allocation of characters is achieved.

[0042] S003. Set an operation length sequence, where each element in the operation length sequence is an integer whose size does not exceed the length of each character codeword; set a conversion key sequence, where the elements in the conversion key sequence are 0 or 1, used to represent different operation rules.

[0043] In one embodiment, a first key is set and the second key ,in , Represents the bifurcation parameter, the value range is , , Represents the initial value parameter, the value range is , , Represents the iteration parameter, the value range is ,and , The first key and the second key are agreed upon by the sender and the receiver in advance.

[0044] It should be noted that the first key and the second key are set based on the Logistic Chaotic Mapping Algorithm. The bifurcation parameter and the initial value parameter are the parameters of the Logistic Chaotic Mapping Algorithm. The value range is determined by the Logistic Chaotic Mapping Algorithm. The specific principle is not repeated here. Since the Logistic Chaotic Mapping Algorithm enters a chaotic state when it is iterated more than 30 times, the iteration parameter is set , The value range is .

[0045] According to the first key The Logistic chaotic mapping algorithm is used to generate a The first chaotic sequence of Elements to The elements are Multiply and round the result up to get indivual Integer in the range, this integers form the operation length sequence, where Indicates the length of the character sequence; Indicates the number of character types. Indicates the length of the codeword for each character.

[0046] According to the second key The Logistic chaotic mapping algorithm is used to generate a The second chaotic sequence of Elements to The elements are rounded to the nearest integer, and we get A number with a value of 0 or 1, The number of them constitutes the conversion key sequence.

[0047] In the conversion key sequence, 0 and 1 represent different operation rules. In this embodiment, 0 represents XOR operation and 1 represents XOR operation. In other embodiments, the implementer can set the operation rules represented by 0 and 1 according to the actual implementation situation, for example, 0 represents XOR operation and 1 represents XOR operation.

[0048] At this point, the operation length sequence and the conversion key sequence are obtained.

[0049] It should be noted that in this embodiment, the Logistic chaotic mapping algorithm is used to obtain the operation length sequence and the conversion key sequence according to the first key and the second key. In other embodiments, the sending end and the receiving end may also directly agree on the operation length sequence and the conversion key sequence, or use other chaotic mapping algorithms to obtain the operation length sequence and the conversion key sequence. However, it should be noted that when other chaotic mapping algorithms are used, the corresponding first key and second key need to be set according to the parameters of the chaotic mapping algorithm used.

[0050] S004. Encrypt the character sequence according to the codeword of each character, the operation length sequence and the conversion key sequence to obtain a ciphertext sequence.

[0051] Specifically, at the sending end, each character in the character sequence is encrypted in sequence, including:

[0052] The sequence number of the current character in the character sequence is recorded as , the first The first element in the operation length sequence that is not greater than the length of the second codeword of the current character is used as the operation length of the current character, recorded as , the operation length of the current character in the operation length sequence All elements before and after are deleted from the operation length sequence to update the operation length sequence.

[0053] The method for obtaining the second codeword is as follows: When , the first bit in the code word corresponding to the current character is used as the first code word of the current character, and the remaining bits in the code word corresponding to the current character are used as the second code word of the current character; when When the code word corresponding to the current character is bits as the first codeword of the current character, and the remaining bits in the codeword corresponding to the current character as the second codeword of the current character, where, Indicates the operation length of the previous character.

[0054] when , the length of the second codeword of the current character is recorded as In response to the conversion key of the current character being 0, the second code word of the current character is The bits are XORed with the first codeword of the next character, and the result is concatenated to the beginning of the second codeword of the current character. bits, as the ciphertext of the current character; in response to the conversion key of the current character being 1, the second codeword of the current character is The bits are XORed with the first codeword of the next character, and the result is concatenated at the beginning of the second codeword of the current character. bits later, as the ciphertext of the current character; when , the second codeword of the current character is used as the ciphertext of the current character, where Indicates the length of a character sequence.

[0055] The first codeword of the first character in the character sequence and the ciphertext of all characters are concatenated together in the order of the characters in the character sequence to obtain the ciphertext sequence. In order to ensure smooth decoding in the future, the hash value of the character sequence is obtained as the supplementary ciphertext.

[0056] For example, the character sequence is {A,C,A,B,A,A,E,F,V,D,V,D,A,B,B,H,S,B,A,S,S,C,G}, the operation length sequence is {2,1,1,2,1,3,3,1,2,2,3,2,1,2,1,3,1,2,2,3,3,1,2,1,2,1,3,3,1,1,1,2,3,1,3,3,2,1,2,3,2,1,2,1,3,2}, and the conversion key sequence is {1,0,1,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,0,1,0}. The codeword for each character in the character sequence is as follows: Figure 2 As shown, the encryption process refers to Figure 3 Specifically: the code word of the first character A in the character sequence is 0110, then the first code word of character A is 0 and the second code word is 110. The first element 2 in the operation length sequence is not greater than the length of the second code word of character A, so 2 is used as the operation length of character A. The first element 1 in the conversion key sequence is used as the conversion key of character A. The code word of the second character C in the character sequence is 0001, then the first code word of character C is 00 and the second code word is 01. Since the conversion key is 1, the last two bits of the second code word of character A are XORed with the first code word of character C to obtain 01, and 01 is added to the front of the second code word of character A. After the bits are set to 1, the ciphertext of character A is 101. Similarly, the ciphertexts of the 2nd to 22nd characters in the character sequence are obtained in sequence. The second codeword of the 23rd character (i.e. the last character) G in the character sequence is 110. The second codeword of the last character G is used as the ciphertext of character G. The first codeword 0 of the first character A in the character sequence and the ciphertexts of all characters are concatenated together in the order of the characters in the character sequence to obtain the ciphertext sequence {0101011100111010000110101110111110101111000 1010000001100}. Before encryption, the sequence of code words corresponding to all characters in the character sequence is {0110000101101001011001101011100011100010111000100110100100110010000001001011000000 00000011100}, and the length of the sequence is 92. Since the code word length of each character is the same, the code word appearance rule in the sequence can be counted. For example, 0110 appears 6 times in the sequence, and the distribution of characters in the character sequence can be inferred based on the rule. After encryption, the length of the ciphertext sequence is 56, which is 36 less than the sequence length of the code words corresponding to all characters in the character sequence. Therefore, the encryption method in the present invention has a compression effect. At the same time, the length of the ciphertext corresponding to each character in the ciphertext sequence is different, and the codeword rules of each character are destroyed. The attacker cannot infer the distribution of characters in the character sequence based on the distribution of 0 and 1 in the ciphertext sequence, and the confidentiality is strong.

[0057] At this point, the encryption of the character sequence is realized, and the ciphertext sequence and the supplementary ciphertext are obtained.

[0058] S005. Send the ciphertext sequence to the receiving end so that the receiving end decrypts the ciphertext sequence to obtain plaintext data.

[0059] The sender sends the supplementary ciphertext to the receiver while sending the ciphertext sequence. The receiver decrypts the ciphertext sequence according to the received supplementary ciphertext. The specific process is as follows:

[0060] Get all the ciphertext segments in the ciphertext sequence, where the first The method for obtaining a ciphertext segment is as follows: When bits as the first ciphertext segment, Indicates the number of character types. Indicates the length of the codeword for each character; when When bits to bits as the first ciphertext segments, Indicates The operation length of the ciphertext segment.

[0061] The operation length of each ciphertext segment is obtained in sequence, and the specific method of obtaining is as follows: When , the first element in the operation length sequence is taken as the The operation length of the ciphertext segment , delete the first element in the operation length sequence from the operation length sequence, when When the operation length sequence is not greater than The first element of The operation length of the ciphertext segment is All elements before and after are deleted from the operation length sequence.

[0062] For example, when the operation length sequence is {2,1,1,2,1,3,3,1,2,2,3,2,1,2,1,3,1,2,2,3,3,1,2,1,2,1,3,3,1,1,1, 2,3,1,3,3,2,1,2,3,2,1,2,1,3,2} and the ciphertext sequence is {010101110011101000011010111011111010111100 01010000001100}, the first 4 bits of the ciphertext sequence are used as the first ciphertext segment 0101, and the first element 2 in the operation length sequence is used as the operation length of the first ciphertext segment 0101. The operation length sequence is updated to obtain {1,1,2,1,3,3,1, 2,2,3,2,1,2,1,3,1,2,2,3,3,1,2,1,2,1,3,3,1,1,1,2,3,1,3,3,2,1,2,3,2,1,2,1,3,2}; bits to bits as the second ciphertext segment 0101, the operation length sequence is not greater than is 1, then 1 is used as the operation length of the second ciphertext segment, and the operation length sequence is updated to obtain {1,2,1,3,3,1,2,2,3,2,1,2,1,3,1, 2,2,3,3,1,2,1,2,1,3,3,1,1,1,2,3,1,3,3,2,1,2,3,2,1,2,1,3,2}; bits to bits as the third ciphertext segment 1110, the operation length sequence is not greater than is 1, then 1 is used as the operation length of the third ciphertext segment, and the operation length sequence is updated to obtain {2,1,3,3,1,2,2,3,2,1,2,1,3,1,2,2,3,3,1,2,1,2,1,3,3,1,1,1,2,3,1,3,3,2,1,2,3,2,1,2,1,3,2}; similarly, all the ciphertext segments are obtained: 0101, 0101, 1110, 0011, 1110, 0100, 1000, 0011, 1101, 0101, 0111, 1011, 1111, 1101, 1010, 0111, 1110, 1000, 0101, 0100, 0000, 0001, 1100.

[0063] The first The element as The conversion key of each ciphertext segment is used to decrypt each ciphertext segment in turn according to the conversion key of each ciphertext segment. Specifically:

[0064] For Ciphertext segment, when When Before the ciphertext segment bits as known bits, and obtain the first All code words whose bits are the same as the known bits are taken as A candidate codeword for the ciphertext segment, and the character corresponding to the candidate codeword is used as the first The candidate characters of the ciphertext segment are The conversion key for the ciphertext segment and the The candidate code words of the ciphertext segment are ciphertext segments are modified to obtain multiple modified ciphertext segments; When The first bits as known bits, and obtain the first All code words whose bits are the same as the known bits are taken as A candidate codeword for the ciphertext segment, and the character corresponding to the candidate codeword is used as the first The candidate characters of the ciphertext segment are The conversion key for the ciphertext segment and the The candidate code words of the ciphertext segment are The ciphertext segments are modified to obtain multiple modified ciphertext segments.

[0065] Among them, according to The conversion key for the ciphertext segment and the The candidate code words of the ciphertext segment are The ciphertext segments are modified to obtain multiple modified ciphertext segments, specifically:

[0066] The first After the ciphertext segment bits are used as conversion bits. When the conversion key of the ciphertext segment is 0, the conversion bit is The candidate codewords of the ciphertext segment bits and The first character of the codeword corresponding to the ciphertext segment The XOR result of bits, when the When the conversion key of the ciphertext segment is 1, the conversion bit is The candidate codewords of the ciphertext segment bits and The first character of the codeword corresponding to the ciphertext segment bits, according to the conversion key and the The posterior of each candidate codeword of the ciphertext segment bits, we can get The first character of the codeword corresponding to the ciphertext segment The various situations of bits, Before the ciphertext segment bits are replaced by The first character of the codeword corresponding to the ciphertext segment bits, to achieve The correction of the ciphertext segment is Multiple modified ciphertext segments corresponding to ciphertext segments.

[0067] For example, when the ciphertext segments are 0101, 0101, 1110, 0011, 1110, 0100, 1000, 0011, 1101, 0101, 0111, 1011, 1111, 1101, 1010, 0111, 1110, 1000, 0101, 0100, 0000, 0001, 1100, the operation lengths of each ciphertext segment are 2, 1, 1, 2, 1, 3, 1, 2, 2, 1, 2, 1, 3, 1, 2, 2, 1, 2, 1, 2, 1, 3, and the conversion key sequence is {1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0}, the codewords for each character are as follows: Figure 2As shown, the method for obtaining the candidate codewords of the first ciphertext segment is: take the first 4-2=2 bits 01 in the first ciphertext segment 0101 as the known bit, and among all the codewords of the characters, the codewords with the first 4-2=2 bits identical to the known bit 01 are 0110 and 0100 respectively. Then the candidate codewords of the first ciphertext segment are 0110 and 0100, and the corresponding candidate characters are A and H. The method for obtaining the candidate codewords of the second ciphertext segment is: take the last 4-2=2 bits of the first ciphertext segment as the known bit, and then ... The bit 01 is used as the conversion bit, the conversion key of the first ciphertext segment is 1, and the conversion bit 01 is the same or result of the last 2 bits of the candidate codeword 0110 of the first ciphertext segment and the first 2 bits of the codeword of the corresponding character of the second ciphertext segment, or the same or result of the last 2 bits of the candidate codeword 0100 and the first 2 bits of the codeword of the corresponding character of the second ciphertext segment. The first 2 bits of the codeword of the corresponding character of the second ciphertext segment are 00 or 10, and the modified ciphertext segment corresponding to the second ciphertext segment is 0001 or 1001; when the candidate codeword of the first ciphertext segment is 0110, the modified ciphertext segment corresponding to the second ciphertext segment is 0001, and the first 4-1=3 bits of the modified ciphertext segment corresponding to the second ciphertext segment are 0001. 00 is used as a known bit. Among all the code words of characters, the code words with the first 4-1=3 bits identical to the known bit 000 are 0001 and 0000, respectively. Then the candidate code words of the second ciphertext segment are 0001 and 0000, and the corresponding candidate characters are C and S. When the candidate code word of the first ciphertext segment is 0100, the modified ciphertext segment corresponding to the second ciphertext segment is 1001. The first 4-1=3 bits 100 in the modified ciphertext segment corresponding to the second ciphertext segment is 1001 are used as known bits. Among all the code words of characters, the code words with the first 4-1=3 bits identical to the known bit 100 are 1000 and 1001, respectively. Then the candidate code words of the second ciphertext segment are 1000 and 1001, and the corresponding candidate characters are B and F. By analogy, the candidate code words of each ciphertext segment can be obtained.

[0068] It should be noted that the first ciphertext segment corresponds to multiple candidate codewords, under any candidate codeword of the first ciphertext segment, the second ciphertext segment corresponds to multiple candidate codewords, under any candidate codeword of the second ciphertext segment, the third ciphertext segment corresponds to multiple candidate codewords, under any candidate codeword of the third ciphertext segment, the fourth ciphertext segment corresponds to multiple candidate codewords, ... Therefore, there are multiple decryption results for the ciphertext sequence.

[0069] The method for obtaining each decryption result is as follows: set an empty candidate decryption sequence, take any candidate codeword of the first ciphertext segment as the first elected codeword, and add the first elected codeword to the end of the candidate decryption sequence; take any candidate codeword corresponding to the second ciphertext segment under the first elected codeword as the second elected codeword, and add the second elected codeword to the end of the candidate decryption sequence; take any candidate codeword corresponding to the third ciphertext segment under the second elected codeword as the third elected codeword, and add the third elected codeword to the end of the candidate decryption sequence; and so on, until all ciphertext segments have a candidate codeword added to the candidate decryption sequence, and stop, and take the candidate decryption sequence at this time as a decryption result. Similarly, by traversing and selecting each elected codeword, multiple decryption results can be obtained.

[0070] For example, the ciphertext sequence is {01010111001110100001101011101111101011110001010000001100}, the operation length sequence is {2,1,1,2,1,3,3,1,2,2,3,2,1,2,1,3,1,2,2,3,3,1,2,1,2,1,3,3,1,1,1,2,3,1,3,3,2,1,2,3,2,1, 2,1,3,2}, and the conversion key sequence is {1,0,1,1,0,1,0,0,1,0,1,0,1,0,0,0,1,1,0,1,1,0,0,1,0}. The codewords for each character are as follows: Figure 2 When {A,S,V,B,A,D,D,D,H,G,A,D,A,F,E,H,S,F,G,B,F,S,H} is a decryption result. The decryption process corresponding to the decryption result can be found in Figure 4 , Figure 4 The gray characters in the candidate character column represent the selected characters, and the gray codewords in the candidate codeword column represent the codewords corresponding to the selected characters; {A,C,A,B,A,A,E,F,V,D,V,D,A,B,B,H,S,B,A,S,S,C,G} is a decryption result. The decryption process corresponding to the decryption result can be found in Figure 5 , Figure 5 The gray characters in the candidate character column represent the selected characters, and the gray codewords in the candidate codeword column represent the codewords corresponding to the selected characters.

[0071] Obtain a hash value for each decryption result, and use the hash value and the decryption result of the supplementary key as the final decryption result.

[0072] The final decryption result is decoded using Base64 encoding to obtain a binary sequence, and the binary sequence is decoded using GB2312 encoding to obtain plaintext data. It should be noted that the encoding method for decoding the final decryption result corresponds to that in step S001.

[0073] At this point, the decryption of the ciphertext sequence is achieved and the plaintext data is obtained.

[0074] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. An encryption method based on edge IoT agent, characterized in that: include: In the data interaction process between the edge node and the IoT device and the cloud platform, the plaintext data is converted into a character sequence; a codeword of the same length is assigned to each character; an operation length sequence is set, and the elements in the operation length sequence are integers whose size does not exceed the length of the codeword; a conversion key sequence is set, and the elements in the conversion key sequence are 0 or 1, which are used to represent different operation rules; An operation length and a conversion key are sequentially allocated to each character according to an operation length sequence and a conversion key sequence, wherein the operation length of each character does not exceed the length of the second code word of each character; and the method for obtaining the second code word of the character is as follows: if the character is the first character in the character sequence, the first bit in the code word corresponding to the character is used as the first code word of the character, and the remaining bits in the code word corresponding to the character are used as the second code word of the character, otherwise, the first bit in the code word corresponding to the character is used as the second code word of the character. bits as the first codeword of the character, and the remaining bits in the codeword corresponding to the character as the second codeword of the character, where Indicates the operation length of the character before this character; The method for obtaining the ciphertext of the character is as follows: if the character is the last character in the character sequence, the second codeword of the character is used as the ciphertext of the character; otherwise, the last codeword of the second codeword of the character is converted into the ciphertext of the character according to the conversion key of the character. bits are calculated with the first code word of the next character, and the result is concatenated to the beginning of the second code word of the character. bits later, as the ciphertext of the character, where Indicates the operation length of the character. Indicates the length of the second code word of the character; concatenates the first code word of the first character in the character sequence and the ciphertexts of all characters in the order of the characters in the character sequence to obtain a ciphertext sequence.

2. The encryption method based on edge IoT agent according to claim 1, characterized in that: Also includes: Take the hash value of the character sequence as the supplementary ciphertext.

3. The encryption method based on edge IoT agent according to claim 1, characterized in that: The step of setting the operation length sequence includes: The Logistic chaotic mapping algorithm is used to generate a The first chaotic sequence of Elements to The elements are Multiply and round the result up to get indivual Integer in the range, this integers form the operation length sequence, where Indicates the length of the character sequence, Indicates the number of character types. Indicates the round-up symbol. Represents the iteration parameter in the first key.

4. The encryption method based on edge IoT agent according to claim 1, characterized in that: The step of setting the conversion key sequence comprises: The Logistic chaotic mapping algorithm is used to generate a The second chaotic sequence of Elements to The elements are rounded to the nearest integer, and we get A number with a value of 0 or 1, The number of them constitutes the conversion key sequence, where Indicates the length of the character sequence, Represents the iteration parameter in the second key.

5. The encryption method based on edge IoT agent according to claim 1, characterized in that: The step of allocating operation lengths to each character in turn includes: The first element of the length of the second codeword not greater than the current character in the operation length sequence is used as the operation length of the current character, and the operation length of the current character and all previous elements in the operation length sequence are deleted from the operation length sequence to update the operation length sequence; and the operation length is allocated to the next character according to the updated operation length sequence.

6. The encryption method based on edge IoT agent according to claim 1, characterized in that: The method for allocating the conversion key is: The sequence number of the current character in the character sequence is recorded as , the first The element is used as the conversion key for the current character.

7. The encryption method based on edge IoT agent according to claim 1, characterized in that: The conversion key of the character is used to convert the second code word of the character to the following bits are operated with the first codeword of the next character, including: In response to the conversion key of the character being 0, the second code word for the character is bits are XORed with the first code word of the next character; in response to the conversion key of the character being 1, the next bit in the second code word of the character is The bits are XORed with the first code word of the next character.

8. The encryption method based on edge IoT agent according to claim 1, characterized in that: The step of converting the plaintext data into a character sequence includes: Use GB2312 encoding to encode the plaintext data into a binary sequence, and use Base64 encoding to encode the binary sequence into a character sequence.

9. The encryption method based on edge IoT agent according to claim 1, characterized in that: The step of allocating a codeword of the same length to each character comprises: According to the number of character types Assign a binary number of the same length to each character as the codeword of each character. The length of the codeword is ,in Indicates the round-up symbol.

Citation Information

Patent Citations

  • A distribution network communication method and system based on edge IoT agent

    CN114389642B

  • Third-party ciphertext retrieval method based on file name

    CN104794243A

  • Character coding and decoding method and device

    CN105391514A