Intelligent gateway data real-time transmission method based on HMAC and improved ECC

By introducing intermediate variables into the intelligent gateway to improve the ECC encryption algorithm and using HMAC verification, the security and efficiency problems of traditional algorithms in data transmission are solved, and efficient, stable and secure data transmission is achieved.

CN119135355APending Publication Date: 2024-12-13HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411333950.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

Traditional MD5 algorithms and ECC encryption algorithms have security problems in data transmission, and are vulnerable to collision attacks and brutally exhaustive attacks, resulting in packet loss events, and improper key length selection will reduce system security.

Method used

The intelligent gateway data real-time transmission method based on improved ECC and HMAC is adopted, and the number of calculations is reduced by introducing intermediate variables, the calculation efficiency is improved, and data integrity is verified in combination with HMAC algorithm to ensure data integrity during transmission.

Benefits of technology

It realizes more efficient, stable and reliable data transmission, reduces packet loss rate, provides a higher level of data transmission security guarantee, and ensures data integrity and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119135355A_ABST
    Figure CN119135355A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent gateway data real-time transmission method based on HMAC and improved ECC. The method comprises the following steps: step 1, collecting breaker data in real time; 2, improving an ECC encryption algorithm, encrypting and transmitting the data acquired in the step 1 to a cloud platform, and decrypting, processing and analyzing the data in the cloud platform; and step 3, the cloud platform server sends an instruction S encrypted by the ECC and transmits the instruction S to the circuit breaker gateway equipment, and integrity verification is carried out by using an HMAC algorithm. An innovative method based on an improved ECC and HMAC encryption algorithm is adopted, an intermediate variable is introduced in an inversion link to reduce the number of operations, one inversion operation is reduced compared with the traditional operation, the calculation efficiency is improved, the time is saved, the decrypted message can be verified in combination with the application of the HMAC algorithm, the integrity of data in the transmission process is ensured, and the transmission efficiency is improved. And data loss is effectively prevented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of intelligent gateway transmission encryption, and in particular to a method for real-time transmission of intelligent gateway data based on HMAC and improved ECC. Background Art

[0002] In terms of data transmission security, the traditional MD5 algorithm has been proven to have serious security issues. It is vulnerable to collision attacks, that is, finding two different input data that produce the same MD5 hash value, which is prone to packet loss. Moreover, MD5 is a hash algorithm that is only used to generate hash values, which means it is not suitable for security applications such as key exchange, identity authentication, and data integrity protection. The traditional ECC encryption algorithm needs to be cautious when selecting the key length. If the selected key length is too small, the security of the system may be reduced, because shorter keys are more vulnerable to brute force attacks and other attack methods, which in turn causes packet loss. Summary of the invention

[0003] In view of the problems of real-time data transmission and packet loss, the present invention provides a method for real-time data transmission of an intelligent gateway based on HMAC and improved ECC. An innovative method based on improved ECC and HMAC encryption algorithms is adopted, and intermediate variables are introduced in the inversion link to reduce the number of operations. Compared with traditional operations, one inversion operation is reduced, thereby improving the calculation efficiency and saving time. Combined with the application of the HMAC algorithm, the decrypted message can be verified to ensure the integrity of the data during the transmission process and effectively prevent data loss.

[0004] The technical solution adopted by the present invention is: a method for real-time transmission of intelligent gateway data based on HMAC and improved ECC, comprising the following steps:

[0005] Step 1: Collect circuit breaker data in real time;

[0006] Step 2: Improve the ECC encryption algorithm, encrypt the data collected in step 1 and transmit it to the cloud platform, where the data is decrypted, processed and analyzed;

[0007] Step 3: The cloud platform server sends the ECC-encrypted instruction S to the circuit breaker gateway device and uses the HMAC algorithm for integrity verification.

[0008] Based on the above solution, as a preferred embodiment, the real-time collection of circuit breaker data in step 1 is specifically as follows:

[0009] First, some global variables and arrays are defined to store data. Then, an infinite loop while(1) is entered to perform data processing and communication operations. In the loop, different operations are performed by judging the value of variable a. When a is equal to 50, 100, and 150, different data processing and serial communication operations are performed respectively. In each operation, the data is stored in the rs485buf array according to the set data format and field value, and the checksum is calculated. The RS485_Send_Data function is used to send the data through the serial port. The hex_to_asciistring function is called to convert the data in the rs485buf array into a string format and display it on the LCD. The RS485_Receive_Data function is used to receive the serial port data into the rs485buf1 array and convert it into a string format again. The received data is displayed on the LCD, and the data obtained in the early stage is preprocessed.

[0010] Based on the above solution, as a preferred embodiment, in step 2, an elliptic curve is defined in a finite field Fp, and y is usually used. 2 =x 3 +ax+b There are only p elements in Fp, p is a prime number, and the most expensive operation involved in the ECC algorithm during operation is

