A protocol processing method, device, electronic device and medium for multi-protocol conversion

By adopting multi-protocol conversion methods in smart hydropower stations, the problem of inconsistent protocols of different devices is solved, confidential communication and data security between devices are achieved, the complexity of system construction is reduced, and the system flexibility and scalability are improved.

CN117319516BActive Publication Date: 2024-10-11CHINA THREE GORGES CORPORATION +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311522891.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-15
Publication Date
2024-10-11
Estimated Expiration
2043-11-15

AI Technical Summary

Technical Problem

The communication protocols used by different devices in smart hydropower stations are inconsistent, resulting in complex system integration and data flow. Data security has become a focus, and confidential communication between devices with different protocols needs to be achieved.

Method used

The protocol processing method of multi-protocol conversion is adopted to achieve protocol format conversion and encryption by obtaining and converting the header fields and data fields of message data to ensure communication and data security between different devices. Specific steps include obtaining the message data of the source device, converting the header fields, generating keys based on the encryption basis for encryption and decryption, splicing the message data, and performing corresponding decryption on the target device.

Benefits of technology

It achieves seamless and confidential communication between devices with different protocols, reduces the complexity of system construction, improves system flexibility and scalability, and enables equipment to be put into use without major modifications when replacing or upgrading equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117319516B_ABST
    Figure CN117319516B_ABST
Patent Text Reader

Abstract

The present invention relates to a protocol processing method, device, electronic device and medium for multi-protocol conversion, which first converts the first header field data in the first message data into the second header field data, and then uses the converted second header field data to encrypt the first data field data in the first message data to obtain the second data field data, and then splices the two to obtain the second message data sent to the target device. After receiving the second message data, the target device only needs to use the same decryption algorithm to decrypt the second data field data according to the second header field data to obtain the original first data field data, thereby realizing the conversion from the first protocol to the second protocol between the source device and the target device, so that the two can communicate normally. In addition, encryption is also realized in the conversion process, achieving the goal of confidential communication between devices of different protocols.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent network equipment, and in particular to a protocol processing method, device, electronic equipment and medium for multi-protocol conversion. Background Art

[0002] In order to achieve efficient operation and management in smart hydropower stations, it is necessary to collect data information from multiple data sources. These data sources include but are not limited to sensors, metering equipment, and monitoring systems of hydropower station equipment. By collecting and analyzing this data, the status and performance of the hydropower station can be understood in real time, and predictions and optimizations can be made through intelligent algorithms. Therefore, data collection in smart hydropower stations becomes crucial.

[0003] However, in actual applications, different devices use different communication protocols, making the architecture design of smart hydropower plants very complex and difficult. These devices cover a variety of manufacturers, models, and specifications, and there are different data formats and communication protocols between them. To achieve data exchange and sharing between multiple devices, it is necessary to overcome the problem of inconsistent communication protocols. This protocol gap makes system integration and data flow complicated, requiring a lot of engineering and resources. Therefore, ensuring that different devices can communicate and collaborate seamlessly has become an important challenge in the design of smart hydropower plants.

[0004] In addition, since hydropower stations are infrastructure related to people's livelihood, their data security is also a concern. Therefore, people urgently need a protocol processing method that can realize conversion between multiple protocols to achieve confidential communication between devices with different protocols, so as to reduce the complexity of system construction in smart hydropower stations while ensuring data security. Summary of the invention

[0005] In view of this, it is necessary to provide a protocol processing method, device, electronic device and medium for multi-protocol conversion to solve the problem of how to achieve confidential communication between devices with different protocols.

[0006] In order to achieve the above technical objectives, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a protocol processing method for multi-protocol conversion, comprising:

[0008] Acquire first message data based on a first protocol sent by a source device, wherein the first message data includes first header field data and first data field data;

[0009] Based on the message formats of the first protocol and the second protocol, converting the first header field data into second header field data;

[0010] Encrypt the first data field data according to the second header field data to obtain second data field data;

[0011] The second header field data and the second data field data are concatenated to obtain second message data based on the second protocol and send the second message data to the target device.

[0012] Further, the converting the first header field data into the second header field data based on the message format of the first protocol and the second protocol includes:

