File processing method and device of ship automation system and ship automation system
By adopting a method of sending checksums and file bodies separately in the ship automation system, the problem of configuration files being easily tampered with and leaked during transmission and storage is solved, improving the security and reliability of file transmission and ensuring the safety of ship operation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- THE 711TH RES INST OF CHINA STATE SHIPBUILDING CORP
- Filing Date
- 2024-10-25
- Publication Date
- 2026-07-28
AI Technical Summary
In existing ship automation systems, configuration files are easily tampered with and leaked during transmission and storage, resulting in low safety and reliability of ship operations.
By sending the checksum and the file body separately, and by encrypting the file name and checksum, the security of the file transmission process is ensured, and a global comparison is performed at the edge terminal to prevent tampering and leakage.
This improves the security and reliability of the configuration file transmission process, ensuring the safety of ship operations.
Smart Images

Figure CN119442314B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of ship integrated automation technology, specifically to a document processing method, device, and ship automation system for a ship automation system. Background Technology
[0002] With the rise of cloud computing, big data technology, cybersecurity, and artificial intelligence, integrated ship automation systems have been widely applied on ships. These systems consist of user terminals and edge terminals. To meet the demands of users and commissioning personnel for ease of use and flexibility, user terminals often need to distribute and update configurations to edge terminals to dynamically adjust and modify control logic, data acquisition methods, and other aspects. However, edge terminals generally have lower configurations and use specialized IoT operating systems, typically lacking database software capabilities. Therefore, related configurations are mostly transmitted and stored as files.
[0003] In the field of integrated ship automation, especially in ship control, extremely high security requirements are placed on data transmission and usage. Currently, the commonly used file processing method involves the user terminal encrypting the configuration file and then transmitting the encrypted file to the edge terminal, which then decrypts and stores the file. However, this method is susceptible to tampering and leakage during data transmission and storage, resulting in low reliability and impacting ship operational safety. Summary of the Invention
[0004] The embodiments of this application provide a file processing method, apparatus, and ship automation system for ship automation systems, so as to improve the security and reliability of configuration files sent from user terminals to edge terminals and ensure the safe operation of ships.
[0005] To address the aforementioned technical problems, embodiments of this application disclose the following technical solutions:
[0006] Firstly, a document processing method for a ship automation system is provided, applied to a user terminal of the ship automation system, the method comprising:
[0007] Determine the first checksum value of the configuration file to be configured;
[0008] The file name of the configuration file to be configured and the first verification value are encrypted to obtain encrypted information, and the encrypted information is sent to the edge terminal.
[0009] The configuration file to be configured is encrypted to obtain an encrypted file, and the encrypted file is sent to the edge terminal.
[0010] Obtain a first verification result. The first verification result is the result obtained by the edge terminal decrypting the encrypted information to obtain the first verification value and decrypting the encrypted file, and determining the second verification value of the configuration file to be configured. The configuration file to be configured is then verified based on the second verification value and the first verification value.
[0011] In response to the first verification result indicating that the configuration file to be verified is normal, the file name and corresponding first verification value of all configured first configuration files are sent to the edge terminal so that the edge terminal can verify all the saved second configuration files.
[0012] In some embodiments, the method further includes:
[0013] In response to the first verification result indicating that the configuration file to be verified is abnormal, the encrypted information and the encrypted file are resent to the edge terminal so that the edge terminal can re-verify the configuration file to be verified.
[0014] In some embodiments, after sending the file names of all configured first configuration files and their corresponding first verification values to the edge terminal, the method further includes:
[0015] Obtain the second verification result, which is the result obtained by the edge terminal after verifying all the saved second configuration files based on the file names and corresponding first verification values of all configured first configuration files;
[0016] In response to the second verification result indicating an abnormal second configuration file, the first configuration file corresponding to the abnormal second configuration file is determined as the configuration file to be configured, and the encryption step and the step of sending the encryption information and the encryption file to the edge terminal are re-executed, so that the edge terminal updates the abnormal second configuration file through the first configuration file corresponding to the abnormal second configuration file.
[0017] In some embodiments, after sending the encrypted file to the edge terminal, the method further includes:
[0018] After the encrypted file is successfully sent, a success message is sent to the edge terminal, indicating that the encrypted file has been successfully sent.
[0019] In some embodiments, sending a success message to the edge terminal includes:
[0020] The success message is sent to the edge terminal using message queue telemetry transmission.
[0021] In some embodiments, the filename of the configuration file to be configured and the first verification value are encrypted to obtain encrypted information, including:
[0022] Construct the key-value pair corresponding to the file name and the first verification value;
[0023] The key-value pair is encrypted using the national cryptographic algorithm SM2, and a timestamp element is introduced during encryption to obtain the encrypted information.
[0024] Secondly, a document processing method for a ship automation system is provided, applied to the edge terminal of the ship automation system, the method comprising:
[0025] Decrypt the received encrypted file to obtain the configuration file to be configured, and decrypt the received encrypted information to obtain the file name and first verification value of the configuration file to be configured;
[0026] Determine the second verification value of the configuration file to be configured;
[0027] The configuration file to be verified is verified based on the second verification value and the first verification value. If the configuration file to be verified is normal, the encrypted file is saved and a first verification result indicating that the configuration file to be verified is normal is sent to the user terminal.
[0028] Based on the file names and corresponding first verification values of all the configured first configuration files obtained, all the saved second configuration files are verified.
[0029] If all saved second configuration files are found to be without error, a self-reboot is performed, and the configuration is completed based on the configuration file to be configured and all second configuration files.
[0030] In some embodiments, the method further includes:
[0031] If the configuration file to be verified fails, a first verification result indicating the failure of the configuration file to be verified is sent to the user terminal.
[0032] The encrypted file and the encrypted information are retrieved again, and the configuration file to be configured is re-verified.
[0033] In some embodiments, the method further includes:
[0034] In response to the presence of an abnormal file in all the saved second configuration files, a second verification result indicating the presence of an abnormal file is sent to the user terminal;
[0035] Obtain the encrypted file and encryption information corresponding to the target configuration file, and verify the target configuration file, wherein the target configuration file is the first configuration file corresponding to the abnormal file;
[0036] If the target configuration file passes verification, save the target configuration file and replace the abnormal file.
[0037] In some embodiments, the abnormal file includes a missing second configuration file or a second configuration file whose first checksum does not match.
[0038] In some embodiments, verifying the configuration file to be verified based on the second verification value and the first verification value includes:
[0039] Compare the second check value with the first check value;
[0040] If the second verification value is the same as the first verification value, then the configuration file to be verified is determined to be normal.
[0041] If the second verification value is different from the first verification value, then the configuration file to be verified is determined to be abnormal.
[0042] Thirdly, a document processing device for a ship automation system is provided, configured in the user terminal of the ship automation system, the device comprising:
[0043] The first verification module is used to determine the first verification value of the configuration file to be configured.
[0044] The file encryption module is used to encrypt the file name of the configuration file to be configured and the first verification value to obtain encrypted information, and send the encrypted information to the edge terminal; and to encrypt the configuration file to be configured to obtain an encrypted file, and send the encrypted file to the edge terminal.
[0045] The verification feedback module is used to obtain a first verification result. The first verification result is the result obtained by the edge terminal decrypting the encrypted information to obtain the first verification value and decrypting the encrypted file, and determining the second verification value of the configuration file to be configured. The configuration file to be configured is then verified based on the second verification value and the first verification value.
[0046] The first processing module is configured to, in response to the first verification result indicating that the configuration file to be verified is normal, send the file names and corresponding first verification values of all configured first configuration files to the edge terminal, so that the edge terminal can verify all the saved second configuration files.
[0047] Fourthly, a document processing device for a ship automation system is provided, configured at the edge terminal of the ship automation system, the device comprising:
[0048] The file decryption module is used to decrypt the received encrypted file to obtain the configuration file to be configured, and to decrypt the received encrypted information to obtain the file name and first verification value of the configuration file to be configured.
[0049] The second verification module is used to determine the second verification value of the configuration file to be configured.
[0050] The second processing module is used to verify the configuration file to be verified based on the second verification value and the first verification value. If the configuration file to be verified is normal, the encrypted file is saved and a first verification result indicating that the configuration file to be verified is normal is sent to the user terminal.
[0051] The third processing module is used to verify all the saved second configuration files based on the file names of all the configured first configuration files and their corresponding first verification values.
[0052] The configuration loading module is used to perform a self-restart in response to the absence of any abnormalities in all saved second configuration files, and to complete the configuration based on the configuration file to be loaded and all second configuration files.
[0053] Fifthly, a ship automation system is provided, comprising:
[0054] User terminal, the user terminal being used to employ the document processing method of the ship automation system as described in any of the first aspects, or to configure the document processing device of the ship automation system as described in the third aspect.
[0055] An edge terminal, the edge terminal being used to employ a document processing method for a ship automation system as described in any of the second aspects, or to configure a document processing device for a ship automation system as described in the fourth aspect.
[0056] One of the above technical solutions has the following advantages or beneficial effects:
[0057] Compared with existing technologies, this application provides a file processing method for a ship automation system, applied to a user terminal of the ship automation system. The method includes: determining a first verification value for a configuration file to be configured; encrypting the file name and the first verification value of the configuration file to obtain encrypted information, and sending the encrypted information to an edge terminal; encrypting the configuration file to obtain an encrypted file, and sending the encrypted file to the edge terminal; obtaining a first verification result, which is the result obtained by the edge terminal decrypting the encrypted information to obtain the first verification value and decrypting the encrypted file, and determining a second verification value for the configuration file to be configured, and verifying the configuration file based on the second verification value and the first verification value; in response to the first verification result indicating that the configuration file to be configured is verified normally, sending the file names and corresponding first verification values of all configured first configuration files to the edge terminal, so that the edge terminal can verify all saved second configuration files. The method provided in this application uses a method of sending the verification value and the file body separately, which can prevent the file from being tampered with during transmission or the edge terminal receiving a fake file. Moreover, the file is encrypted during transmission, which can further prevent the leakage of file content, thereby improving the security and reliability of the configuration files sent by the user terminal to the edge terminal and ensuring the safe operation of the ship.
[0058] This application discloses a file processing method for a ship automation system, applied to the edge terminal of the system. Upon receiving an encrypted file, the method decrypts it, recalculates the verification value, and compares it with the verification value transmitted via encryption. This prevents file tampering during transmission or the edge terminal receiving a fake file. The method also uses encrypted files for local storage, further preventing file content leakage. Before a self-restart, a global comparison is performed with all configured first configuration files on the user terminal, preventing file tampering in the edge terminal's storage. This effectively improves the security and reliability of configuration files sent from the user terminal to the edge terminal, ensuring safe ship operation. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0060] Figure 1 This is a schematic diagram of the structure of a ship automation system according to an embodiment of this application;
[0061] Figure 2 This application provides an overall flowchart of a document processing method for a ship automation system, as illustrated in an embodiment of the present application.
[0062] Figure 3A detailed flowchart illustrating a document processing method for a ship automation system provided in this application embodiment;
[0063] Figure 4 A schematic diagram of the overall process of another document processing method for a ship automation system provided in this application embodiment;
[0064] Figure 5 A schematic flowchart illustrating another document processing method for a ship automation system provided in this application embodiment;
[0065] Figure 6 A schematic diagram of the structure of a document processing device for a ship automation system provided in this application embodiment;
[0066] Figure 7 A schematic diagram of the structure of a document processing device for another ship automation system provided in this application embodiment;
[0067] Figure 8 This application provides a schematic diagram of communication interaction in a ship automation system.
[0068] Figure label:
[0069] 10 - User terminal; 20 - Edge terminal; 60 - First file processing device; 601 - First verification module; 602 - File encryption module; 603 - Verification feedback module; 604 - First processing module; 70 - Second file processing device; 701 - File decryption module; 702 - Second verification module; 703 - Second processing module; 704 - Third processing module; 705 - Configuration loading module. Detailed Implementation
[0070] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0071] In the description of this application, it should be understood that the terms "upper," "lower," "front," "rear," "left," "right," "top," "bottom," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on this application. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more features. In the description of this application, "multiple" means two or more, and "at least one" can mean one, two, or more, unless otherwise explicitly specified.
[0072] Please see Figure 1 , Figure 1 This is a schematic diagram of the structure of a ship automation system according to an embodiment of this application. The ship automation system according to this embodiment includes a user terminal 10 and an edge terminal 20. There can be one or more edge terminals 20. Each edge terminal 20 is installed on the ship and can be an embedded device, such as a control board, whose function is to control and monitor the corresponding ship equipment connected to it. There is typically one user terminal 10, installed on the ship. The user terminal 10 is the operating terminal used by users and commissioning personnel, and may specifically include hardware such as a computer and a display screen. The display screen is used to display the user interface.
[0073] During the process of user terminal 10 sending configuration files to edge terminal 20, a common file processing method is for user terminal 10 to encrypt the configuration file before transmitting it to edge terminal 20, and edge terminal 20 to decrypt and store the file. This method is relatively simple in logic, but it is easily tampered with and leaked during data transmission and storage, resulting in low reliability and affecting the safety of ship operation. It can no longer meet the high security requirements of current ship control for data transmission and use.
[0074] In view of this, embodiments of this application provide a file processing method for a ship automation system. By encrypting file transmission and sending checksums and the file body separately, the method prevents files from being tampered with or leaked during transmission, or edge terminals from receiving fake files. By performing a global comparison with all configured first configuration files on the user terminal before configuration, the method prevents files from being tampered with in the edge terminal storage. This effectively improves the security and reliability of configuration files sent from the user terminal to the edge terminal, ensuring the safe operation of the ship, and thus solving at least some of the above-mentioned technical problems.
[0075] Please see Figure 2 , Figure 2 This is a schematic flowchart illustrating a document processing method for a ship automation system provided in this application embodiment. The method is applied to a user terminal and specifically includes the following steps:
[0076] Step 201: Determine the first checksum value of the configuration file to be configured.
[0077] Specifically, the configuration files to be configured can include communication protocol configuration files, automation control logic files, and system configuration files for edge terminals. The first checksum of the configuration file is a fixed-length numerical or string calculated from its content. It is used to verify the integrity and accuracy of the configuration file, ensuring that no errors or damage have occurred during transmission, storage, or copying.
[0078] In some examples, the national cryptographic algorithm SM3 can be used to calculate the first checksum of the configuration file to be configured, that is, the first checksum is the SM3 hash value. This makes encryption and decryption faster, while also better meeting the requirements of domestic production. In other examples, other hash function algorithms can also be used, such as MD5 (Message Digest Algorithm 5), SHA-2 (Secure Hash Algorithm 2), SHA-256 (Secure Hash Algorithm 256), etc., and this application does not specifically limit them.
[0079] Step 202: Encrypt the file name and first check value of the configuration file to obtain encrypted information, and send the encrypted information to the edge terminal.
[0080] In some embodiments, step 202 can be implemented in the following ways:
[0081] Construct a key-value pair corresponding to the file name and the first checksum. Encrypt the key-value pair using the Chinese national cryptographic algorithm SM2, and incorporate a timestamp element during encryption to obtain the encrypted information.
[0082] The above scheme not only achieves faster encryption and decryption speeds and better meets the requirements of domestic production, but also increases the difficulty of cracking by adding timestamp elements, thereby further improving transmission security and reliability.
[0083] For example, the encrypted information can be sent to the edge terminal via MQTT (Message Queuing Telemetry Transport). Because MQTT communication has lower resource overhead, it can achieve faster sending speeds and improve transmission efficiency.
[0084] In other embodiments, other encryption methods can be used to encrypt the file name and the first check value, such as the Chinese national cryptographic algorithm SM4, the AES (Advanced Encryption Standard) algorithm, the RSA algorithm, or any combination of encryption methods. This application does not specifically limit this.
[0085] Step 203: Encrypt the configuration file to be prepared, obtain the encrypted file, and send the encrypted file to the edge terminal.
[0086] For example, the configuration file to be encrypted can be one or a combination of the following algorithms: SM2, SM4, AES, and RSA.
[0087] For example, encrypted files can be transferred to edge terminals via the FTP (File Transfer Protocol). Because FTP communication is highly reliable, it better ensures file integrity during transmission.
[0088] In addition, other message and file communication methods, such as HTTP, TCPSocket, TFTP, etc., can also be used in the embodiments of this application. The embodiments of this application do not specifically limit these methods.
[0089] It should be noted that in the embodiments of this application, the encrypted file and the encrypted information are sent separately. That is to say, the encrypted information can be sent first and then the encrypted file can be sent through one sending channel, or the encrypted file can be sent first and then the encrypted information can be sent through one sending channel, or the encrypted file and the encrypted information can be sent separately through two sending channels. The embodiments of this application do not limit the specific method of separate sending.
[0090] By employing the above method of sending the file checksum and the file body separately, we can prevent the file from being tampered with or receiving a fake file during transmission. Furthermore, encryption during file transmission can further prevent the leakage of file content.
[0091] In some embodiments, after performing step 203, the method of this application embodiment may further include:
[0092] After the encrypted file is successfully sent, a success message is sent to the edge terminal to indicate that the encrypted file has been successfully sent.
[0093] Specifically, the success message can include the name of the file to be configured.
[0094] In some examples, the user terminal can send a success message to the edge terminal using message queue telemetry (MQTT communication). This can effectively improve transmission efficiency.
[0095] In some examples, after executing steps 201 to 203, the information of the configuration file to be configured can be saved in the historical configuration library of the user terminal. Then, the encrypted file is backed up on the user terminal in a specified path. This specified path can be divided into different branches based on update time, corresponding one-to-one with the update times in the historical configuration library. The historical configuration library can use a MySQL database, containing information on all configured first configuration files and marking all the latest first configuration files. The information of the first configuration file can include the file path, first checksum, update time, etc., and is saved in the format of file path, first checksum, and update time. The latest configuration file can be determined by comparing update times. Furthermore, the historical configuration library can also use other database software or text storage methods, or any other suitable data format; this application embodiment does not specifically limit this.
[0096] It's understandable that both the primary configuration file and the configuration file to be configured refer to the configuration files required by the edge terminal; the names are used to distinguish different configuration files. Once the configuration file to be configured is saved in the historical configuration repository, it is also converted into the primary configuration file. Each primary configuration file can be stored in the historical configuration repository in encrypted form.
[0097] Step 204: Obtain the first verification result. The first verification result is the result obtained by the edge terminal decrypting the encrypted information to obtain the first verification value and decrypting the encrypted file, and determining the second verification value of the configuration file to be configured. The configuration file to be configured is then verified based on the second verification value and the first verification value.
[0098] It is understandable that after receiving the encrypted file and encrypted information, the edge terminal will decrypt the encrypted file and encrypted information using a preset decryption algorithm, determine the second verification value of the configuration file using the same verification value generation method as the user terminal, and then verify the configuration file based on the first and second verification values to obtain the first verification result. For details on the specific verification method, please refer to the descriptions in subsequent related embodiments.
[0099] Step 205: In response to the first verification result indicating that the configuration file to be verified is normal, send the file names of all configured first configuration files and the corresponding first verification values to the edge terminal so that the edge terminal can verify all the saved second configuration files.
[0100] Specifically, the filenames and corresponding first checksums of historically configured first configuration files from the historical configuration library are sent to the edge terminal, enabling the edge terminal to use these filenames and checksums to verify all saved second configuration files. For details on the verification method, please refer to the subsequent related embodiments.
[0101] Please see Figure 3 , Figure 3 This is a schematic flowchart illustrating a document processing method for a ship automation system provided in an embodiment of this application. In some embodiments, in addition to steps 201 to 205 described above, the method of this application embodiment further includes:
[0102] Step 206: In response to the first verification result indicating that the configuration file to be verified is abnormal, resend the encrypted information and encrypted file to the edge terminal so that the edge terminal can re-verify the configuration file to be verified.
[0103] In other words, if the edge terminal verification fails, it may indicate that the file has been tampered with or an anomaly has occurred during transmission. In this case, the user terminal can re-encrypt the configuration file and the file name and first checksum of the configuration file before sending it to ensure that the edge terminal receives the correct configuration file, thereby ensuring the safety of ship operation.
[0104] In some embodiments, after performing step 205, the method of this application embodiment further includes:
[0105] Step 207: Obtain the second verification result. The second verification result is the result obtained by the edge terminal after verifying all the saved second configuration files based on the file names of all configured first configuration files and the corresponding first verification values.
[0106] Specifically, the edge terminal will compare the received first configuration file name and corresponding first check value with the file names and corresponding first check values of all the saved second configuration files to check for the existence of second configuration files with different or missing first check values, and then report the results to the user terminal.
[0107] It should be noted that both the second configuration file and the first configuration file refer to configuration files, only they are saved in different locations. The first configuration file is saved on the user terminal, while the second configuration file is saved on the edge terminal. The distinction in name is for clearer description.
[0108] Step 208: In response to the second verification result indicating that there is an abnormal second configuration file, the first configuration file corresponding to the abnormal second configuration file is determined as the configuration file to be updated, and steps 202 and 203 are re-executed so that the edge terminal updates the abnormal second configuration file through the first configuration file corresponding to the abnormal second configuration file.
[0109] Specifically, when the edge terminal reports an abnormal second configuration file, the user terminal can retrieve the first configuration file corresponding to the abnormal second configuration file from the historical configuration library, identify the file as the configuration file to be configured, execute the file processing method of this application embodiment to encrypt the configuration file to be configured and send it to the edge terminal, so as to ensure that the edge terminal replaces the abnormal second configuration file, thereby ensuring that subsequent configuration can be completed normally and ensuring the safety of ship operation.
[0110] It is understood that the method in this application embodiment, which sends the verification value and the file body separately, can prevent the file from being tampered with during transmission or the edge terminal from receiving a fake file. Furthermore, the file is encrypted during transmission, which can further prevent the leakage of file content, thereby improving the security and reliability of the configuration file sent by the user terminal to the edge terminal and ensuring the safety of ship operation.
[0111] Please refer to the corresponding documents as well. Figure 4 and Figure 5 , Figure 4 This is a schematic diagram of the overall flow of another document processing method for a ship automation system provided in an embodiment of this application. Figure 5 This is a schematic flowchart illustrating another document processing method for a ship automation system provided in this application embodiment. The method is applied to an edge terminal and specifically includes the following steps:
[0112] Step 401: Decrypt the received encrypted file to obtain the configuration file to be configured, and decrypt the received encrypted information to obtain the file name and first verification value of the configuration file to be configured.
[0113] Specifically, a key pre-built into the edge terminal can be used to decrypt encrypted files and encrypted information.
[0114] Step 402: Determine the second verification value of the configuration file.
[0115] Specifically, the edge terminal uses the same method as the user terminal to determine the second verification value of the configuration file. For example, the national cryptographic algorithm SM3 can be used to calculate the second verification value of the configuration file; that is, the second verification value is an SM3 hash value. This makes encryption and decryption faster while also better meeting the requirements of domestic production. In other examples, other hash function algorithms can also be used, such as MD5 (Message Digest Algorithm 5), SHA-2 (Secure Hash Algorithm 2), SHA-256 (Secure Hash Algorithm 256), etc., as long as the method for determining the first verification value is the same. This application does not limit the specific method.
[0116] Step 403: Verify the configuration file to be configured based on the second verification value and the first verification value.
[0117] In some embodiments, step 403 is implemented in the following ways:
[0118] Step 1: Compare the second check value with the first check value.
[0119] Step two: If the second checksum is the same as the first checksum, the configuration file to be verified is considered valid. If the second checksum is different from the first checksum, the configuration file to be verified is considered invalid.
[0120] Specifically, for configuration files with the same content, using the same checksum algorithm should yield the same checksum. If the checksum changes, it indicates that the configuration file has been tampered with or is abnormal during transmission.
[0121] Step 404: If the configuration file to be verified is normal, save the encrypted file and send the first verification result indicating that the configuration file to be verified is normal to the user terminal.
[0122] Specifically, encrypted files can be stored in a configuration library on the edge terminal. This library contains information about all second configuration files, including file paths, first checksums, and update times, and is stored in a format of file path, first checksum, and update time. By comparing update times, the latest configuration file can be determined. Each second configuration file can be stored in this configuration library in encrypted form.
[0123] It is understandable that the second configuration file is the configuration file that the user terminal has sent to the edge terminal and that the edge terminal has saved normally.
[0124] Furthermore, in some embodiments, the method of this application may also include:
[0125] Step 407: If the configuration file verification fails, send the first verification result indicating the failure to the user terminal. This causes the user terminal to re-execute steps 202 and 203, allowing the edge terminal to re-acquire the encrypted file and encrypted information, and re-verify the configuration file.
[0126] In other words, if the configuration file fails verification, it may be due to an error in the file during transmission. In this case, the edge terminal will send a feedback to the user terminal and make the user terminal resend the encrypted file and encrypted information of the configuration file.
[0127] Specifically, the first verification result can be transmitted via MQTT message.
[0128] Step 405: Based on the file names and corresponding first verification values of all the configured first configuration files obtained, verify all the saved second configuration files.
[0129] Specifically, the edge terminal can compare all the saved second configuration files with all the acquired first configuration files based on the file name and the corresponding first verification value.
[0130] Through the above scheme, the edge terminal can perform a global comparison of all second configuration files. It can comprehensively check all configurations of the edge terminal before the edge terminal restarts and updates its configuration, preventing the second configuration files from being lost or tampered with locally on the edge terminal, thereby further improving the safety and reliability of ship control.
[0131] Step 406: In response to the absence of any abnormalities in all saved second configuration files, perform an auto-reboot and complete the configuration based on the pending configuration file and all second configuration files.
[0132] In some embodiments, the abnormal file includes a missing second configuration file or a second configuration file whose first checksum does not match.
[0133] Specifically, the edge terminal will restart and, upon startup, read and decrypt the configuration file to be configured and all secondary configuration files and load them into the corresponding programs to complete the configuration.
[0134] In some embodiments, the method of this application further includes:
[0135] Step 408: In response to the presence of an abnormal file in all the saved second configuration files, send a second verification result indicating the presence of an abnormal file to the user terminal.
[0136] Specifically, if any of the second configuration files are missing or do not match the first verification value, the second verification result is sent to the user terminal via an MQTT message. This allows the user terminal to retrieve the corresponding first configuration file from the historical configuration database for encryption (or directly retrieve the encrypted first configuration file), read the corresponding configuration file information from the historical configuration database, and resend it to the edge terminal for comparison.
[0137] Step 409: Obtain the encrypted file and encryption information corresponding to the target configuration file, and verify the target configuration file. The target configuration file is the first configuration file corresponding to the abnormal file.
[0138] Specifically, the methods for edge terminals to decrypt the encrypted files and encrypted information corresponding to the target configuration file, as well as the verification methods, are the same as those for the configuration file in the aforementioned embodiments, and will not be repeated here.
[0139] Step 410: If the target configuration file passes verification, save the target configuration file and replace the abnormal file.
[0140] In other words, if the target configuration file passes the verification, the abnormal second configuration file is replaced with the target configuration file to obtain the normal second configuration file.
[0141] It is understood that the method provided in this application embodiment uses a method of sending the file verification value and the file body separately to prevent the file from being tampered with or receiving a fake file during transmission; encrypted files are used during both file transmission and local storage, and decryption and reading are only performed during the edge terminal's comparison of the verification value and self-restart process to prevent the leakage of file content; by performing a global comparison with the user terminal's historical configuration database before the edge terminal self-restarts, the method prevents the file from being tampered with or deleted in the edge terminal's storage. In addition, the method in this application embodiment embodiment does not rely on any specific external software, middleware, hardware, or operating system, and can freely choose communication methods, storage methods, and encryption methods, resulting in low implementation cost and strong compatibility.
[0142] It should be noted that the contents of the various embodiments of this application can be referred to each other, and for the contents not described in detail in one embodiment, the contents of another embodiment can be referred to.
[0143] Accordingly, please refer to Figure 6 , Figure 6This is a schematic diagram of a document processing device for a ship automation system provided in an embodiment of this application. For ease of description, this document processing device is represented by a first document processing device 60. The first document processing device 60 is configured in the user terminal of the ship automation system. The device includes a first verification module 601, a document encryption module 602, a verification feedback module 603, and a first processing module 604.
[0144] The first verification module 601 is used to determine the first verification value of the configuration file to be configured.
[0145] The file encryption module 602 is used to encrypt the file name and first check value of the configuration file to obtain encrypted information and send the encrypted information to the edge terminal; and to encrypt the configuration file to obtain an encrypted file and send the encrypted file to the edge terminal.
[0146] The verification feedback module 603 is used to obtain the first verification result. The first verification result is the result obtained by the edge terminal decrypting the encrypted information to obtain the first verification value and decrypting the encrypted file, and determining the second verification value of the configuration file to be configured. The result is obtained by verifying the configuration file to be configured based on the second verification value and the first verification value.
[0147] The first processing module 604 is used to send the file names of all configured first configuration files and their corresponding first verification values to the edge terminal in response to the first verification result indicating that the configuration file to be verified is normal, so that the edge terminal can verify all the saved second configuration files.
[0148] In some embodiments, the first processing module 604 is further configured to:
[0149] In response to the first verification result indicating an error in the configuration file verification, the encrypted information and encrypted file are resent to the edge terminal so that the edge terminal can re-verify the configuration file.
[0150] In some embodiments, after sending the file names of all configured first configuration files and their corresponding first verification values to the edge terminal, the first processing module 604 is further configured to:
[0151] Obtain the second verification result. The second verification result is the result obtained by the edge terminal after verifying all the saved second configuration files based on the file names of all configured first configuration files and the corresponding first verification values.
[0152] In response to the second verification result indicating the existence of an abnormal second configuration file, the first configuration file corresponding to the abnormal second configuration file is identified as the configuration file to be updated, and the encryption steps and the steps of sending encrypted information and encrypted files to the edge terminal are re-executed, so that the edge terminal updates the abnormal second configuration file with the first configuration file corresponding to the abnormal second configuration file.
[0153] In some embodiments, after sending the encrypted file to the edge terminal, the file encryption module 602 is further configured to:
[0154] After the encrypted file is successfully sent, a success message is sent to the edge terminal to indicate that the encrypted file has been successfully sent.
[0155] In some embodiments, the file encryption module 602 is specifically used for:
[0156] Success messages are sent to edge terminals using message queue telemetry transmission.
[0157] In some embodiments, the file encryption module 602 is specifically used for:
[0158] Construct key-value pairs corresponding to the file name and the first checksum;
[0159] The key-value pair is encrypted using the national cryptographic algorithm SM2, and a timestamp element is introduced during encryption to obtain the encrypted information.
[0160] It is understood that the device in this application embodiment uses a method of sending the verification value and the file body separately, which can prevent the file from being tampered with during transmission or the edge terminal from receiving a fake file. In addition, the file is encrypted during transmission, which can further prevent the file content from being leaked, thereby improving the security and reliability of the configuration file sent by the user terminal to the edge terminal and ensuring the safety of ship operation.
[0161] Accordingly, please refer to Figure 7 , Figure 7 This is a schematic diagram of a document processing device for another ship automation system provided in an embodiment of this application. For ease of description, this document processing device is characterized as a second document processing device 70. The second document processing device 70 is configured at the edge terminal of the ship automation system. The device includes a document decryption module 701, a second verification module 702, a second processing module 703, a third processing module 704, and a configuration loading module 705.
[0162] The file decryption module 701 is used to decrypt the received encrypted file to obtain the configuration file to be configured, and to decrypt the received encrypted information to obtain the file name and first verification value of the configuration file to be configured.
[0163] The second verification module 702 is used to determine the second verification value of the configuration file to be configured.
[0164] The second processing module 703 is used to verify the configuration file to be verified based on the second verification value and the first verification value. If the configuration file to be verified is normal, the encrypted file is saved and the first verification result indicating that the configuration file to be verified is normal is sent to the user terminal.
[0165] The third processing module 704 is used to verify all the saved second configuration files based on the file names of all the configured first configuration files and the corresponding first verification values obtained.
[0166] The configuration loading module 705 is used to perform a self-reboot in response to the absence of any errors in all saved second configuration files, and to complete the configuration based on the configuration file to be loaded and all second configuration files.
[0167] In some embodiments, the second processing module 703 is further configured to:
[0168] If the configuration file fails verification, a first verification result indicating the failure is sent to the user terminal.
[0169] Retrieve the encrypted file and encrypted information, and re-verify the configuration file.
[0170] In some embodiments, the configuration loading module 705 is further configured to:
[0171] In response to the presence of an abnormal file in all the saved second configuration files, a second verification result indicating the existence of the abnormal file is sent to the user terminal.
[0172] Obtain the encrypted file and encryption information corresponding to the target configuration file, and verify the target configuration file. The target configuration file is the first configuration file corresponding to the abnormal file.
[0173] If the target configuration file passes verification, save the target configuration file and replace the abnormal file.
[0174] In some embodiments, the abnormal file includes a missing second configuration file or a second configuration file whose first checksum does not match.
[0175] In some embodiments, the third processing module 704 is specifically used for:
[0176] Compare the second checksum with the first checksum;
[0177] If the second check value is the same as the first check value, then the configuration file to be checked is determined to be normal.
[0178] If the second check value is different from the first check value, then the configuration file to be checked is determined to be abnormal.
[0179] It is understood that the device in this application embodiment decrypts and recalculates the verification value after receiving the encrypted file, and compares it with the verification value transmitted in the encrypted manner. This can prevent the file from being tampered with during transmission or the edge terminal from receiving a fake file. The encrypted file is still used during local storage, which can further prevent the leakage of file content. Before self-restart, a global comparison is performed with all configured first configuration files of the user terminal, which can prevent the file from being tampered with in the edge terminal storage. This can effectively improve the security and reliability of the configuration files issued by the user terminal to the edge terminal and ensure the safety of ship operation.
[0180] Accordingly, please refer to Figure 8 , Figure 8 This is a schematic diagram illustrating the communication interaction of a ship automation system provided in an embodiment of this application. The ship automation system includes a user terminal 10 and an edge terminal 20. The user terminal 10 is used to employ a file processing method for a ship automation system provided in this application embodiment, or to configure a first file processing device 60 of this application embodiment. The edge terminal 20 is used to employ another file processing method for a ship automation system provided in this application embodiment, or to configure a second file processing device 70 of this application embodiment.
[0181] For example, the interaction process of the device includes the following steps:
[0182] User terminal 10 sends the file name and checksum to edge terminal 20 via the MQTT protocol.
[0183] User terminal 10 sends an encrypted file to edge terminal 20 via the FTP protocol.
[0184] User terminal 10 sends a file delivery success message to edge terminal 20 via the MQTT protocol.
[0185] Edge terminal 20 sends the first verification result to user terminal 10.
[0186] If the first verification result indicates a successful comparison, user terminal 10 sends the names and checksums of all configuration files to edge terminal 20 via the MQTT protocol, and edge terminal 20 sends the second verification result to user terminal 10. If the first verification result indicates a failed comparison, the process returns to the step where user terminal 10 sends the file names and checksums to edge terminal 20 via the MQTT protocol.
[0187] If the second verification result indicates a successful comparison, the process ends; if the second verification result indicates a failed comparison, the process returns to the step of sending the file name and verification value to the edge terminal 20 via the MQTT protocol from the user terminal 10.
[0188] It should be noted that the specific implementation methods can be found in the aforementioned related method embodiments, and will not be repeated here.
[0189] It is understood that the ship automation system in this application embodiment can improve the security and reliability of the configuration files sent from the user terminal 10 to the edge terminal 20, thereby ensuring the safe operation of the ship.
[0190] The foregoing has provided a detailed description of a document processing method, apparatus, and ship automation system for a ship automation system provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the technical solutions and core ideas of this application. Those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. These modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A file processing method of a ship automation system, characterized by, The method, applied to the user terminal of the ship automation system, includes: Determine the first checksum value of the configuration file to be configured; The file name of the configuration file to be configured and the first verification value are encrypted to obtain encrypted information, and the encrypted information is sent to the edge terminal. The configuration file to be configured is encrypted to obtain an encrypted file, and the encrypted file is sent to the edge terminal, wherein the encrypted file is sent separately from the encrypted information; Obtain a first verification result. The first verification result is the result obtained by the edge terminal decrypting the encrypted information to obtain the first verification value and decrypting the encrypted file, and determining the second verification value of the configuration file to be configured. The configuration file to be configured is then verified based on the second verification value and the first verification value. In response to the first verification result indicating that the configuration file to be verified is normal, the file name and corresponding first verification value of all configured first configuration files are sent to the edge terminal so that the edge terminal can verify all saved second configuration files. The second configuration files are the configuration files that the user terminal has sent to the edge terminal and that the edge terminal has saved normally. The second configuration files include the encrypted file saved in the edge terminal after the edge terminal determines the second verification value of the configuration file to be verified. The process involves obtaining a second verification result, which is the result obtained by the edge terminal after verifying all saved second configuration files based on the file names and corresponding first verification values of all configured first configuration files; in response to the second verification result indicating the existence of an abnormal second configuration file, determining the first configuration file corresponding to the abnormal second configuration file as the configuration file to be configured, and re-executing the steps of encrypting the file name and the first verification value of the configuration file to be configured to obtain the encryption information, encrypting the configuration file to be configured to obtain the encrypted file, and sending the encryption information and the encrypted file to the edge terminal, so that the edge terminal updates the abnormal second configuration file through the first configuration file corresponding to the abnormal second configuration file; If all saved second configuration files are found to be without error, a self-reboot is performed, and the configuration is completed based on the configuration file to be configured and all second configuration files.
2. The file processing method of a ship automation system according to claim 1, characterized by, The method further includes: In response to the first verification result indicating that the configuration file to be verified is abnormal, the encrypted information and the encrypted file are resent to the edge terminal so that the edge terminal can re-verify the configuration file to be verified.
3. The file processing method of a ship automation system according to claim 1, characterized by, After sending the encrypted file to the edge terminal, the method further includes: After the encrypted file is successfully sent, a success message is sent to the edge terminal, indicating that the encrypted file has been successfully sent.
4. The file processing method of a ship automation system according to claim 3, characterized by, Sending a success message to the edge terminal includes: The success message is sent to the edge terminal using message queue telemetry transmission.
5. The document processing method for a ship automation system according to claim 1, characterized in that, Encrypt the filename of the configuration file to be configured and the first verification value to obtain encrypted information, including: Construct the key-value pair corresponding to the file name and the first verification value; The key-value pair is encrypted using the national cryptographic algorithm SM2, and a timestamp element is introduced during encryption to obtain the encrypted information.
6. A document processing method for a ship automation system, characterized in that, The method, applied to the edge terminal of the ship automation system, includes: Decrypt the received encrypted file to obtain the configuration file to be configured, and decrypt the received encrypted information to obtain the file name and first verification value of the configuration file to be configured, wherein the encrypted file and the encrypted information are sent separately; Determine the second verification value of the configuration file to be configured; The configuration file to be verified is verified based on the second verification value and the first verification value. If the configuration file to be verified is normal, the encrypted file is saved and a first verification result indicating that the configuration file to be verified is normal is sent to the user terminal. Based on the file names and corresponding first verification values of all the configured first configuration files obtained, all the saved second configuration files are verified. The second configuration files are the configuration files that the user terminal has sent to the edge terminal and that the edge terminal has saved normally. The second configuration files include the saved encrypted files. If all saved second configuration files are found to be without error, a self-reboot is performed, and the configuration is completed based on the configuration file to be configured and all second configuration files.
7. The document processing method for a ship automation system according to claim 6, characterized in that, The method further includes: If the configuration file to be verified fails, a first verification result indicating the failure of the configuration file to be verified is sent to the user terminal. The encrypted file and the encrypted information are retrieved again, and the configuration file to be configured is re-verified.
8. The document processing method for a ship automation system according to claim 6, characterized in that, The method further includes: In response to the presence of an abnormal file in all the saved second configuration files, a second verification result indicating the presence of an abnormal file is sent to the user terminal; Obtain the encrypted file and encryption information corresponding to the target configuration file, and verify the target configuration file, wherein the target configuration file is the first configuration file corresponding to the abnormal file; If the target configuration file passes verification, save the target configuration file and replace the abnormal file.
9. The document processing method for a ship automation system according to claim 8, characterized in that, The abnormal file includes a missing second configuration file or a second configuration file whose first checksum does not match.
10. The document processing method for a ship automation system according to claim 6, characterized in that, The configuration file to be verified is based on the second verification value and the first verification value, including: Compare the second check value with the first check value; If the second verification value is the same as the first verification value, then the configuration file to be verified is determined to be normal. If the second verification value is different from the first verification value, then the configuration file to be verified is determined to be abnormal.
11. A document processing device for a ship automation system, characterized in that, The user terminal configured in the ship automation system includes: The first verification module is used to determine the first verification value of the configuration file to be configured. The file encryption module is used to encrypt the file name of the configuration file to be configured and the first verification value to obtain encrypted information, and send the encrypted information to the edge terminal; and to encrypt the configuration file to be configured to obtain an encrypted file, and send the encrypted file to the edge terminal, wherein the encrypted file and the encrypted information are sent separately. The verification feedback module is used to obtain a first verification result. The first verification result is the result obtained by the edge terminal decrypting the encrypted information to obtain the first verification value and decrypting the encrypted file, and determining the second verification value of the configuration file to be configured. The configuration file to be configured is then verified based on the second verification value and the first verification value. A first processing module is configured to: respond to a first verification result indicating that the configuration file to be verified is normal, send the file names and corresponding first verification values of all configured first configuration files to the edge terminal, so that the edge terminal can verify all saved second configuration files, wherein the second configuration files are those sent by the user terminal to the edge terminal and saved normally by the edge terminal, and the second configuration files include the encrypted file saved in the edge terminal after the edge terminal determines the second verification value of the configuration file to be verified; obtain a second verification result, which is the result obtained by the edge terminal after verifying all saved second configuration files based on the file names and corresponding first verification values of all configured first configuration files; respond to a second verification result indicating that there is an abnormal second configuration file, determine the first configuration file corresponding to the abnormal second configuration file as the configuration file to be verified, and re-encrypt the file name and the first verification value of the configuration file to be verified to obtain the encrypted information, encrypt the configuration file to be verified to obtain the encrypted file, and send the encrypted information and the encrypted file to the edge terminal, so that the edge terminal can update the abnormal second configuration file through the first configuration file corresponding to the abnormal second configuration file; respond to all saved second configuration files being normal, perform a self-restart, and complete the configuration based on the configuration file to be verified and all second configuration files.
12. A document processing device for a ship automation system, characterized in that, The device, configured at the edge terminal of the ship automation system, includes: The file decryption module is used to decrypt the received encrypted file to obtain the configuration file to be configured, and to decrypt the received encrypted information to obtain the file name and first verification value of the configuration file to be configured, wherein the encrypted file and the encrypted information are sent separately. The second verification module is used to determine the second verification value of the configuration file to be configured. The second processing module is used to verify the configuration file to be verified based on the second verification value and the first verification value. If the configuration file to be verified is normal, the encrypted file is saved and a first verification result indicating that the configuration file to be verified is normal is sent to the user terminal. The third processing module is used to verify all the saved second configuration files based on the file names and corresponding first verification values of all the configured first configuration files obtained. The second configuration files are the configuration files that the user terminal has sent to the edge terminal and that the edge terminal has saved normally. The second configuration files include the saved encrypted files. The configuration loading module is used to perform a self-restart in response to the absence of any abnormalities in all saved second configuration files, and to complete the configuration based on the configuration file to be loaded and all second configuration files.
13. A ship automation system, characterized in that, include: User terminal, the user terminal being used to employ the document processing method of the ship automation system as described in any one of claims 1 to 5, or to configure the document processing device of the ship automation system as described in claim 11; An edge terminal, the edge terminal being used to employ the document processing method of the ship automation system as described in any one of claims 6 to 10, or to configure the document processing device of the ship automation system as described in claim 12.