[0011] The inversion is done when the prime number is inverted, and as the order p of the prime field increases, the inversion time will be longer. In order to improve the running efficiency, M, I and S are used to represent the multiplication, inversion and square operations on the finite field respectively, and C is used to represent the multiplication, inversion and square operations on the finite field respectively. x Indicates the amount of calculation required to calculate x, the total length is I = 6M, S = 0.8M, take any two points P(x1, y1), Q(x2, y2), then P+Q = (x3, y3)

[0012]

[0013] Calculate 2P according to formula 1, then C 2P =2M+2I+2S=15.6, two inversion operations are required, so the variable

[0014]

[0015] The intermediate variable a in formula 2 represents the value of the slope λ plus 1, that is, a=λ+1. By introducing the intermediate variable a, an inversion operation can be avoided. Specifically, according to the point addition formula on the elliptic curve, the calculation method of the intermediate variable a is as follows:

[0016]

[0017] After introducing λ1, formula 1 becomes

[0018] At this time, only one inverse calculation is needed on the original basis, so the amount of calculation required to complete one doubling operation becomes C 2P =I+2S+2M=9.6M. In actual operation, the value of k will be very large. If the traditional method is used, 32 addition operations and 64 inversion operations are required. However, according to 2 k P's method only needs 5 addition operations and 5 inversion operations to get the result, so this method can exponentially shorten the search time. Because multiple key exchange protocols are used in elliptic curves, multi-point multiplication operations such as kP+lQ are used to introduce intermediate variables.

[0019]

[0020] From this we know that formula 1 becomes

[0021]

[0022] The amount of computation required to complete a point addition operation is C P+Q =I+S+2M=8.8M, which reduces the amount of inversion calculation by one time compared with the traditional calculation formula. When calculating 2P+Q=(x4,y4), we can use P+P+Q to get it. Using the above method, we can borrow the intermediate variable

[0023]

[0024] According to formula 6, we can simplify the values ​​of x4 and y4.

[0025]

[0026] Substitute the above formula of y3 into λ3 and simplify it to get

[0027]

[0028] By introducing the above parameters, the calculation of y3 can be omitted, thereby reducing one multiplication and improving the calculation efficiency. In the finite field Fp, a+b≡c(modp), a×b≡c(modp), a / b≡c(modp), 4a 3 +27b 2≡ 0 (mod p), where b is a non - negative integer less than p, x and y are integers between 0 and p - 1. The curve is denoted as Ep(a, b). A selects a point G on the curve as the generator and finds that the order of G is n, where n must be a prime number. A selects a private key k (k < n) and generates the public key Q = kG. Then A sends the elliptic curve, k, and G to B. After receiving them, B encodes the plaintext into a point M on the elliptic curve and generates a random number r. B calculates the point C1 = M + rK and C2 = rG, and B sends C1 and C2 to A. A calculates C1 - kC2 = M + rkG - krG = M, and A decodes M to obtain the plaintext. In the above description, A represents the circuit breaker and B represents the cloud platform server.

[0029] Based on the above - mentioned scheme, preferably, the encryption communication configuration process includes:

[0030] S1: Create a message queue: Create a RabbitMQ message queue on the cloud platform for data transmission between the circuit breaker and the cloud platform;

[0031] S2: Generate two pairs of asymmetric encryption key pairs P1, P12 and P2, P22 through an improved ECC algorithm;

[0032] S3: Based on P1 and P22, perform ECC encryption communication configuration for the circuit breaker device and the cloud platform server;

[0033] S4: Based on P12 and P2, use the ECC communication method to perform encryption communication configuration between the cloud platform server and the circuit breaker to obtain a reply message;

[0034] S5: The circuit breaker device determines whether the circuit breaker encryption communication configuration is successful based on the reply message;

[0035] S6: The circuit breaker device encrypts and transmits the reply message and the data W to be sent to the cloud platform server to obtain message B;

[0036] S7: The cloud platform server determines whether the communication is secure based on message B.

[0037] Based on the above - mentioned scheme, preferably, step S3 includes:

[0038] S31: Obtain the private key P22 and the public key P1 used by the circuit breaker device from the cloud platform server;

[0039] S32: Configure P22 and P1 for the circuit breaker device.

[0040] Based on the above - mentioned scheme, preferably, step S4 includes:

[0041] S41, the cloud platform server performs corresponding encoding operations on the key according to the secure hash function SHA-1 to form a 160-bit digital summary information H1;

[0042] S42, the cloud platform server uses P12 to digitally sign the summary information H1 to obtain D1;

[0043] S43, the cloud platform server uses P2 to encrypt D1 to obtain M1;

[0044] S44, the cloud platform server sends M1 to the circuit breaker device;

[0045] S45, the circuit breaker device uses P22 to decrypt M1 to obtain Q2 and the digitally signed data D1;

[0046] S46, the circuit breaker device uses the secure hash function SHA-1 to perform a corresponding encoding operation on Q2 to form a 160-bit digital summary information H2;

[0047] S47, the circuit breaker device uses P1 to decrypt the digital signature of D1 to obtain summary information H1;