[0013] Obtaining common fields of the first protocol and the second protocol according to a message format of the first protocol and a message format of the second protocol;

[0014] Saving data of non-public fields in the first header field data;

[0015] The second header field data is generated, wherein the public fields in the second header field data are filled with the data of the public fields in the first header field data, and the non-public fields in the second header field data are filled with the first preset filling data.

[0016] Further, encrypting the first data field data according to the second header field data to obtain the second data field data includes:

[0017] Obtain at least one public field as a first encryption basis field;

[0018] A first symmetric key is generated according to the content in the first encryption basis field in the second header field data, and the first data field data is encrypted according to the first symmetric key based on a first symmetric encryption algorithm to obtain the second data field data.

[0019] Furthermore, it also includes:

[0020] Acquire third message data based on the second protocol sent by the target device, wherein the third message data includes third header field data and third data field data;

[0021] Based on the message formats of the first protocol and the second protocol, converting the third header field data into fourth header field data;

[0022] Decrypt the third data field data according to the fourth header field data to obtain fourth data field data;

[0023] The fourth header field data and the fourth data field data are spliced ​​to obtain fourth message data based on the first protocol and send the fourth message data to the source device.

[0024] Further, the third message data is response data corresponding to the second message data; and the converting of the third header field data into fourth header field data based on the message format of the first protocol and the second protocol includes:

[0025] Obtaining second preset filling data according to the data of the non-public field in the stored first header field data;

[0026] The fourth header field data is generated, wherein the public field in the fourth header field data is filled with the data of the public field in the third header field data, and the non-public field in the fourth header field data is filled with the second preset filling data.

[0027] Further, decrypting the third data field data according to the fourth header field data to obtain the fourth data field data includes:

[0028] Obtaining at least one public field as a second encryption basis field;

[0029] A second symmetric key is generated according to the content in the second encryption basis field in the third header field data, and the third data field data is decrypted according to the second symmetric key based on a second symmetric encryption algorithm to obtain the fourth data field data.

[0030] In a second aspect, the present invention further provides a protocol device for multi-protocol conversion, comprising:

[0031] A data receiving module, used to obtain first message data based on a first protocol sent by a source device, wherein the first message data includes first header field data and first data field data;

[0032] A header transcoding module, configured to convert the first header field data into second header field data based on the message formats of the first protocol and the second protocol;

[0033] A data encryption module, used for encrypting the first data field data according to the second header field data to obtain second data field data;

[0034] The forwarding and sending module is used to splice the second header field data and the second data field data to obtain the second message data based on the second protocol and send it to the target device.

[0035] Furthermore, it also includes:

[0036] a forwarding receiving module, configured to obtain third message data based on the second protocol sent by the target device, wherein the third message data includes third header field data and third data field data;

[0037] A header decoding module, configured to convert the third header field data into fourth header field data based on the message formats of the first protocol and the second protocol;

[0038] A data decryption module, used for decrypting the third data field data according to the fourth header field data to obtain fourth data field data;

[0039] A data feedback module is used to splice the fourth header field data and the fourth data field data to obtain fourth message data based on the first protocol and send it to the source device.

[0040] In a third aspect, the present invention further provides an electronic device, including a memory and a processor, wherein:

[0041] The memory is used to store programs;

[0042] The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in any one of the above-mentioned protocol processing methods for multi-protocol conversion.

[0043] In a fourth aspect, the present invention also provides a computer-readable storage medium for storing computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the protocol processing method for multi-protocol conversion described in any of the above items.

[0044] The present invention provides a protocol processing method, device, electronic device and medium for multi-protocol conversion, which first converts the first header field data in the first message data into the second header field data, and then uses the converted second header field data to encrypt the first data field data in the first message data to obtain the second data field data, and then splices the two to obtain the second message data sent to the target device. After receiving the second message data, the target device only needs to use the same decryption algorithm to decrypt the second data field data according to the second header field data to obtain the original first data field data, so that the conversion from the first protocol to the second protocol between the source device and the target device is realized, so that the two can communicate normally. In addition, encryption is also realized during the conversion process, achieving the goal of confidential communication between devices of different protocols. Compared with the prior art, the present invention makes it possible for the intelligent hydropower station to not need to configure a protocol conversion script for each device during the system construction process while ensuring information security, thereby reducing the complexity of the system construction in the intelligent hydropower station, and because of this, the flexibility and scalability of the system are also improved, so that when the equipment in the intelligent hydropower station is replaced or upgraded, it can be put into use without making major modifications to the system, and has good application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1A method flow chart of an embodiment of a protocol processing method for multi-protocol conversion provided by the present invention;

