File processing method and device of ship automation system and ship automation system
By using the method of sending verification values and file bodies separately in the ship integrated automation system and encrypting the file contents during the transmission process, the problem of easy tampering and leakage in the data transmission and storage process in the prior art is solved, and the problem of data transmission and storage process is improved. The security and reliability of file transfer ensure the safety of ship operation.
Patent Information
- Application Number
- CN202411501728.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-25
AI Technical Summary
The existing integrated ship automation system is prone to tampering and leaking during data transmission and storage, resulting in low reliability and affecting the safety of ship operations.
By using the verification value and the file body to be sent separately between the user terminal and the edge terminal, the verification value of the file to be configured is determined, and the file content is encrypted during the transmission process to ensure the integrity of the file during the transmission and storage process. and security.
It effectively prevents files from being tampered with or leaked during transmission, improves the security and reliability of user terminals to issue configuration files to edge terminals, and ensures the safety of ship operations.
Smart Images

Figure CN119442314A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of integrated ship automation, and in particular to a file processing method and device for a ship automation system, and a ship automation system. Background Art
[0002] With the rise of cloud computing, big data technology, network security and artificial intelligence, integrated ship automation systems have been widely used on ships. Integrated ship automation systems include user terminals and edge terminals. In order to meet the requirements of users and commissioning personnel for the ease and flexibility of system use, user terminals often need to send and update configurations to edge terminals to dynamically adjust and modify control logic, data collection methods, etc. However, edge terminal devices generally have low configurations and use specialized IoT operating systems. Database software is usually not configured, so related configurations are mostly transmitted and saved in the form of files.
[0003] In the field of integrated ship automation, especially ship control, there are usually extremely high requirements for the security of data transmission and use. The commonly used file processing method is that the user terminal encrypts the configuration file and transmits the encrypted file to the edge terminal, and the edge terminal decrypts the file and stores it. However, this processing method is prone to tampering and leakage during the data transmission and storage process, and has low reliability, which affects the safety of ship operation. Summary of the invention
[0004] The embodiments of the present application provide a file processing method and device for a ship automation system and a ship automation system to improve the security and reliability of a configuration file sent by a user terminal to an edge terminal, thereby ensuring safe operation of the ship.
[0005] In order to solve the above technical problems, the embodiments of the present application disclose the following technical solutions:
[0006] In a first aspect, a file processing method of a ship automation system is provided, which is applied to a user terminal of the ship automation system, and the method comprises:
[0007] Determine a first check value of the configuration file to be configured;
[0008] Encrypting the file name of the to-be-configured file and the first check value to obtain encrypted information, and sending the encrypted information to the edge terminal;
[0009] Encrypting the configuration file to be configured to obtain an encrypted file, and sending the encrypted file to the edge terminal;
[0010] Obtaining a first verification result, where the first verification result is a 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 of the configuration file to be configured, and then verifying the configuration file to be configured based on the second verification value and the first verification value;
[0011] In response to the first verification result indicating that the to-be-configured file is verified normally, the file names of all configured first configuration files and corresponding first verification values are sent to the edge terminal, so that the edge terminal verifies all saved second configuration files.
[0012] In some embodiments, the method further comprises:
[0013] In response to the first verification result indicating that the to-be-configured file is verified abnormally, the encryption information and the encrypted file are resent to the edge terminal so that the edge terminal re-verifies the to-be-configured file.
[0014] In some embodiments, after sending the file names of all configured first configuration files and the corresponding first check values to the edge terminal, the method further includes:
[0015] Obtain a second verification result, where the second verification result is a result obtained by the edge terminal verifying all the saved second configuration files based on the file names of all the configured first configuration files and the corresponding first verification values;
[0016] 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 determined as a to-be-configured configuration file, and the encryption step and the step of sending the encryption information and the encrypted 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 sent successfully, a success message is sent to the edge terminal, where the success message is used to indicate that the encrypted file has been sent successfully.
[0019] In some embodiments, sending a success message to the edge terminal includes:
[0020] The success message is sent to the edge terminal by means of message queue telemetry transmission.
[0021] In some embodiments, encrypting the file name of the configuration file and the first check value to obtain encrypted information includes:
[0022] Constructing a key-value pair corresponding to the file name and the first check value;
[0023] The key-value pair is encrypted using the national encryption SM2 algorithm, and a timestamp element is introduced during encryption to obtain the encrypted information.
[0024] In a second aspect, a file processing method of a ship automation system is provided, which is applied to an edge terminal of the ship automation system, and the method includes:
[0025] Decrypting the received encrypted file to obtain the configuration file to be configured, and decrypting the received encrypted information to obtain the file name and the first check value of the configuration file to be configured;
[0026] Determine a second verification value of the configuration file to be configured;
[0027] Verifying the configuration file to be configured based on the second verification value and the first verification value, and if the configuration file to be configured is verified normally, saving the encrypted file, and sending a first verification result indicating that the configuration file to be configured is verified normally to the user terminal;
[0028] Based on the acquired file names of all configured first configuration files and the corresponding first verification values, verify all saved second configuration files;
[0029] In response to all the saved second configuration files being normal, a self-restart is performed, and configuration is completed based on the to-be-configured file and all the second configuration files.
[0030] In some embodiments, the method further comprises:
[0031] If the verification of the to-be-configured file is abnormal, sending a first verification result indicating the verification of the to-be-configured file is abnormal to the user terminal;
[0032] The encrypted file and the encryption information are re-acquired, and the to-be-configured file is re-verified.
[0033] In some embodiments, the method further comprises:
[0034] In response to the presence of an abnormal file in all the saved second configuration files, sending a second verification result indicating the presence of the abnormal file to the user terminal;
[0035] Obtaining an encrypted file and encryption information corresponding to a target configuration file, and verifying the target configuration file, wherein the target configuration file is a first configuration file corresponding to the abnormal file;
[0036] When the target configuration file passes the verification, the target configuration file is saved and the abnormal file is replaced.
[0037] In some embodiments, the abnormal file includes a missing second configuration file or a second configuration file whose first check value does not match.
[0038] In some embodiments, verifying the configuration file based on the second verification value and the first verification value includes:
[0039] comparing the second verification value with the first verification value;
[0040] If the second verification value is the same as the first verification value, it is determined that the verification of the configuration file to be configured is normal;
[0041] If the second verification value is different from the first verification value, it is determined that the verification of the configuration file to be configured is abnormal.
[0042] In a third aspect, a file processing device of a ship automation system is provided, which is configured in a user terminal of the ship automation system, and the device comprises:
[0043] A first verification module, used to determine a first verification value of the configuration file to be configured;
[0044] A file encryption module, used to encrypt the file name of the to-be-configured file and the first check value to obtain encrypted information, and send the encrypted information to the edge terminal; and encrypt the to-be-configured file to obtain an encrypted file, and send the encrypted file to the edge terminal;
[0045] A verification feedback module is used to obtain a first verification result, where the first verification result is a result obtained by the edge terminal decrypting the encrypted information to obtain the first verification value and decrypting the encrypted file, and then verifying the configuration file based on the second verification value and the first verification value after determining a second verification value of the configuration file to be configured;
[0046] The first processing module is configured to send the file names of all configured first configuration files and corresponding first verification values to the edge terminal in response to the first verification result indicating that the to-be-configured file has been verified normally, so that the edge terminal verifies all saved second configuration files.
[0047] In a fourth aspect, a file processing device of a ship automation system is provided, which is configured at an edge terminal of the ship automation system, and the device includes:
[0048] A file decryption module, 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 the first check value of the configuration file to be configured;
[0049] A second verification module, used to determine a second verification value of the configuration file to be configured;
[0050] A second processing module is configured to verify the configuration file based on the second verification value and the first verification value, and if the configuration file is verified normally, save the encrypted file and send a first verification result indicating that the configuration file is verified normally to the user terminal;
[0051] A third processing module, configured to verify all saved second configuration files based on the acquired file names of all configured first configuration files and the corresponding first verification values;
[0052] The configuration loading module is used to execute self-restart in response to all the saved second configuration files being normal, and complete the configuration based on the configuration file to be configured and all the second configuration files.
[0053] In a fifth aspect, a ship automation system is provided, comprising:
[0054] A user terminal, the user terminal being used to adopt the file processing method of the ship automation system as described in any one of the first aspects, or configured with the file processing device of the ship automation system as described in the third aspect;
[0055] An edge terminal, wherein the edge terminal is used to adopt the file processing method of the ship automation system as described in any one of the second aspects, or to configure the file processing device of the 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 the prior art, a file processing method of a ship automation system of the present application is applied to a user terminal of the ship automation system, and the method includes: determining a first check value of a configuration file to be configured; encrypting the file name and the first check value of the configuration file to be configured to obtain encrypted information, and sending the encrypted information to the edge terminal; encrypting the configuration file to be configured to obtain an encrypted file, and sending the encrypted file to the edge terminal; obtaining a first check result, the first check result is that the edge terminal decrypts the encrypted information to obtain the first check value and decrypts the encrypted file, and after determining the second check value of the configuration file to be configured, the result obtained by checking the configuration file based on the second check value and the first check value; in response to the first check result indicating that the configuration file to be configured is checked normally, the file names and corresponding first check values of all configured first configuration files are sent to the edge terminal, so that the edge terminal verifies all saved second configuration files. The method provided by the present application adopts a method of sending the check value and the file body separately, which can prevent the file from being tampered with during the transmission process, or the edge terminal from receiving a false file, and the file encryption during the transmission process can further prevent the leakage of the file content, thereby improving the security and reliability of the user terminal sending the configuration file to the edge terminal, and ensuring the safety of ship operation.
[0058] A file processing method for a ship automation system of the present application is applied to an edge terminal of the ship automation system. After receiving an encrypted file, it will decrypt and recalculate the check value, and compare it with the check value of the encrypted transmission, which can prevent the file from being tampered with during the transmission process, or the edge terminal receives a false file. The encrypted file is still used during the local storage process, which can further prevent the file content from being leaked. 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, and thus can effectively improve the security and reliability of the configuration file sent by the user terminal to the edge terminal, ensuring the safe operation of the ship. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0060] Figure 1 This is a schematic diagram of the structure of a ship automation system according to an embodiment of the present application;
[0061] Figure 2 A schematic diagram of the overall process of a file processing method for a ship automation system provided in an embodiment of the present application;
[0062] Figure 3A schematic diagram of a specific flow chart of a file processing method for a ship automation system provided in an embodiment of the present application;
[0063] Figure 4 A schematic diagram of the overall process of another file processing method for a ship automation system provided in an embodiment of the present application;
[0064] Figure 5 A schematic diagram of a specific flow chart of another file processing method for a ship automation system provided in an embodiment of the present application;
[0065] Figure 6 A schematic diagram of the structure of a file processing device for a ship automation system provided in an embodiment of the present application;
[0066] Figure 7 A schematic diagram of the structure of another file processing device for a ship automation system provided in an embodiment of the present application;
[0067] Figure 8 A communication interaction diagram of a ship automation system provided in an embodiment of the present application;
[0068] Reference numerals:
[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 DESCRIPTION
[0070] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0071] In the description of the present application, it should be understood that the terms "upper", "lower", "front", "back", "left", "right", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first" and "second" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the present application, "multiple" means two or more, and at least one means one, two or more, unless otherwise clearly and specifically defined.
[0072] See also Figure 1 , Figure 1 Schematic diagram of the structure of the ship automation system of the embodiment of the present application. The ship automation system of the embodiment of the present application includes a user terminal 10 and an edge terminal 20. The number of edge terminals 20 can be one or more, and the edge terminal 20 is set on the ship and can be an embedded device, such as a control board, which can control and monitor the corresponding ship equipment connected to it. The user terminal 10 is usually one and is set on the ship. The user terminal 10 is an operation terminal used by users and debuggers, and can specifically include hardware such as a computer and a display screen, and the display screen is used to display the user operation interface.
[0073] In the process of the user terminal 10 sending the configuration file to the edge terminal 20, the commonly used file processing method is that the user terminal 10 encrypts the configuration file and transmits it to the edge terminal 20, and the edge terminal 20 decrypts the file and stores it. This method has a relatively simple logic, is easily tampered with and leaked during data transmission and storage, has low reliability, and thus affects 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, an embodiment of the present application provides a file processing method for a ship automation system, which prevents files from being tampered with or leaked during transmission, or edge terminals from receiving false files, by encrypting and transmitting files and sending check values and file bodies separately. It prevents files from being tampered with in edge terminal storage by performing a global comparison with all configured first configuration files of the user terminal before executing the configuration, thereby effectively improving the security and reliability of configuration files sent by the user terminal to the edge terminal, ensuring the safe operation of the ship, and solving at least part of the above-mentioned technical problems.
[0075] See also Figure 2 , Figure 2 The overall flow diagram of a file processing method for a ship automation system provided in an embodiment of the present application is shown in FIG. The method is applied to a user terminal and specifically includes the following steps:
[0076] Step 201: Determine a first verification value of a configuration file to be configured.
[0077] Specifically, the configuration file to be configured may include communication protocol configuration files, automation control logic files, system configuration files of edge terminals, etc. The first check value of the configuration file to be configured is a string of fixed-length numerical values or strings obtained by calculating the content of the configuration file to be configured. It is used to verify the integrity and accuracy of the configuration file to be configured to ensure that no error or damage occurs during the transmission, storage or copying of the configuration file.
[0078] In some examples, the national secret SM3 algorithm can be used to calculate the first check value of the configuration file to be configured, that is, the first check value is the SM3 hash value. In this way, the encryption and decryption speed is faster, and the localization requirements can be better met. In other examples, other hash function algorithms can also be used, such as MD5 (Message Digest Algorithm 5, Information Digest Algorithm 5) algorithm, SHA-2 (Secure Hash Algorithm 2, Secure Hash Algorithm 2), SHA-256 (Secure Hash Algorithm 256, Secure Hash Algorithm 256), etc., and the embodiments of the present application do not specifically limit this.
[0079] Step 202: Encrypt the file name and the 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 may be implemented by:
[0081] Construct a key-value pair corresponding to the file name and the first check value. Use the national encryption SM2 algorithm to encrypt the key-value pair, and introduce a timestamp element during encryption to obtain encrypted information.
[0082] Through the above solution, not only the encryption and decryption speed is faster, but also it can better meet the localization requirements. Moreover, adding the timestamp element can increase the difficulty of cracking, thereby further improving the transmission security and reliability.
[0083] For example, the encrypted information can be sent to the edge terminal via the MQTT (Message Queuing Telemetry Transport) communication method. Since the MQTT communication method has a small resource overhead, a faster sending speed can be obtained, thereby improving transmission efficiency.
[0084] In other embodiments, other encryption methods may be used to encrypt the file name and the first verification value, such as the national secret SM4 algorithm, AES (Advanced Encryption Standard) algorithm, RSA algorithm, or a combination of any encryption methods. The embodiments of the present application do not specifically limit this.
[0085] Step 203: Encrypt the configuration file to obtain an encrypted file, and send the encrypted file to the edge terminal.
[0086] Exemplarily, the configuration file may be encrypted using a combination of one or more of the national encryption SM2 algorithm, the national encryption SM4 algorithm, the AES algorithm, and the RSA algorithm.
[0087] For example, the encrypted file may be transmitted to the edge terminal via the FTP protocol (File Transfer Protocol). Since the reliability of FTP communication is high, the integrity of the file during the transmission process can be better guaranteed.
[0088] In addition, the embodiments of the present application may also adopt other message and file communication methods, such as HTTP, TCPSocket, TFTP, etc., which are not specifically limited in the embodiments of the present application.
[0089] It should be noted that in the embodiment of the present application, the encrypted file and the encrypted information are sent separately, that is, the encrypted information can be sent first and then the encrypted file through one sending channel, or the encrypted file can be sent first and then the encrypted information through one sending channel, or the encrypted file and the encrypted information can be sent separately through two sending channels. The embodiment of the present application does not limit the specific separate sending method.
[0090] Through the above scheme, the file verification value and the file body are sent separately, which can prevent the file from being tampered with or receiving false files during the transmission process. In addition, encryption during the file transmission process can further prevent the file content from being leaked.
[0091] In some embodiments, after executing step 203, the method of the embodiment of the present application may further include:
[0092] After the encrypted file is sent successfully, a success message is sent to the edge terminal, and the success message is used to indicate that the encrypted file has been sent successfully.
[0093] Specifically, the success message may carry the file name of the configuration file.
[0094] In some examples, the user terminal can use the message queue telemetry transmission method (ie, the MQTT communication method) to send a success message to the edge terminal, which can effectively improve the 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, and then the encrypted file can be backed up in the specified path of the user terminal. The specified path can be divided into different branches according to the update time, which corresponds to the update time in the historical configuration library. Among them, the historical configuration library can use the MySql database, which contains the information of all configured first configuration files and marks all the latest first configuration files. The information of the first configuration file may include file path, first check value, update time, etc., and is saved in the format of file path, first check value, and update time. The latest configuration file can be determined by comparing the update time. In addition, the historical configuration library can also use other database software or text storage methods, or can also use any other suitable data format, which is not specifically limited in the embodiments of the present application.
[0096] It is understandable that the first configuration file and the configuration file to be configured both refer to the configuration files required by the edge terminal, and the names are used to distinguish different configuration files. After the configuration file to be configured is saved in the historical configuration library, the configuration file to be configured is also converted to the first configuration file. Each first configuration file can be stored in the historical configuration library in an encrypted form.
[0097] Step 204: Obtain a first verification result, where the edge terminal decrypts the encrypted information to obtain a first verification value and decrypts the encrypted file, and after determining a second verification value of the configuration file to be configured, verifies the configuration file based on the second verification value and the first verification value.
[0098] It is understandable that after receiving the encrypted file and the encrypted information, the edge terminal will decrypt the encrypted file and the encrypted information using a preset decryption algorithm, determine the second verification value of the configuration file to be configured using the same verification value generation method as the user terminal, and then verify the configuration file to be configured based on the first verification value and the second verification value to obtain a first verification result. For specific verification methods, please refer to the introduction of the subsequent related embodiments.
[0099] Step 205: In response to the first verification result indicating that the to-be-configured configuration files are verified normally, the file names of all configured first configuration files and the corresponding first verification values are sent to the edge terminal, so that the edge terminal verifies all saved second configuration files.
[0100] Specifically, the file names of the first configuration files historically configured in the historical configuration library and the corresponding first verification values are sent to the edge terminal, so that the edge terminal uses the file names of the first configuration files and the corresponding first verification values to verify all the saved second configuration files. For the specific verification method, please refer to the introduction of the subsequent related embodiments.
[0101] See also Figure 3 , Figure 3 A specific flow chart of a file processing method for a ship automation system provided in an embodiment of the present application. In some embodiments, in addition to the above steps 201 to 205, the method of the embodiment of the present application also includes:
[0102] Step 206: In response to the first verification result indicating that the verification of the configuration file to be configured is abnormal, the encryption information and the encrypted file are resent to the edge terminal so that the edge terminal re-verifies the configuration file to be configured.
[0103] That is to say, in the case of an edge terminal verification exception, it may mean that the file has been tampered with or an exception has occurred during the transmission process. At this time, the user terminal can re-encrypt the configuration file and encrypt and send the file name and the first verification value of the configuration file to ensure that the edge terminal receives the correct configuration file, thereby ensuring the safe operation of the ship.
[0104] In some embodiments, after executing step 205, the method of the embodiment of the present application further includes:
[0105] Step 207: Obtain a second verification result, where the second verification result is a result obtained after the edge terminal verifies all the saved second configuration files based on the file names of all the configured first configuration files and the corresponding first verification values.
[0106] Specifically, the edge terminal will compare the file name of the received configured first configuration file and the corresponding first verification value with the file names of all saved second configuration files and the corresponding first verification values one by one, verify whether there is a second configuration file with a different or missing first verification value, and feedback the result to the user terminal.
[0107] It should be noted that the second configuration file and the first configuration file both refer to configuration files, but they are saved in different locations. The first configuration file is a configuration file saved in the user terminal, and the second configuration file is a configuration file saved in the edge terminal. The distinction in the names is for clearer description.
[0108] Step 208: 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 determined as the configuration file to be configured, 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 that there is an abnormal second configuration file, the user terminal can call out the first configuration file corresponding to the abnormal second configuration file from the historical configuration library, and determine the file as the configuration file to be configured, execute the file processing method of the embodiment of the present application to encrypt the configuration file accordingly 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 configurations can be completed normally and ensuring the safe operation of the ship.
[0110] It can be understood that the method of the embodiment of the present application adopts a method of sending the verification value and the file body separately, which can prevent the file from being tampered with during the transmission process, or the edge terminal from receiving a false file, and the file encryption during the transmission process can further prevent the leakage of the file content, thereby improving the security and reliability of the user terminal sending the configuration file to the edge terminal, ensuring the safe operation of the ship.
[0111] Please also refer to Figure 4 and Figure 5 , Figure 4 This is a schematic diagram of the overall process of another file processing method for a ship automation system provided in an embodiment of the present application. Figure 5 A specific flow chart of another file processing method for a ship automation system provided in an embodiment of the present application. 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 the first check value of the configuration file to be configured.
[0113] Specifically, the encrypted files and encrypted information may be decrypted using a key pre-built into the edge terminal.
[0114] Step 402: Determine a second verification value of the configuration file to be configured.
[0115] Specifically, the edge terminal determines the second check value of the configuration file in the same way as the user terminal in calculating the check value. Exemplarily, the national secret SM3 algorithm can be used to calculate the second check value of the configuration file to be configured, that is, the second check value is the SM3 hash value. In this way, the encryption and decryption speed is faster, and the localization requirements can be better met. In other examples, other hash function algorithms can also be used, such as MD5 (Message Digest Algorithm 5, Information Digest Algorithm 5) algorithm, SHA-2 (Secure Hash Algorithm 2, Secure Hash Algorithm 2), SHA-256 (Secure Hash Algorithm 256, Secure Hash Algorithm 256), etc., which can be determined in the same way as the first check value, and the specific method is not limited to the embodiment of the present application.
[0116] Step 403: Verify the configuration file to be processed based on the second verification value and the first verification value.
[0117] In some embodiments, step 403 is specifically implemented in the following manner:
[0118] Step 1: compare the second verification value with the first verification value.
[0119] Step 2: If the second check value is the same as the first check value, it is determined that the check of the configuration file to be configured is normal. If the second check value is different from the first check value, it is determined that the check of the configuration file to be configured is abnormal.
[0120] Specifically, for configuration files with the same content, the same check value algorithm should be used to obtain the same check value. If the check value changes, it may indicate that the configuration file has been tampered with or abnormal during transmission.
[0121] Step 404: If the verification of the configuration file to be configured is normal, the encrypted file is saved, and a first verification result indicating that the verification of the configuration file to be configured is normal is sent to the user terminal.
[0122] Specifically, the encrypted file can be saved in the configuration library of the edge terminal, and the configuration library stores information of all second configuration files, wherein the information of the second configuration file can include file path, first check value, update time, etc., and is saved in the format of file path, first check value, and update time. The latest configuration file can be determined by comparing the update time. Each second configuration file can be stored in the configuration library in an encrypted form.
[0123] It can be understood that the second configuration files are configuration files that have been sent by the user terminal to the edge terminal and are normally saved by the edge terminal.
[0124] In addition, in some embodiments, the method of the embodiment of the present application may also include:
[0125] Step 407: If the configuration file to be verified is abnormal, a first verification result indicating the configuration file to be verified is sent to the user terminal, so that the user terminal re-executes steps 202 and 203, the edge terminal re-acquires the encrypted file and encryption information, and re-verifies the configuration file to be verified.
[0126] That is to say, if the configuration file is checked abnormally, it may be that an abnormality occurred in the file during the transmission process. At this time, the edge terminal will feedback to the user terminal and make the user terminal resend the encrypted file and encryption information of the configuration file.
[0127] Specifically, the first verification result can be transmitted in the form of an MQTT message.
[0128] Step 405: based on the acquired file names of all configured first configuration files and the corresponding first verification values, verify all saved second configuration files.
[0129] Specifically, the edge terminal may compare all the saved second configuration files with all the acquired first configuration files one by one based on the file names and the corresponding first verification values to see whether they correspond.
[0130] Through the above solution, the edge terminal can perform a global comparison of all second configuration files, and can comprehensively check all configurations of the edge terminal before the edge terminal restarts and updates the configuration, to prevent the second configuration file from being lost or tampered with locally in the edge terminal, thereby further improving the safety and reliability of ship control.
[0131] Step 406: In response to all the saved second configuration files being normal, a self-restart is performed, and configuration is completed based on the configuration file to be configured and all the second configuration files.
[0132] In some embodiments, the abnormal file includes a missing second configuration file or a second configuration file whose first check value does not match.
[0133] Specifically, the edge terminal will restart, and at startup, read and decrypt the configuration file and all second configuration files and load them into corresponding programs to complete the configuration.
[0134] In some embodiments, the method of the embodiment of the present application further includes:
[0135] Step 408: In response to the presence of an abnormal file in all the saved second configuration files, a second verification result indicating the presence of the abnormal file is sent to the user terminal.
[0136] Specifically, if there is a missing second configuration file or a second configuration file whose first verification value does not match among all the second configuration files, the second verification result is sent to the user terminal in the form of an MQTT message, so that the user terminal re-retrieves the corresponding first configuration file from the historical configuration library for encryption (or directly re-retrieves the encrypted first configuration file), and reads the corresponding configuration file information from the historical configuration library, and re-sends 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, where the target configuration file is the first configuration file corresponding to the abnormal file.
[0138] Specifically, the way in which the edge terminal decrypts the encrypted file and encrypted information corresponding to the target configuration file and the way in which it verifies are the same as those of the configuration file to be configured in the aforementioned embodiment, and will not be described in detail here.
[0139] Step 410: When the target configuration file passes the verification, the target configuration file is saved and the abnormal file is replaced.
[0140] That is to say, when the target configuration file passes the verification, the abnormal second configuration file is replaced with the target configuration file to obtain a normal second configuration file.
[0141] It is understandable that the method provided by the embodiment of the present application adopts a method of sending the file check value and the file body separately, which prevents the file from being tampered with or receiving a false file during the transmission process; the encrypted file is used in the file transmission and local storage process, and is only decrypted and read in the process of comparing the check value and self-restarting at the edge terminal, which prevents the leakage of the file content; by performing a global comparison with the user terminal historical configuration library before the edge terminal self-restarts, the file is prevented from being tampered with or deleted in the edge terminal storage. In addition, the method of the embodiment of the present application does not need to rely on any specific external software, middleware, hardware, operating system, and can freely choose the communication method, storage method, and encryption method, with low implementation cost and strong compatibility.
[0142] It should be noted that the contents of the various embodiments of the present application can refer to each other, and for the content not described in detail in one embodiment, reference can be made to the content of another embodiment.
[0143] Accordingly, see Figure 6 , Figure 6A schematic diagram of the structure of a file processing device of a ship automation system provided in an embodiment of the present application. For ease of description, the file processing device is represented by a first file processing device 60. The first file processing device 60 is configured in a user terminal of the ship automation system. The device includes a first verification module 601, a file encryption module 602, a verification feedback module 603 and a first processing module 604.
[0144] A first verification module 601, used to determine a first verification value of the configuration file to be configured;
[0145] The file encryption module 602 is used to encrypt the file name and the first check value of the configuration file to obtain encrypted information, and send the encrypted information to the edge terminal; and 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 a first verification result, where the first verification result is a result obtained by the edge terminal decrypting the encrypted information to obtain a first verification value and decrypting the encrypted file, and after determining a second verification value of the configuration file to be configured, 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 configured to send the file names of all configured first configuration files and the corresponding first verification values to the edge terminal in response to the first verification result indicating that the to-be-configured configuration files are verified normally, so that the edge terminal verifies all 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 that the configuration file to be configured is verified abnormally, the encrypted information and the encrypted file are re-sent to the edge terminal so that the edge terminal re-verifies the configuration file to be configured.
[0150] In some embodiments, after sending the file names of all configured first configuration files and the corresponding first check values to the edge terminal, the first processing module 604 is further configured to:
[0151] Obtain a second verification result, where the second verification result is a result obtained after the edge terminal verifies all the saved second configuration files based on the file names of all the 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 determined as the configuration file to be configured, and the encryption step and the step of sending the encrypted information and the encrypted 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.
[0153] In some embodiments, after sending the encrypted file to the edge terminal, the file encryption module 602 is further used to:
[0154] After the encrypted file is sent successfully, a success message is sent to the edge terminal, and the success message is used to indicate that the encrypted file has been sent successfully.
[0155] In some embodiments, the file encryption module 602 is specifically used to:
[0156] The message queue telemetry transmission method is used to send success messages to the edge terminal.
[0157] In some embodiments, the file encryption module 602 is specifically used to:
[0158] Construct a key-value pair corresponding to the file name and the first check value;
[0159] The national encryption SM2 algorithm is used to encrypt the key-value pairs, and a timestamp element is introduced during encryption to obtain encrypted information.
[0160] It can be understood that the device of the embodiment of the present application adopts a method of sending the verification value and the file body separately, which can prevent the file from being tampered with during the transmission process, or the edge terminal from receiving a false file, and the file encryption during the transmission process can further prevent the leakage of the file content, thereby improving the security and reliability of the user terminal sending the configuration file to the edge terminal, ensuring the safe operation of the ship.
[0161] Accordingly, see Figure 7 , Figure 7 A schematic diagram of the structure of another file processing device of a ship automation system provided in an embodiment of the present application. For ease of description, the file processing device is represented by a second file processing device 70. The second file processing device 70 is configured at an edge terminal of the ship automation system. The device includes a file 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 the first check value of the configuration file to be configured;
[0163] A second verification module 702, used to determine a 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 configured based on the second verification value and the first verification value. If the configuration file to be configured is verified normally, the encrypted file is saved and a first verification result indicating that the configuration file to be configured is verified normally 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 acquired file names of all the configured first configuration files and the corresponding first verification values;
[0166] The configuration loading module 705 is used to execute self-restart in response to all the saved second configuration files being normal, and complete the configuration based on the configuration file to be configured and all the second configuration files.
[0167] In some embodiments, the second processing module 703 is further configured to:
[0168] If the verification of the to-be-configured file is abnormal, sending a first verification result indicating the verification of the to-be-configured file is abnormal to the user terminal;
[0169] Re-obtain the encrypted file and encryption information, and re-verify the configuration file.
[0170] In some embodiments, the configuration loading module 705 is further used to:
[0171] In response to the presence of an abnormal file in all the saved second configuration files, sending a second verification result indicating the presence of the abnormal file to the user terminal;
[0172] Obtaining the encrypted file and encryption information corresponding to the target configuration file, and verifying the target configuration file, where 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 check value does not match.
[0175] In some embodiments, the third processing module 704 is specifically used to:
[0176] comparing the second check value with the first check value;
[0177] If the second verification value is the same as the first verification value, it is determined that the verification of the configuration file to be configured is normal;
[0178] If the second verification value is different from the first verification value, it is determined that the verification of the configuration file to be configured is abnormal.
[0179] It can be understood that the device of the embodiment of the present application will decrypt and recalculate the check value after receiving the encrypted file, and compare it with the check value of the encrypted transmission, which can prevent the file from being tampered with during the transmission process, or the edge terminal from receiving a false file. The encrypted file is still used during the local storage process, which can further prevent the file content from being leaked. 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, and thus can effectively improve the security and reliability of the configuration file sent by the user terminal to the edge terminal, thereby ensuring the safe operation of the ship.
[0180] Accordingly, see Figure 8 , Figure 8 A communication interaction diagram of a ship automation system provided in an embodiment of the present application. The ship automation system includes a user terminal 10 and an edge terminal 20. The user terminal 10 is used to adopt a file processing method of a ship automation system provided in an embodiment of the present application, or to configure a first file processing device 60 of an embodiment of the present application. The edge terminal 20 is used to adopt another file processing method of a ship automation system provided in an embodiment of the present application, or to configure a second file processing device 70 of an embodiment of the present application.
[0181] Exemplarily, the interaction process includes the following steps:
[0182] The user terminal 10 sends the name and check value of the file to the edge terminal 20 through the MQTT protocol.
[0183] The user terminal 10 sends the encrypted file to the edge terminal 20 through the FTP protocol.
[0184] The user terminal 10 sends a file sending success message to the edge terminal 20 through the MQTT protocol.
[0185] The edge terminal 20 sends the first verification result to the user terminal 10 .
[0186] If the first verification result indicates that the comparison is successful, the user terminal 10 sends the names and verification values of all configuration files to the edge terminal 20 through the MQTT protocol, and the edge terminal 20 sends the second verification result to the user terminal 10. If the first verification result indicates that the comparison fails, the process returns to the step of the user terminal 10 sending the names and verification values of the files to the edge terminal 20 through the MQTT protocol.
[0187] If the second verification result indicates that the comparison is successful, the process ends. If the second verification result indicates that the comparison fails, the process returns to the step in which the user terminal 10 sends the file name and verification value to the edge terminal 20 through the MQTT protocol.
[0188] It should be noted that the specific implementation method can be found in the aforementioned related method embodiments, which will not be repeated here.
[0189] It can be understood that the ship automation system of the embodiment of the present application can improve the security and reliability of the user terminal 10 sending the configuration file to the edge terminal 20, thereby ensuring the safe operation of the ship.
[0190] The above is a detailed introduction to a file processing method, device and ship automation system of a ship automation system provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the technical solution and core idea of the present application; ordinary technicians in this field should understand that: they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some of the technical features therein with equivalents; and these modifications or replacements do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present application.
Claims
1. A file processing method for a ship automation system, characterized in that: The method is applied to a user terminal of the ship automation system, and comprises: Determine a first check value of the configuration file to be configured; Encrypting the file name of the to-be-configured file and the first check value to obtain encrypted information, and sending the encrypted information to the edge terminal; Encrypting the configuration file to be configured to obtain an encrypted file, and sending the encrypted file to the edge terminal; Obtaining a first verification result, where the first verification result is a 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 of the configuration file to be configured, and then verifying the configuration file to be configured based on the second verification value and the first verification value; In response to the first verification result indicating that the to-be-configured file is verified normally, the file names of all configured first configuration files and corresponding first verification values are sent to the edge terminal, so that the edge terminal verifies all saved second configuration files.
2. The file processing method of the ship automation system according to claim 1, characterized in that: The method further comprises: In response to the first verification result indicating that the to-be-configured file is verified abnormally, the encryption information and the encrypted file are resent to the edge terminal so that the edge terminal re-verifies the to-be-configured file.
3. The file processing method of the ship automation system according to claim 1, characterized in that: After sending the file names of all configured first configuration files and the corresponding first check values to the edge terminal, the method further includes: Obtain a second verification result, where the second verification result is a result obtained by the edge terminal verifying all the saved second configuration files based on the file names of all the configured first configuration files and the corresponding first verification values; 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 determined as a to-be-configured configuration file, and the encryption step and the step of sending the encryption information and the encrypted 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.
4. The file processing method of the ship automation system according to claim 1, characterized in that: After sending the encrypted file to the edge terminal, the method further includes: After the encrypted file is sent successfully, a success message is sent to the edge terminal, where the success message is used to indicate that the encrypted file has been sent successfully.
5. The file processing method of the ship automation system according to claim 4, characterized in that: Sending a success message to the edge terminal includes: The success message is sent to the edge terminal by means of message queue telemetry transmission.
6. The file processing method of the ship automation system according to claim 1, characterized in that: Encrypting the file name of the configuration file and the first check value to obtain encrypted information includes: Constructing a key-value pair corresponding to the file name and the first check value; The key-value pair is encrypted using the national encryption SM2 algorithm, and a timestamp element is introduced during encryption to obtain the encrypted information.
7. A file processing method for a ship automation system, characterized in that: The method applied to the edge terminal of the ship automation system comprises: Decrypting the received encrypted file to obtain the configuration file to be configured, and decrypting the received encrypted information to obtain the file name and the first check value of the configuration file to be configured; Determine a second verification value of the configuration file to be configured; Verifying the configuration file to be configured based on the second verification value and the first verification value, and if the configuration file to be configured is verified normally, saving the encrypted file, and sending a first verification result indicating that the configuration file to be configured is verified normally to the user terminal; Based on the acquired file names of all configured first configuration files and the corresponding first verification values, verify all saved second configuration files; In response to all the saved second configuration files being normal, a self-restart is performed, and configuration is completed based on the to-be-configured file and all the second configuration files.
8. The file processing method of the ship automation system according to claim 7, characterized in that: The method further comprises: If the verification of the to-be-configured file is abnormal, sending a first verification result indicating the verification of the to-be-configured file is abnormal to the user terminal; The encrypted file and the encryption information are re-acquired, and the to-be-configured file is re-verified.
9. The file processing method of the ship automation system according to claim 7, characterized in that: The method further comprises: In response to the presence of an abnormal file in all the saved second configuration files, sending a second verification result indicating the presence of the abnormal file to the user terminal; Obtaining an encrypted file and encryption information corresponding to a target configuration file, and verifying the target configuration file, wherein the target configuration file is a first configuration file corresponding to the abnormal file; When the target configuration file passes the verification, the target configuration file is saved and the abnormal file is replaced.
10. The file processing method of the ship automation system according to claim 9, characterized in that: The abnormal file includes a missing second configuration file or a second configuration file whose first verification value does not match.
11. The file processing method of the ship automation system according to claim 7, characterized in that: Verifying the configuration file to be configured based on the second verification value and the first verification value includes: comparing the second verification value with the first verification value; If the second verification value is the same as the first verification value, it is determined that the verification of the configuration file to be configured is normal; If the second verification value is different from the first verification value, it is determined that the verification of the configuration file to be configured is abnormal.
12. A file processing device for a ship automation system, characterized in that: A user terminal configured in the ship automation system, the device comprising: A first verification module, used to determine a first verification value of the configuration file to be configured; A file encryption module, used to encrypt the file name of the to-be-configured file and the first check value to obtain encrypted information, and send the encrypted information to the edge terminal; and encrypt the to-be-configured file to obtain an encrypted file, and send the encrypted file to the edge terminal; A verification feedback module is used to obtain a first verification result, where the first verification result is a result obtained by the edge terminal decrypting the encrypted information to obtain the first verification value and decrypting the encrypted file, and then verifying the configuration file based on the second verification value and the first verification value after determining a second verification value of the configuration file to be configured; The first processing module is configured to send the file names of all configured first configuration files and corresponding first verification values to the edge terminal in response to the first verification result indicating that the to-be-configured file has been verified normally, so that the edge terminal verifies all saved second configuration files.
13. A file processing device for a ship automation system, characterized in that: The device is configured at an edge terminal of the ship automation system, and comprises: A file decryption module, 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 the first check value of the configuration file to be configured; A second verification module, used to determine a second verification value of the configuration file to be configured; A second processing module is configured to verify the configuration file based on the second verification value and the first verification value, and if the configuration file is verified normally, save the encrypted file and send a first verification result indicating that the configuration file is verified normally to the user terminal; A third processing module, configured to verify all saved second configuration files based on the acquired file names of all configured first configuration files and the corresponding first verification values; The configuration loading module is used to execute self-restart in response to all the saved second configuration files being normal, and complete the configuration based on the configuration file to be configured and all the second configuration files.
14. A ship automation system, characterized in that: include: A user terminal, the user terminal being used to adopt the file processing method of the ship automation system according to any one of claims 1 to 6, or configured with the file processing device of the ship automation system according to claim 12; An edge terminal, wherein the edge terminal is used to adopt the file processing method of the ship automation system as described in any one of claims 7 to 11, or to be configured with the file processing device of the ship automation system as described in claim 13.
Citation Information
Patent Citations
System configuration method and device and storage medium
CN114928551A
Updating configuration method and device based on smart television box security
CN116647732A
File transmission processing method and device
CN117061176A
Systems and methods for storing and verifying security information
US20130290731A1
Vehicle-Mounted Device Upgrade Method and Related Apparatus
US20210311720A1