[0048] S48. The circuit breaker device compares the summary information H1 and H2, and generates reply data A based on the comparison result, wherein the reply data content is A1 when the summary information H1 and H2 are equal or A2 when the summary information H1 and H2 are not equal; if the summary information H1 is not equal to H2, it indicates that the data may be dropped during the data transmission process and the digital signature is invalid. The circuit breaker device generates reply data A2, the content of which is: the symmetric encryption key configuration failed, please reconfigure; if the summary information H1 is equal to H2, it indicates that there is no packet loss during the data transmission process and the digital signature is valid. The circuit breaker device generates reply data A1, the content of which is: the symmetric encryption key configuration is successful.

[0049] On the basis of the above scheme, as a preference, step S5 includes: the reply data A obtained through step S4, if the reply data is A1, it indicates that the symmetric encryption key configuration of the circuit breaker device is successful; if the reply data is A2, it indicates that the symmetric encryption key configuration of the circuit breaker device fails.

[0050] Based on the above solution, preferably, step S6 includes:

[0051] S61, the circuit breaker device performs corresponding encoding operation on the reply data A according to the secure hash function SHA-1 to form a 160-bit digital summary information H3;

[0052] S62, the circuit breaker device uses the private key P22 to digitally sign the summary information H3 to obtain the signed data D2;

[0053] S63, the circuit breaker device uses the public key P1 to encrypt the reply data A and the signed data D2 to obtain M2;

[0054] S64, the cloud platform server uses the private key P12 to decrypt the data M2 to obtain the reply data A and the digitally signed data D2;

[0055] S65, the cloud platform server performs corresponding encoding operations on the reply data A according to the secure hash function SHA-1 to form a 160-bit digital summary information H4;

[0056] S66, the cloud platform server uses the public key P2 to sign the intercepted data D2 to obtain the summary information H3;

[0057] S67. The cloud platform server compares the summary information H3 and H4 and generates information B. If H3 and H4 are not equal, it indicates that the data may be dropped or lost during the communication transmission process, and information B2 is generated. At this time, steps S2 to S6 are repeated until H3 is equal to H4; if H3 and H4 are the same, information B1 is generated, indicating that the data has not been lost during the communication transmission process and the digital signature is valid.

[0058] Based on the above solution, as a preferred embodiment, step S7 includes: if the reply message is A1, it indicates that the encryption key is successful; if the reply content is A2, it indicates that the configuration fails, and steps S2 to S7 are repeated until the reply content is A1.

[0059] Based on the above solution, as a preferred embodiment, step 2 specifically includes the following steps:

[0060] (a) The circuit breaker device encrypts data D using the symmetric encryption key Q2 to generate encrypted data D1;

[0061] (b) The circuit breaker device transmits the encrypted data D to the cloud platform server using Ethernet communication;

[0062] (c) The cloud platform server receives the encrypted data D1 and decrypts D1 using the symmetric encryption key Q1 to obtain data D;

[0063] (d) Display data D on the cloud platform server.

[0064] (e) Decrypt and store the data D transmitted from the circuit breaker. First, create a device management module to manage and track all devices connected to the cloud platform. Define the device's attributes, status, identifiers and other information in the module to uniquely identify and manage the device. Secondly, create an intelligent gateway module to implement communication protocols with physical devices, data parsing and conversion and other functions in the module. Use Java's string processing functions to process the received string data. These functions can split, slice and replace strings according to the format and delimiters of the data to extract the required data fields and filter the data. The data usually contains various attributes and fields. Filter conditions can be defined to only receive data that meets specific attribute conditions. In order to obtain data from the device and transmit it to the cloud platform for unified management.

[0065] Based on the above solution, as a preferred embodiment, step three specifically includes the following steps:

[0066] (1) The cloud platform server uses the symmetric encryption key Q1 to encrypt instruction S and generate encrypted data S1;

[0067] (2) The cloud platform server transmits the encrypted data S1 to the circuit breaker gateway device using Ethernet communication;

[0068] (3) The circuit breaker gateway device receives the encrypted data S1 and decrypts S1 using the configured key Q2 to obtain the instruction S;

[0069] (4) The circuit breaker takes corresponding action according to instruction S.

[0070] Compared with the prior art, the present invention has the following beneficial effects:

[0071] (1) The present invention improves the ECC encryption algorithm by introducing intermediate variables, making the inverse less time-consuming and more efficient. The operation results are as follows: Figure 7 As shown. Through real-time data transmission, more efficient, stable and reliable transmission efficiency can be achieved. At the same time, remote monitoring of the operating status of the circuit breaker can be achieved, and fault warning and maintenance optimization can be achieved.

[0072] (2) By improving ECC and applying the HMAC algorithm for integrity verification, the packet loss rate is greatly reduced and data transmission is more efficient. The specific results are shown in the figure below. Figure 6 As shown,

[0073] (3) This paper adopts the RabbitMQ message queue method to achieve seamless connection of cross-platform transmission. Through this integration method, data transmission is decoupled and traffic peaks are cut, making data transmission more efficient and stable.