[0046] Figure 2 A system architecture diagram of an embodiment of a protocol processing device for multi-protocol conversion provided by the present invention;

[0047] Figure 3 A schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0048] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.

[0049] It is understandable that the technical terms, English abbreviations, etc. that appear in the following text are all prior art, and those skilled in the art can understand their meanings based on the context, and will not be explained in detail in this article due to space constraints.

[0050] In the description of the present application, “plurality” means two or more than two, unless otherwise clearly and specifically defined.

[0051] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0052] The present invention provides a protocol processing method, device, equipment and storage medium for multi-protocol conversion, which are described below respectively.

[0053] Combination Figure 1 As shown, a specific embodiment of the present invention discloses a protocol processing method for multi-protocol conversion, including:

[0054] S101. Acquire first message data based on a first protocol sent by a source device, where the first message data includes first header field data and first data field data;

[0055] S102: based on the message formats of the first protocol and the second protocol, convert the first header field data into second header field data;

[0056] S103, encrypting the first data field data according to the second header field data to obtain second data field data;

[0057] S104: Concatenate the second header field data and the second data field data to obtain second message data based on the second protocol and send the second message data to a target device.

[0058] The present invention provides a protocol processing method for multi-protocol conversion, which first converts the first header field data in the first message data into the second header field data, and then uses the converted second header field data to encrypt the first data field data in the first message data to obtain the second data field data, and then splices the two to obtain the second message data sent to the target device. After receiving the second message data, the target device only needs to use the same decryption algorithm to decrypt the second data field data according to the second header field data to obtain the original first data field data, so that the conversion from the first protocol to the second protocol between the source device and the target device is realized, so that the two can communicate normally. In addition, encryption is also realized during the conversion process, achieving the goal of confidential communication between devices of different protocols. Compared with the prior art, the present invention makes it possible for the intelligent hydropower station to not need to configure a protocol conversion script for each device during the system construction process while ensuring information security, thereby reducing the complexity of the system construction in the intelligent hydropower station, and because of this, the flexibility and scalability of the system are also improved, so that when the equipment in the intelligent hydropower station is replaced or upgraded, it can be put into use without making major modifications to the system, and has good application prospects.

[0059] During implementation, the device or module running the method can be regarded as a virtual device connected between the source device and the target device. For the source device, the module running the method is equivalent to a virtual device running the first protocol that communicates with the source device. Similarly, for the target device, the module running the method is equivalent to a virtual device running the second protocol that communicates with the target device.

[0060] In computer networks, network messages are composed of two fields: the header field (Header) and the data field (Payload).

[0061] The header is a fixed-length area containing important metadata, usually the first part, located at the beginning of a network message. It needs to be transmitted to ensure that devices such as routers in the Internet or telephone network can understand and process the corresponding part of the data packet. The information in the header can provide important information about the network message, such as the source address, destination address, protocol type, port number, etc. Depending on the different protocols or data packet types, the header may contain different fields. The length and structure of the header field and the data contained depend on the network protocol used.

[0062] The data field is a variable-length area that contains the data being transmitted. When a network message is sent from one computer to another, its header portion is processed by routers and other devices, which may need to use the information in the header to determine the message's next destination. Once the header is processed, the data portion of the digital packet can be processed and restored on the destination computer using the protocol.

[0063] It can be understood that, in this embodiment, the data in the header field and the data field in the first message data are the first header field data and the first data field data, respectively, the data in the header field and the data field in the second message data are the second header field data and the second data field data, respectively, and the third message data and the fourth message data are similar. In practice, according to the specific type of protocol, those skilled in the art can understand what data the words such as the first header field data, the third data field data, etc. in the text specifically refer to, so no further explanation will be given hereinafter.

[0064] Specifically, in a preferred embodiment, the above step S102, converting the first header field data into the second header field data based on the message formats of the first protocol and the second protocol, specifically includes:

[0065] Obtaining common fields of the first protocol and the second protocol according to a message format of the first protocol and a message format of the second protocol;

[0066] Saving data of non-public fields in the first header field data;

[0067] The second header field data is generated, wherein the public fields in the second header field data are filled with the data of the public fields in the first header field data, and the non-public fields in the second header field data are filled with the first preset filling data.

[0068] In the above process, the public field is a field shared by the first protocol and the second protocol, which is generally a field indicating the identity of the target device, such as the target IP address, the target MAC address, etc., which is a necessary field in each protocol. Therefore, in the above process, only the content of the public field in the first header field data needs to be filled into the second header field data.

[0069] The above-mentioned non-public fields refer to fields that are not shared by different protocols, and are generally used to characterize the timing sequence number, message length, protocol type, etc. of the message. When performing protocol conversion in this embodiment, for the second message data based on the second protocol, the first preset filling data can be filled in its non-public field, and the second message data can operate based on the second protocol.

[0070] In actual implementation, the device or module running this method can maintain an interaction list locally to record the data of non-public fields such as the message sequence number when the second protocol was used to communicate with the target device last time. When generating the second message data, appropriate first preset filling data can be obtained according to the interaction list for filling.

[0071] Further, in a preferred embodiment, the above step S103, encrypting the first data field data according to the second header field data to obtain the second data field data, specifically includes:

[0072] Obtain at least one public field as a first encryption basis field;

[0073] A first symmetric key is generated according to the content in the first encryption basis field in the second header field data, and the first data field data is encrypted according to the first symmetric key based on a first symmetric encryption algorithm to obtain the second data field data.

[0074] Because the data in the header field is usually related to the normal transmission of the message in the network, only the data in the first data field is encrypted in the present invention. Symmetric encryption is a common encryption algorithm, also known as private key encryption or shared key encryption. In a symmetric encryption algorithm, the same key (i.e., the first symmetric key mentioned above) is used for encryption and decryption operations. The principle of symmetric encryption is to encrypt the original data with a key to generate a ciphertext, and then use the same key to decrypt the ciphertext and restore it to the original data. Since the same key is used for encryption and decryption, the symmetric encryption algorithm is efficient, fast and simple. Common symmetric encryption algorithms include: DES (Data Encryption Standard), 3DES (Triple Data Encryption Algorithm), AES (Advanced Encryption Standard), etc.

[0075] In the present invention, the target device can also receive the second header field data. The target device only needs to configure and run the device of this method to adopt the same key generation algorithm and symmetric encryption algorithm (i.e., the first symmetric encryption algorithm) to complete the decryption of the data to obtain the first data field data, thereby completing the communication with the source device.

[0076] The present invention also provides a more detailed embodiment to more clearly illustrate the above step S103:

[0077] Assume that the source address, destination address, and port number fields in the public field are selected as the first encryption basis field, where:

[0078] Source address: 192.168.0.1;

[0079] Destination address: 10.0.0.1;

[0080] Port number: 8080;

[0081] The content of the first data field is: data content: "Hello, World!";

[0082] Then concatenate the source address, destination address and port number together to obtain the first encryption basis field, for example:

[0083] 192.168.0.1-10.0.0.1-8080;

[0084] The string is then processed using a secure key generation algorithm (such as a hash function) to generate the first symmetric key:

[0085] x1y2z3a4b5c6d7e8;

[0086] The first data field data is encrypted using the generated first symmetric key. For example, the data field "Hello, World!" is encrypted using the AES encryption algorithm to obtain the second data field data:

[0087] d7e8x1y2z3a4b5c6;

[0088] The second message data finally obtained is:

[0089] The second header field data includes: source address: 192.168.0.1, destination address: 10.0.0.1, port number: 8080;

[0090] The second data field data includes: d7e8x1y2z3a4b5c6.