[0074] (4) The present invention can transmit data in real time through RabbitMQ, so that users can instantly obtain the real-time data of the circuit breaker and provide feedback and adjustments in a timely manner. In terms of real-time visualization, the real-time data of the circuit breaker is presented in a visual manner, such as a real-time curve chart, Echarts icon, etc., so that users can intuitively observe the operating status and parameter changes of the circuit breaker. Compared with traditional text output, real-time visualization provides a more intuitive and intuitive way to understand the performance of circuit breakers and gateways. In terms of security and confidentiality, innovative methods of improving ECC and HMAC encryption algorithms can provide a higher level of data transmission security. In particular, the application of the HMAC algorithm can verify the decrypted message, ensure the integrity of the data during transmission, and effectively prevent data tampering and damage. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] Figure 1 System overall block diagram;

[0076] Figure 2 Overall flow chart of the algorithm;

[0077] Figure 3 HMAC principle block diagram;

[0078] Figure 4 Message queue flow chart;

[0079] Figure 5 User interface functional diagram;

[0080] Figure 6 The result diagram after optimization of the present invention;

[0081] Figure 7 Improved comparison chart;

[0082] Figure 8 ECC encryption and decryption flow chart. DETAILED DESCRIPTION

[0083] The present invention and the retrograde operation are further described below in conjunction with the accompanying drawings in the examples of the present invention.

[0084] like Figure 1-8 As shown, a method for real-time transmission of intelligent gateway data based on HMAC and improved ECC includes the following steps:

[0085] Step 1: Collect circuit breaker data in real time;

[0086] Step 2: Improve the ECC encryption algorithm, encrypt the data collected in step 1 and transmit it to the cloud platform, where the data is decrypted, processed and analyzed.

[0087] Step 3: The cloud platform server sends the ECC-encrypted instruction S to the circuit breaker gateway device and uses the HMAC algorithm for integrity verification.

[0088] The real-time collection of circuit breaker data in step 1 is as follows:

[0089] First, some global variables and arrays are defined, such as rs485buf, App_E_Meters_id, Avoltage, etc., for storing data. Then, an infinite loop while(1) is entered, in which data processing and communication operations are performed. In the loop, different operations are performed by judging the value of variable a. When a is equal to 50, 100, and 150, different data processing and serial communication operations are performed respectively. In each operation, according to the set data format and field value, the data is stored in the rs485buf array, and the checksum is calculated. The RS485_Send_Data function is used to send the data through the serial port. The hex_to_asciistring function is called to convert the data in the rs485buf array into a string format and display it on the LCD. The RS485_Receive_Data function is used to receive the serial port data into the rs485buf1 array and convert it into a string format again. The received data is displayed on the LCD. The data obtained in the early stage is preprocessed.

[0090] The improved ECC algorithm process in step 2 is as follows Figure 8 As shown, elliptic curves are defined in a finite field Fp, and y is commonly used 2 =x 3 +ax+b There are only p elements in Fp, p is a prime number, and the most expensive operation involved in the ECC algorithm during operation is

[0091] The inversion is done when the prime number is inverted, and as the order p of the prime field increases, the inversion time will be longer. In order to improve the running efficiency, M, I and S are used to represent the multiplication, inversion and square operations on the finite field respectively, and C is used to represent the multiplication, inversion and square operations on the finite field respectively. x Indicates the amount of calculation required to calculate x, the total length is I = 6M, S = 0.8M, take any two points P(x1, y1), Q(x2, y2), then P+Q = (x3, y3)

[0092]

[0093] Calculate 2P according to formula 1, then C 2P =2M+2I+2S=15.6, two inversion operations are required, so the variable

[0094]

[0095] The intermediate variable a in formula 2 represents the value of the slope λ plus 1, that is, a=λ+1. By introducing the intermediate variable a, an inversion operation can be avoided. Specifically, according to the point addition formula on the elliptic curve, the calculation method of the intermediate variable a is as follows:

[0096]

[0097] After introducing λ1, formula 1 becomes

[0098] At this time, only one inverse calculation is needed on the original basis, so the amount of calculation required to complete one doubling operation becomes C 2P =I+2S+2M=9.6M. In our actual operation, the value of k will be very large. If we follow the traditional method, we need to perform 32 addition operations and 64 inversion operations. However, according to 2 k P's method only needs 5 addition operations and 5 inversion operations to get the result, so this method can shorten the search time exponentially. The specific results are shown in the figure below. Figure 7 As shown. Because multiple key exchange protocols are used in elliptic curves, multi-point multiplication operations such as kP+lQ are required. Based on the above ideas, intermediate variables are introduced.

[0099]

[0100] From this we know that formula 1 becomes

[0101]

[0102] The amount of calculation required to complete a point addition operation is C P+Q =I+S+2M=8.8M, which reduces the amount of inversion calculation by one time compared with the traditional calculation formula. In summary, when calculating 2P+Q=(x4,y4), we can use P+P+Q to get, and use the above method to borrow the intermediate variable

[0103]

[0104] According to formula 6, we can simplify the values ​​of x4 and y4.