[0091] It is understandable that the above process is only a simple example for easy understanding and use, and more complex encryption algorithms and security measures can be used in actual applications.

[0092] When the source device does not need to feedback data (for example, the source device is a device for temperature collection, water level collection, etc., which only needs to provide data), the above process can complete the protocol conversion communication between the source device and the target device. For some situations where feedback data is required, when the target device receives the second message data, it will generate a third message data of response. At this time, the third message data needs to be converted to reply to the source device.

[0093] Therefore, please combine Figure 1 As shown, in a preferred embodiment, the protocol processing method for multi-protocol conversion also includes:

[0094] S105, obtaining third message data based on the second protocol sent by the target device, wherein the third message data includes third header field data and third data field data;

[0095] S106. Based on the message formats of the first protocol and the second protocol, convert the third header field data into fourth header field data;

[0096] S107, decrypt the third data field data according to the fourth header field data to obtain fourth data field data;

[0097] S108: Concatenate the fourth header field data and the fourth data field data to obtain fourth message data based on the first protocol and send the fourth message data to the source device.

[0098] The principle and beneficial effects of the above process can be referred to in the previous description, and no further explanation is given here.

[0099] Further, in a preferred embodiment, the above step S105, based on the message formats of the first protocol and the second protocol, converting the third header field data into fourth header field data, specifically includes:

[0100] Obtaining second preset filling data according to the data of the non-public field in the stored first header field data;

[0101] The fourth header field data is generated, wherein the public field in the fourth header field data is filled with the data of the public field in the third header field data, and the non-public field in the fourth header field data is filled with the second preset filling data.

[0102] In step S102 before the present invention, the non-public field in the first header field data is retained. When the target device responds to the first message data (actually a response to the second message data), the device or module running this method can generate non-public field data corresponding to the first header field data based on the saved non-public field and fill it into the fourth header field data. In this way, the protocol conversion of the message is completed, ensuring that the fourth message data can communicate normally.

[0103] Further, in a preferred embodiment, the above step S107, decrypting the third data field data according to the fourth header field data to obtain the fourth data field data, specifically includes:

[0104] Obtaining at least one public field as a second encryption basis field;

[0105] A second symmetric key is generated according to the content in the second encryption basis field in the third header field data, and the third data field data is decrypted according to the second symmetric key based on a second symmetric encryption algorithm to obtain the fourth data field data.

[0106] The second symmetric encryption algorithm in the above process can be implemented by the same encryption algorithm as the first symmetric encryption algorithm, or by different encryption algorithms. When different encryption algorithms are used, information security can be significantly improved, and only two correct key generation algorithms and symmetric encryption algorithms need to be configured on the device running the method and the target device, respectively.

[0107] In order to better implement the protocol processing method of multi-protocol conversion in the embodiment of the present invention, based on the protocol processing method of multi-protocol conversion, correspondingly, please refer to Figure 2 , Figure 2 A schematic diagram of the structure of an embodiment of a protocol processing device for multi-protocol conversion provided by the present invention. A protocol processing device 200 for multi-protocol conversion provided by an embodiment of the present invention includes:

[0108] The data receiving module 210 is used to obtain first message data based on the first protocol sent by the source device, where the first message data includes first header field data and first data field data;

[0109] A header transcoding module 220, configured to convert the first header field data into second header field data based on the message formats of the first protocol and the second protocol;

[0110] A data encryption module 230, configured to encrypt the first data field data according to the second header field data to obtain second data field data;

[0111] The forwarding and sending module 240 is used to splice the second header field data and the second data field data to obtain the second message data based on the second protocol and send it to the target device.

[0112] Furthermore, in a preferred embodiment, the protocol processing device for multi-protocol conversion further includes:

[0113] The forwarding receiving module 250 is used to obtain the third message data based on the second protocol sent by the target device, and the third message data includes the third header field data and the third data field data;

[0114] A header decoding module 260, configured to convert the third header field data into fourth header field data based on the message formats of the first protocol and the second protocol;

[0115] A data decryption module 270, configured to decrypt the third data field data according to the fourth header field data to obtain fourth data field data;