[0105]

[0106] Substitute the above formula of y3 into λ3 and simplify it to get

[0107]

[0108] By introducing the above parameters, the calculation of y3 can be omitted, thereby reducing one multiplication and improving the calculation efficiency.

[0109] The comparison results are shown in Table 1.

[0110] Curve Group Calculation ECC before improvement Improved ECC P+Q 2I+S+2M=14.8M I+S+2M=8.8M 2P 2I+S+2M=14.8M I+2S+2M=9.6M 2P+Q 4I+2S+4MM=29.6M 2I+2S+M=14.6M

[0111] In the finite field \(F_p\), \(a + b\equiv c\ (\text{mod}\ p)\), \(a\times b\equiv c\ (\text{mod}\ p)\), \(a / b\equiv c\ (\text{mod}\ p)\), \(4a\) 3 + 27b 2 \(= 0\ (\text{mod}\ p)\), where \(b\) is a non - negative integer less than \(p\), \(x,y\) belong to the set of integers between \(0\) and \(p - 1\), and the curve is denoted as \(E_p(a,b)\). A selects a point \(G\) on the curve as the generator and finds that the order of \(G\) is \(n\), where \(n\) must be a prime number. A selects a private key \(k\) (\(k\lt n\)) and generates the public key \(Q = kG\). Then A sends the elliptic curve, \(k\), and \(G\) to B. After receiving them, B encodes the plaintext into a point \(M\) on the elliptic curve and generates a random number \(r\). B calculates the point \(C_1 = M + rK\), \(C_2 = rG\), and B sends \(C_1\) and \(C_2\) to A. A calculates \(C_1 - kC_2 = M + rkG - krG = M\), and A decodes \(M\) to obtain the plaintext. In the above description, A represents the circuit breaker in this patent, and B represents the cloud platform server.

[0112] The process of encrypting communication configuration includes:

[0113] S1: Create a message queue: Create a RabbitMQ message queue on the cloud platform for data transmission between the circuit breaker and the cloud platform.

[0114] S2: Generate two pairs of asymmetric encryption key pairs \(P_1\), \(P_{12}\) and \(P_2\), \(P_{22}\) through the ECC algorithm;

[0115] S3: Configure ECC encrypted communication between the circuit breaker device and the cloud platform server based on \(P_1\) and \(P_{22}\);

[0116] S4: Configure encrypted communication between the cloud platform server and the circuit breaker in the way of ECC communication based on \(P_{12}\), \(P_2\) to obtain a reply message;

[0117] S5: The circuit breaker device determines whether the encrypted communication configuration of the circuit breaker is successful based on the reply message;

[0118] S6: The circuit breaker device encrypts and transmits the reply message and the data \(W\) to be sent to the cloud platform server to obtain the message B;

[0119] S7: The cloud platform server determines whether the communication is secure based on the message B.

[0120] Step S3 includes:

[0121] S31: Obtain the private key \(P_{22}\) and the public key \(P_1\) used by the circuit breaker device from the cloud platform server;

[0122] S32. Configure P22 and P1 for the circuit breaker device.

[0123] Step S4 includes:

[0124] S41, the cloud platform server performs corresponding encoding operations on the key according to the secure hash function SHA-1 to form a 160-bit digital summary information H1;

[0125] S42, the cloud platform server uses P12 to digitally sign the summary information H1 to obtain D1;

[0126] S43, the cloud platform server uses P2 to encrypt D1 to obtain M1;

[0127] S44, the cloud platform server sends M1 to the circuit breaker device;

[0128] S45, the circuit breaker device uses P22 to decrypt M1 to obtain Q2 and the digitally signed data D1;

[0129] S46, the circuit breaker device uses the secure hash function SHA-1 to perform a corresponding encoding operation on Q2 to form a 160-bit digital summary information H2;

[0130] S47, the circuit breaker device uses P1 to decrypt the digital signature of D1 to obtain summary information H1;

[0131] S48. The circuit breaker device compares the summary information H1 and H2, and generates reply data A based on the comparison result, wherein the reply data content is A1 when the summary information H1 and H2 are equal or A2 when the summary information H1 and H2 are not equal; if the summary information H1 is not equal to H2, it indicates that the data may be dropped during the data transmission process and the digital signature is invalid. The circuit breaker device generates reply data A2, the content of which is: the symmetric encryption key configuration failed, please reconfigure; if the summary information H1 is equal to H2, it indicates that there is no packet loss during the data transmission process and the digital signature is valid. The circuit breaker device generates reply data A1, the content of which is: the symmetric encryption key configuration is successful.

[0132] Step S5 includes: the reply data A obtained in step S4, if the reply data is A1, it indicates that the symmetric encryption key configuration of the circuit breaker device is successful, if the reply data is A2, it indicates that the symmetric encryption key configuration of the circuit breaker device fails.

[0133] Step S6 includes:

[0134] S61, the circuit breaker device performs corresponding encoding operation on the reply data A according to the secure hash function SHA-1 to form a 160-bit digital summary information H3;