[0116] The data feedback module 280 is used to splice the fourth header field data and the fourth data field data to obtain fourth message data based on the first protocol and send it to the source device.

[0117] It should be noted here that the corresponding device 200 provided in the above embodiment can implement the technical solutions described in the above method embodiments. The specific implementation principles of the above modules or units can refer to the corresponding contents in the above method embodiments, which will not be repeated here.

[0118] See also Figure 3 , Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Based on the above-mentioned protocol processing method for multi-protocol conversion, the present invention also provides a corresponding protocol processing device 300 for multi-protocol conversion, that is, the above-mentioned electronic device, and the protocol processing device 300 for multi-protocol conversion can be a computing device such as a mobile terminal, a desktop computer, a notebook, a palm computer, and a server. The protocol processing device 300 for multi-protocol conversion includes a processor 310, a memory 320, and a display 330. Figure 3 Only some components of the protocol processing device for multi-protocol conversion are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.

[0119] In some embodiments, the memory 320 may be an internal storage unit of the protocol processing device 300 for multi-protocol conversion, such as a hard disk or memory of the protocol processing device 300 for multi-protocol conversion. In other embodiments, the memory 320 may also be an external storage device of the protocol processing device 300 for multi-protocol conversion, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the protocol processing device 300 for multi-protocol conversion. Further, the memory 320 may also include both an internal storage unit of the protocol processing device 300 for multi-protocol conversion and an external storage device. The memory 320 is used to store application software and various types of data installed in the protocol processing device 300 for multi-protocol conversion, such as the program code of the protocol processing device 300 for multi-protocol conversion. The memory 320 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a protocol processing program 340 for multi-protocol conversion is stored in the memory 320, and the protocol processing program 340 for multi-protocol conversion can be executed by the processor 310, thereby implementing the protocol processing method for multi-protocol conversion in each embodiment of the present application.

[0120] In some embodiments, the processor 310 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 320, such as executing a protocol processing method for multi-protocol conversion.

[0121] In some embodiments, the display 330 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 330 is used to display information on the multi-protocol conversion protocol processing device 300 and to display a visual user interface. The components 310-330 of the multi-protocol conversion protocol processing device 300 communicate with each other through a system bus.

[0122] In one embodiment, when the processor 310 executes the protocol processing program 340 for multi-protocol conversion in the memory 320, the steps in the protocol processing method for multi-protocol conversion described above are implemented.

[0123] This embodiment further provides a computer-readable storage medium on which a protocol processing program for multi-protocol conversion is stored. When the protocol processing program for multi-protocol conversion is executed by a processor, the steps in the above embodiment can be implemented.

[0124] The present invention provides a protocol processing method, device, electronic device and medium for multi-protocol conversion, which first converts the first header field data in the first message data into the second header field data, and then uses the converted second header field data to encrypt the first data field data in the first message data to obtain the second data field data, and then splices the two to obtain the second message data sent to the target device. After receiving the second message data, the target device only needs to use the same decryption algorithm to decrypt the second data field data according to the second header field data to obtain the original first data field data, so that the conversion from the first protocol to the second protocol between the source device and the target device is realized, so that the two can communicate normally. In addition, encryption is also realized during the conversion process, achieving the goal of confidential communication between devices of different protocols. Compared with the prior art, the present invention makes it possible for the intelligent hydropower station to not need to configure a protocol conversion script for each device during the system construction process while ensuring information security, thereby reducing the complexity of the system construction in the intelligent hydropower station, and because of this, the flexibility and scalability of the system are also improved, so that when the equipment in the intelligent hydropower station is replaced or upgraded, it can be put into use without making major modifications to the system, and has good application prospects.

[0125] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.

Claims