[0135] S62, the circuit breaker device uses the private key P22 to digitally sign the summary information H3 to obtain the signed data D2;

[0136] S63, the circuit breaker device uses the public key P1 to encrypt the reply data A and the signed data D2 to obtain M2;

[0137] S64, the cloud platform server uses the private key P12 to decrypt the data M2 to obtain the reply data A and the digitally signed data D2;

[0138] S65, the cloud platform server performs corresponding encoding operations on the reply data A according to the secure hash function SHA-1 to form a 160-bit digital summary information H4;

[0139] S66, the cloud platform server uses the public key P2 to sign the intercepted data D2 to obtain the summary information H3;

[0140] S67. The cloud platform server compares the summary information H3 and H4 and generates information B. If H3 and H4 are not equal, it indicates that the data may be dropped or lost during the communication transmission process, and information B2 is generated. At this time, steps S2 to S6 are repeated until H3 is equal to H4; if H3 and H4 are the same, information B1 is generated, indicating that the data has not been lost during the communication transmission process and the digital signature is valid.

[0141] Step S7 includes: if the reply message is A1, it indicates that the encryption key is successful; if the reply content is A2, it indicates that the configuration fails, and repeat steps S2 to S7 until the reply content is A1.

[0142] Furthermore, step 2 specifically includes the following steps:

[0143] (a) The circuit breaker device encrypts data D using the symmetric encryption key Q2 to generate encrypted data D1;

[0144] (b) The circuit breaker device transmits the encrypted data D to the cloud platform server using Ethernet communication;

[0145] (c) The cloud platform server receives the encrypted data D1 and decrypts D1 using the symmetric encryption key Q1 to obtain data D;

[0146] (d) Display data D on the cloud platform server.

[0147] (e) Decrypt and store the data D transmitted from the circuit breaker. First, create a device management module to manage and track all devices connected to the cloud platform. Define the device's attributes, status, identifiers and other information in the module to uniquely identify and manage the device. Secondly, create an intelligent gateway module to implement communication protocols with physical devices, data parsing and conversion and other functions in the module. Use Java's string processing functions to process the received string data. These functions can split, slice and replace strings according to the format and delimiters of the data to extract the required data fields and filter the data. The data usually contains various attributes and fields. Filter conditions can be defined to only receive data that meets specific attribute conditions. In order to obtain data from the device and transmit it to the cloud platform for unified management.

[0148] Step three specifically includes the following steps:

[0149] (1) The cloud platform server uses the symmetric encryption key Q1 to encrypt instruction S and generate encrypted data S1;

[0150] (2) The cloud platform server transmits the encrypted data S1 to the circuit breaker gateway device using Ethernet communication;

[0151] (3) The circuit breaker gateway device receives the encrypted data S1 and decrypts S1 using the configured key Q2 to obtain the instruction S;

[0152] (4) The circuit breaker takes corresponding action according to instruction S.

[0153] A method for real-time transmission of gateway data, comprising a cloud platform server, a key distribution device and a circuit breaker gateway device;

[0154] The cloud platform server generates an ECC key pair, and performs encryption communication configuration between the cloud platform server and the circuit breaker device based on the key distribution device;

[0155] After successful configuration, the circuit breaker gateway device will encrypt the collected data D through ECC and transmit it to the cloud platform server.

[0156] The cloud platform server sends an ECC-encrypted instruction S to the circuit breaker gateway device;

[0157] The encrypted communication configuration process includes:

[0158] S1: The cloud platform server generates two pairs of asymmetric encryption key pairs P1, P12 and P2, P22 through the ECC algorithm;

[0159] S2: Based on P1 and P22, use the key distribution device to configure ECC encrypted communication between the cloud platform server and the circuit breaker gateway device;

[0160] S3: Based on P12 and P2, use ECC communication to configure encrypted communication between the cloud platform server and the circuit breaker gateway device, and get reply information;

[0161] S4: The circuit breaker gateway device determines whether the symmetric encryption communication configuration of the circuit breaker device is successful based on the reply information;

[0162] S5: The circuit breaker gateway device encrypts the reply information and the data W to be sent and transmits them to the cloud platform server to obtain information B;

[0163] S6: The cloud platform server determines whether the communication is secure based on information B.

[0164] It also includes user interface design, designing a user interface to display real-time data and optimization results.

[0165] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent transformation or modification made according to the spirit of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for real-time transmission of intelligent gateway data based on HMAC and improved ECC, It is characterized in that The steps include: Step 1: Collect circuit breaker data in real time; Step 2: Improve the ECC encryption algorithm, encrypt the data collected in step 1 and transmit it to the cloud platform, where the data is decrypted, processed and analyzed; Step 3: The cloud platform server sends the ECC-encrypted instruction S to the circuit breaker gateway device and uses the HMAC algorithm for integrity verification.

2. The method for real-time transmission of intelligent gateway data based on HMAC and improved ECC as described in claim 1, It is characterized in that The real-time collection of circuit breaker data in step 1 is as follows: First, some global variables and arrays are defined to store data. Then, an infinite loop while(1) is entered to perform data processing and communication operations. In the loop, different operations are performed by judging the value of variable a. When a is equal to 50, 100, and 150, different data processing and serial communication operations are performed respectively. In each operation, the data is stored in the rs485buf array according to the set data format and field value, and the checksum is calculated. The RS485_Send_Data function is used to send the data through the serial port. The hex_to_asciistring function is called to convert the data in the rs485buf array into a string format and display it on the LCD. The RS485_Receive_Data function is used to receive the serial port data into the rs485buf1 array and convert it into a string format again. The received data is displayed on the LCD, and the data obtained in the early stage is preprocessed.

3. The method for real-time transmission of intelligent gateway data based on HMAC and improved ECC as described in claim 1, It is characterized in that In step 2, an elliptic curve is defined in a finite field Fp, and y is usually used. 2 =x 3 +ax+b, there are only p elements in Fp, p is a prime number, the most time-consuming operation involved in the ECC algorithm during operation is the inversion, and as the order p of the prime field increases, the inversion time will be longer. In order to improve the operation efficiency, M, I and S are used to represent the multiplication, inversion and square operations on the finite field respectively, and C is used to represent the multiplication, inversion and square operations on the finite field respectively. x represents the amount of calculation required to calculate x, the total length I = 6M, S = 0.8M, take any two points P(x1, y1), Q(x2, y2), then P+Q = (x 3 ,y 3 ) Calculate 2P according to formula 1, then C 2P =2M+2I+2S=15.6, two inversion operations are required, so the variable The intermediate variable a in formula 2 represents the value of the slope λ plus 1, that is, a=λ+1. By introducing the intermediate variable a, an inversion operation can be avoided. Specifically, according to the point addition formula on the elliptic curve, the calculation method of the intermediate variable a is as follows: Introducing λ 1 Then formula 1 becomes At this time, only one inverse calculation is needed on the original basis, so the amount of calculation required to complete one doubling operation becomes C 2P =I+2S+2M=9.6M. In actual operation, the value of k will be very large. If the traditional method is used, 32 addition operations and 64 inversion operations are required. However, according to 2 k P's method only needs 5 addition operations and 5 inversion operations to get the result, so this method can shorten the search time exponentially. Because multiple key exchange protocols are used in elliptic curves, multi-point multiplication operations such as kP+lQ are used to introduce intermediate variables. From this we know that formula 1 becomes The amount of calculation required to complete a point addition operation is C P+Q =I+S+2M=8.8M, which reduces the amount of inversion calculation by one time compared with the traditional calculation formula. Calculate 2P+Q=(x 4 ,y 4 ), we can use P+P+Q to get, and use the above method to borrow the intermediate variable According to formula 6, we can simplify it to get x 4 ,y 4 Value Substitute the above formula of y3 into λ3 and simplify it to get By introducing the above parameters, the calculation of y3 can be omitted, thus reducing one multiplication and improving the calculation efficiency. In the finite field Fp, a + b ≡ c (mod p), a × b ≡ c (mod p), a / b ≡ c (mod p), 4a 3 + 27b 2 = 0 (mod p), where b is a non - negative integer less than p, x and y belong to the integers between 0 and p - 1, the curve is denoted as Ep(a, b). A selects a point G on the curve as the generator and finds the order of G to be n, where n must be a prime number. A selects a private key k (k < n) and generates the public key Q = kG. Then A sends the elliptic curve, k, and G to B. After receiving them, B encodes the plaintext into a point M on the elliptic curve and generates a random number r. B calculates the point C1 = M + rK and C2 = rG, and B sends C1 and C2 to A. A calculates C1 - kC2 = M + rkG - krG = M, and A decodes M to obtain the plaintext. In the above description, A represents the circuit breaker and B represents the cloud platform server.

4. The method for real-time transmission of intelligent gateway data based on HMAC and improved ECC as described in claim 1, It is characterized in that The encrypted communication configuration process includes: S1: Create a message queue: Create a RabbitMQ message queue on the cloud platform for data transmission between the circuit breaker and the cloud platform; S2: Generate two pairs of asymmetric encryption key pairs P1, P12 and P2, P22 through the improved ECC algorithm; S3: Based on P1 and P22, ECC encryption communication configuration is performed between the circuit breaker device and the cloud platform server; S4: Based on P12 and P2, use ECC communication to configure encrypted communication between the cloud platform server and the circuit breaker, and obtain reply information; S5: The circuit breaker device determines whether the circuit breaker encryption communication configuration is successful based on the reply information; S6: The circuit breaker device encrypts the reply information and the data W to be sent and transmits them to the cloud platform server to obtain information B; S7: The cloud platform server determines whether the communication is secure based on information B.

5. The method for real-time transmission of intelligent gateway data based on HMAC and improved ECC as described in claim 4, It is characterized in that Step S3 includes: S31. Obtain the private key P22 and public key P1 used by the circuit breaker device from the cloud platform server; S32. Configure P22 and P1 for the circuit breaker device.