1. A protocol processing method for multi-protocol conversion, characterized in that: include: Acquire first message data based on a first protocol sent by a source device, wherein the first message data includes first header field data and first data field data; Based on the message formats of the first protocol and the second protocol, converting the first header field data into second header field data; Encrypt the first data field data according to the second header field data to obtain second data field data; splicing the second header field data and the second data field data to obtain second message data based on the second protocol and sending the second message data to the target device; The converting of the first header field data into the second header field data based on the message formats of the first protocol and the second protocol includes: Obtaining common fields of the first protocol and the second protocol according to a message format of the first protocol and a message format of the second protocol; Saving data of non-public fields in the first header field data; Generate the second header field data, wherein the public field in the second header field data is filled with the data of the public field in the first header field data, and the non-public field in the second header field data is filled with the first preset filling data; The step of encrypting the first data field data according to the second header field data to obtain the second data field data includes: Obtain at least one public field as a first encryption basis field; A first symmetric key is generated according to the content in the first encryption basis field in the second header field data, and the first data field data is encrypted according to the first symmetric key based on a first symmetric encryption algorithm to obtain the second data field data.

2. The protocol processing method for multi-protocol conversion according to claim 1, characterized in that: Also includes: Acquire third message data based on the second protocol sent by the target device, wherein the third message data includes third header field data and third data field data; Based on the message formats of the first protocol and the second protocol, converting the third header field data into fourth header field data; Decrypt the third data field data according to the fourth header field data to obtain fourth data field data; The fourth header field data and the fourth data field data are spliced ​​to obtain fourth message data based on the first protocol and send the fourth message data to the source device.

3. The protocol processing method for multi-protocol conversion according to claim 2, characterized in that: The third message data is response data corresponding to the second message data; the message format based on the first protocol and the second protocol, converting the third header field data into fourth header field data, includes: Obtaining second preset filling data according to the data of the non-public field in the stored first header field data; The fourth header field data is generated, wherein the public field in the fourth header field data is filled with the data of the public field in the third header field data, and the non-public field in the fourth header field data is filled with the second preset filling data.

4. The protocol processing method for multi-protocol conversion according to claim 3 is characterized in that: The decrypting the third data field data according to the fourth header field data to obtain the fourth data field data includes: Obtaining at least one public field as a second encryption basis field; A second symmetric key is generated according to the content in the second encryption basis field in the third header field data, and the third data field data is decrypted according to the second symmetric key based on a second symmetric encryption algorithm to obtain the fourth data field data.

5. A protocol processing device for multi-protocol conversion, characterized in that: include: A data receiving module, used to obtain first message data based on a first protocol sent by a source device, wherein the first message data includes first header field data and first data field data; A header transcoding module, configured to convert the first header field data into second header field data based on the message formats of the first protocol and the second protocol; A data encryption module, used for encrypting the first data field data according to the second header field data to obtain second data field data; A forwarding and sending module, used for splicing the second header field data and the second data field data, obtaining the second message data based on the second protocol and sending it to the target device; The converting the first header field data into the second header field data based on the message formats of the first protocol and the second protocol includes: Obtaining common fields of the first protocol and the second protocol according to a message format of the first protocol and a message format of the second protocol; Saving data of non-public fields in the first header field data; Generate the second header field data, wherein the public field in the second header field data is filled with the data of the public field in the first header field data, and the non-public field in the second header field data is filled with the first preset filling data; The step of encrypting the first data field data according to the second header field data to obtain the second data field data includes: Obtain at least one public field as a first encryption basis field; A first symmetric key is generated according to the content in the first encryption basis field in the second header field data, and the first data field data is encrypted according to the first symmetric key based on a first symmetric encryption algorithm to obtain the second data field data.

6. The protocol processing device for multi-protocol conversion according to claim 5, characterized in that: Also includes: a forwarding receiving module, configured to obtain third message data based on the second protocol sent by the target device, wherein the third message data includes third header field data and third data field data; A header decoding module, configured to convert the third header field data into fourth header field data based on the message formats of the first protocol and the second protocol; A data decryption module, used for decrypting the third data field data according to the fourth header field data to obtain fourth data field data; A data feedback module is used to splice the fourth header field data and the fourth data field data to obtain fourth message data based on the first protocol and send it to the source device.

7. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store programs; The processor is coupled to the memory and is used to execute the program stored in the memory to implement the steps in the protocol processing method for multi-protocol conversion in any one of claims 1 to 4 above.

8. A computer-readable storage medium, characterized in that: Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the protocol processing method for multi-protocol conversion described in any one of claims 1 to 4 above.