6. The method for real-time transmission of intelligent gateway data based on HMAC and improved ECC as described in claim 4, It is characterized in that Step S4 includes: S41, the cloud platform server performs corresponding encoding operations on the key according to the secure hash function SHA-1 to form a 160-bit digital summary information H1; S42, the cloud platform server uses P12 to digitally sign the summary information H1 to obtain D1; S43, the cloud platform server uses P2 to encrypt D1 to obtain M1; S44, the cloud platform server sends M1 to the circuit breaker device; S45, the circuit breaker device uses P22 to decrypt M1 to obtain Q2 and the digitally signed data D1; S46, the circuit breaker device uses the secure hash function SHA-1 to perform a corresponding encoding operation on Q2 to form a 160-bit digital summary information H2; S47, the circuit breaker device uses P1 to decrypt the digital signature of D1 to obtain summary information H1; S48. The circuit breaker device compares the summary information H1 and H2, and generates reply data A based on the comparison result, wherein the reply data content is A1 when the summary information H1 and H2 are equal or A2 when the summary information H1 and H2 are not equal; if the summary information H1 is not equal to H2, it indicates that the data may be dropped during the data transmission process and the digital signature is invalid. The circuit breaker device generates reply data A2, the content of which is: the symmetric encryption key configuration failed, please reconfigure; if the summary information H1 is equal to H2, it indicates that there is no packet loss during the data transmission process and the digital signature is valid. The circuit breaker device generates reply data A1, the content of which is: the symmetric encryption key configuration is successful.

7. The method for real-time transmission of intelligent gateway data based on HMAC and improved ECC as described in claim 4, It is characterized in that Step S5 includes: the reply data A obtained in step S4, if the reply data is A1, it indicates that the symmetric encryption key configuration of the circuit breaker device is successful, if the reply data is A2, it indicates that the symmetric encryption key configuration of the circuit breaker device fails.

8. The method for real-time transmission of intelligent gateway data based on HMAC and improved ECC as described in claim 4, It is characterized in that Step S6 includes: S61, the circuit breaker device performs corresponding encoding operation on the reply data A according to the secure hash function SHA-1 to form a 160-bit digital summary information H3; S62, the circuit breaker device uses the private key P22 to digitally sign the summary information H3 to obtain the signed data D2; S63, the circuit breaker device uses the public key P1 to encrypt the reply data A and the signed data D2 to obtain M2; S64, the cloud platform server uses the private key P12 to decrypt the data M2 to obtain the reply data A and the digitally signed data D2; S65, the cloud platform server performs corresponding encoding operations on the reply data A according to the secure hash function SHA-1 to form a 160-bit digital summary information H4; S66, the cloud platform server uses the public key P2 to sign the intercepted data D2 to obtain the summary information H3; S67. The cloud platform server compares the summary information H3 and H4 and generates information B. If H3 and H4 are not equal, it indicates that the data may be dropped or lost during the communication transmission process, and information B2 is generated. At this time, steps S2 to S6 are repeated until H3 is equal to H4; if H3 and H4 are the same, information B1 is generated, indicating that the data has not been lost during the communication transmission process and the digital signature is valid.

9. The method for real-time transmission of intelligent gateway data based on HMAC and improved ECC as described in claim 4, It is characterized in that Step S7 includes: if the reply message is A1, it indicates that the encryption key is successful; if the reply content is A2, it indicates that the configuration fails, and repeat steps S2 to S7 until the reply content is A1.

10. The method for real-time transmission of intelligent gateway data based on HMAC and improved ECC as described in claim 1, It is characterized in that Step 2 specifically includes the following steps: (a) The circuit breaker device encrypts data D using the symmetric encryption key Q2 to generate encrypted data D1; (b) The circuit breaker device transmits the encrypted data D to the cloud platform server using Ethernet communication; (c) The cloud platform server receives the encrypted data D1 and decrypts D1 using the symmetric encryption key Q1 to obtain data D; (d) Displaying data D on the cloud platform server, (e) Decrypt and store the data D transmitted from the circuit breaker. First, create a device management module to manage and track all devices connected to the cloud platform. Define the device's attributes, status, identifier and other information in the module to uniquely identify and manage the device. Next, create an intelligent gateway module to implement the communication protocol with the physical device, data parsing and conversion and other functions in the module. Use Java's string processing functions to process the received string data. These functions can split, slice and replace strings according to the data format and delimiters to extract the required data fields and filter data. Data usually contains various attributes and fields. Filter conditions can be defined to only receive data that meets specific attribute conditions, so as to obtain data from the device and transmit it to the cloud platform for unified management. Step three specifically includes the following steps: (1) The cloud platform server uses the symmetric encryption key Q1 to encrypt instruction S and generate encrypted data S1; (2) The cloud platform server transmits the encrypted data S1 to the circuit breaker gateway device using Ethernet communication; (3) The circuit breaker gateway device receives the encrypted data S1 and decrypts S1 using the configured key Q2 to obtain the instruction S; (4) The circuit breaker takes corresponding action according to instruction S.