Message verification method, device, equipment, medium and product
By verifying the completeness and accuracy of messages of IoT devices, the problem of inaccurate message verification in industrial application scenarios is solved, the reliability and security of data transmission are improved, and the risk of accidents is reduced.
Patent Information
- Application Number
- CN202411292495.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2024-12-10
AI Technical Summary
In industrial application scenarios of IoT devices, the packet may have completeness missing or errors due to transmission methods, device protocols or environmental interference. The existing verification methods only check the standard verification code and fail to effectively ensure the packet. The completeness and accuracy of industrial production will increase the risk of accident monitoring or control.
By performing integrity verification of the verification packet data, decode the encrypted packet header to obtain the plaintext packet header and key identification, use the target key to decrypt the data segment, and use the header word length and plaintext packet header to decrypt it. The department performs accuracy verification to ensure that the message verification is considered to be passed only if both integrity and accuracy are passed.
It improves the accuracy of message verification, reduces the risk of production accidents caused by errors or tampering with data, and enhances the reliability of data transmission in industrial application scenarios.
Smart Images

Figure HDA0005047345120000011 
Figure HDA0005047345120000012 
Figure HDA0005047345120000013
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message verification method, device, equipment, medium and product. Background Art
[0002] In the industrial application scenarios of IoT devices, it is necessary to send and receive messages between the host computer and the device to complete the control and data collection of the target device. As the data carrier of device communication, the message is usually composed of multiple fields. According to the different underlying communication protocols adopted by IoT devices, these fields also have different composition rules.
[0003] When industrial equipment and the host computer parse communication messages, due to the influence of factors such as transmission mode, equipment protocol, environmental interference or human damage, the obtained messages may lack integrity and carry erroneous information, or may be forged or tampered with. These abnormal data can easily cause industrial production monitoring or control accidents. The commonly used message verification method in industrial application scenarios generally only checks the standard message verification code, and does not verify the integrity of the message itself and abnormal data, resulting in low accuracy of message verification. Summary of the invention
[0004] The purpose of this application is to provide a message verification method, device, equipment, medium and product, which can improve the accuracy of message verification.
[0005] To achieve the above objectives, this application provides the following solutions:
[0006] In a first aspect, the present application provides a message verification method, comprising:
[0007] Performing integrity check on the message data to be checked read from the cache to obtain an integrity check result;
[0008] If the integrity check result indicates that the message data to be checked is complete data, the encrypted message header in the message data to be checked is decoded to obtain a plaintext message header and a key identifier;
[0009] Acquire a target key corresponding to the key identifier from a key database;
[0010] Decrypting the encrypted data segment in the message data to be verified by using the target key to obtain the target data segment;
[0011] Performing accuracy verification on the target data segment based on the header word length in the message data to be verified and the plaintext message header to obtain an accuracy verification result;
[0012] If the accuracy check result indicates that the target data segment is accurate, it is determined that the to-be-checked message data has passed the check.
[0013] Optionally, performing integrity check on the to-be-checked message data read from the cache to obtain an integrity check result specifically includes:
[0014] Identify the symbols contained in the message data to be checked read from the cache to obtain an identification result;
[0015] If the recognition result indicates that the symbol check in the message data to be checked passes, obtaining the header word length and the encrypted message header in the message data to be checked;
[0016] Verify the length of the encrypted message header based on the header word length to obtain a length verification result;
[0017] If the length check result indicates that the length check of the encrypted message header passes, the message data to be checked is determined as complete data as the integrity check result.
[0018] Optionally, the identifying a symbol contained in the message data to be checked read from the cache to obtain an identification result specifically includes:
[0019] Identify the start symbol and the end symbol contained in the message data to be checked read from the cache to obtain the start symbol information and the end symbol information; wherein the start symbol information at least includes the number of start symbols and the start symbol position, and the end symbol information at least includes the number of end symbols and the end symbol position;
[0020] If the number of starting symbols and the number of ending symbols are both 1, and the starting symbol position is at the starting position of the message data to be checked and the ending symbol position is at the ending position of the message data to be checked, then the symbol check in the message data to be checked is determined as the recognition result.
[0021] Optionally, the verifying the length of the encrypted message header based on the header word length to obtain a length verification result specifically includes:
[0022] The encrypted header word length of the encrypted message header is calculated according to the header word length;
[0023] Obtaining the actual header length of the encrypted message header;
[0024] If the actual header word length is greater than or equal to the encrypted header word length, the length check of the encrypted message header is passed and determined as the length check result.
[0025] Optionally, performing accuracy verification on the target data segment based on the header word length in the message data to be verified and the plaintext message header to obtain an accuracy verification result specifically includes:
[0026] Obtaining the current verification code in the message data to be verified;
[0027] Calculate the actual check code based on the header word length in the message data to be checked, the plaintext message header and the target data segment;
[0028] If the actual check code is the same as the current check code, the target data segment is accurately determined as the accuracy check result.
[0029] Optionally, the message verification method further includes:
[0030] Replacing the encrypted message header and the encrypted data segment of the message data to be verified that have passed the verification based on the plaintext message header and the target data segment to obtain the plaintext message data;
[0031] Sending the plaintext message data to a data processing module so that the data processing module parses the plaintext message data to obtain a parsing result, and sending the parsing result to a host device corresponding to the parsing result;
[0032] Deleting the message data to be checked in the cache, and detecting whether there is readable data in the cache to obtain a detection result;
[0033] If the detection result indicates that the readable data does not exist in the cache, determining that the message verification is completed;
[0034] If the detection result indicates that the readable data exists in the cache, the steps from performing integrity check on the to-be-checked message data read from the cache to obtaining the accuracy check result are executed.
[0035] In a second aspect, the present application provides a message verification device, comprising:
[0036] The integrity check unit is used to perform integrity check on the message data to be checked read from the cache to obtain an integrity check result;
[0037] A decoding unit, configured to decode the encrypted message header in the message data to be checked to obtain a plaintext message header and a key identifier if the integrity check result indicates that the message data to be checked is complete data;
[0038] An acquisition unit, used for acquiring a target key corresponding to the key identifier from a key database;
[0039] A decryption unit, used to decrypt the encrypted data segment in the message data to be verified by using the target key to obtain a target data segment;
[0040] An accuracy checking unit, configured to perform an accuracy check on the target data segment based on the header word length in the message data to be checked and the plaintext message header, to obtain an accuracy check result;
[0041] A determination unit is used to determine that the verification of the message data to be verified has passed if the accuracy verification result indicates that the target data segment is accurate.
[0042] In a third aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any one of the message verification methods described above.
[0043] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the message verification methods described above.
[0044] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of any one of the message verification methods described above.
[0045] According to the specific embodiments provided in this application, this application discloses the following technical effects:
[0046] The present application provides a message verification method, apparatus, device, medium and product, which can verify the integrity of message data to be verified, and can also decode the encrypted message header of the message data to be verified when the integrity verification passes, to obtain a plaintext message header and a key identifier; and based on the key identifier, the encrypted data segment in the message data to be verified can be decrypted to obtain a target data segment; and the accuracy of the decrypted target data segment can be verified based on the header word length and the plaintext message header, and only when both the integrity check and the accuracy check are passed, the message data to be verified is considered to have passed the verification, thereby improving the accuracy of the message verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1 A schematic diagram of an application environment of a message verification method in an embodiment of the present application;
[0049] Figure 2 A flowchart of a message verification method provided in one embodiment of the present application;
[0050] Figure 3 A schematic diagram of the structure of a message data provided in an embodiment of the present application;
[0051] Figure 4 A schematic diagram of functional modules of a message verification device provided in one embodiment of the present application;
[0052] Figure 5 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0055] The message verification method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the collection equipment can be various physical equipment and sensors at the industrial generation environment site, and the collection equipment can communicate with the message verification device through the network. The cache can store the data that the message verification device needs to process. The cache can be set separately, integrated in the message verification device, or placed on the cloud or other servers. The collection equipment can send the collected information to the message verification device through message data. After the message verification device receives the message data to be processed, for the message data to be processed, the message verification device stores the message data as the message data to be verified in the cache of the message verification device, and performs integrity verification and accuracy verification on the message data to be verified through the data verification module in the message verification device, and sends the verified message data to the data processing module in the message verification device in the form of its corresponding plaintext message data. The data processing module is mainly responsible for parsing the plaintext message data that has completed the verification in accordance with the device protocol rules, and sending the obtained parsed data to the host device so that the host device processes the parsed data.
[0056] The acquisition device may be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, IoT devices and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The message verification device may be implemented using an independent server or a server cluster consisting of multiple servers, or a cloud server.
[0057] In an exemplary embodiment, Figure 2 As shown, a message verification method is provided, which is executed by a computer device, and can be specifically executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 The message verification device in the example is described as follows, including the following steps 201 to 206. Among them:
[0058] Step 201, perform integrity check on the message data to be checked read from the cache to obtain an integrity check result.
[0059] Please also read Figure 3 , Figure 3 A schematic diagram of the structure of a message data provided for an embodiment of the present application; wherein the message structure is divided into fields, which are: a start symbol Start, a check code CRC, a header word length Len, a message header Head, a data segment Data and an end symbol End.
[0060] In the embodiment of the present application, the message data to be verified stored in the cache is usually encrypted message data. In addition, the message data may be missing or carry erroneous information during transmission, or may be forged or tampered with. Therefore, it is necessary to verify the message data to be verified stored in the cache.
[0061] Optionally, the plaintext message data may be encrypted by a collection device that sends the message data to be verified, and then the encrypted message data may be sent to the message verification device.
[0062] The method for encrypting the plaintext message data may specifically be:
[0063] 1. Select a target key Key (the target key can be a symmetric encryption key) from the key database (KeySotre) and obtain the unique key logo of the target key Key;
[0064] 2. Add the logo to the message header and obtain the header length Len before encoding;
[0065] 3. Add Len, Head and data segment Data to the checksum calculation to obtain the checksum CRC;
[0066] 4. Perform base64 encoding calculation on the message header to obtain the encoded newHead;
[0067] 5. Use the key Key to symmetric encrypt the data segment Data, preset the AES encryption algorithm, and calculate the data segment ciphertext newData;
[0068] 6. Arrange the message fields in a preset order to obtain a complete encrypted message.
[0069] As an optional implementation, step 201 performs integrity check on the message data to be checked read from the cache, and the way to obtain the integrity check result may be:
[0070] Identify the symbols contained in the message data to be checked read from the cache to obtain an identification result;
[0071] If the recognition result indicates that the symbol check in the message data to be checked passes, obtaining the header word length and the encrypted message header in the message data to be checked;
[0072] Verify the length of the encrypted message header based on the header word length to obtain a length verification result;
[0073] If the length check result indicates that the length check of the encrypted message header passes, the message data to be checked is determined as complete data as the integrity check result.
[0074] Among them, when implementing this implementation method, the symbols contained in the message data to be checked can be checked first. When the symbol check passes, the length of the encrypted message header can be checked. Only when both the symbol check and the length check pass, can it be considered that the integrity check of the message data to be checked passes, thereby improving the accuracy of the integrity check.
[0075] Optionally, the symbols contained in the message data to be checked read from the cache are identified, and a method of obtaining the identification result may specifically be:
[0076] Identify the start symbol and the end symbol contained in the message data to be checked read from the cache to obtain the start symbol information and the end symbol information; wherein the start symbol information at least includes the number of start symbols and the start symbol position, and the end symbol information at least includes the number of end symbols and the end symbol position;
[0077] If the number of starting symbols and the number of ending symbols are both 1, and the starting symbol position is at the starting position of the message data to be checked and the ending symbol position is at the ending position of the message data to be checked, then the symbol check in the message data to be checked is determined as the recognition result.
[0078] Among them, by implementing this implementation method, the starting symbol information and the ending symbol information in the message data to be checked can be identified, the number of starting symbols, the position of the starting symbols in the message data to be checked, the number of ending symbols and the position of the ending symbols in the message data to be checked can be obtained, and the starting symbol information and the ending symbol information can be verified. Only when it is identified that the number of starting symbols and the number of ending symbols are both 1, and the starting symbol position is at the starting position of the message data to be checked and the ending symbol position is at the ending position of the message data to be checked, can it be determined that the symbol verification in the message data to be checked has passed, thereby improving the accuracy of symbol verification.
[0079] In the embodiment of the present application, the start symbol (which can be preset as "#=") and the end symbol (which can be preset as "\r\n") are used to initially find a complete message. Except for the first start symbol, no other start symbol can appear in the message. If only the start symbol is found, the cache is retained and waits for the next reception. If only the end symbol is found, all current data is discarded.
[0080] Furthermore, the length of the encrypted message header is verified based on the header word length, and the length verification result can be obtained in the following manner:
[0081] The encrypted header word length of the encrypted message header is calculated according to the header word length;
[0082] Obtaining the actual header length of the encrypted message header;
[0083] If the actual header word length is greater than or equal to the encrypted header word length, the length check of the encrypted message header is passed and determined as the length check result.
[0084] Among them, by implementing this implementation method, the encrypted header word length of the encrypted message header can be calculated based on the obtained header word length, and the actual word length of the encrypted message header can be obtained, and then the encrypted header word length can be compared with the actual header word length. Only when the actual header word length is greater than or equal to the encrypted header word length, can the encrypted message header characters be considered complete, thereby improving the accuracy of the length verification result.
[0085] In the embodiment of the present application, the method of calculating the encrypted header word length newLen of the encrypted message header according to the header word length Len can be:
[0086] newLen=((Len+2) / 3)*4)
[0087] Step 202: If the integrity check result indicates that the message data to be checked is complete data, the encrypted message header in the message data to be checked is decoded to obtain a plaintext message header and a key identifier.
[0088] In the embodiment of the present application, the encrypted message header may be decoded by base64 to obtain a plaintext message header and a key identifier.
[0089] Step 203: Acquire a target key corresponding to the key identifier from a key database.
[0090] Step 204: decrypt the encrypted data segment in the message data to be verified using the target key to obtain the target data segment.
[0091] In an embodiment of the present application, the key Key can be used to perform AES decryption calculation on the encrypted data segment to obtain the target data segment.
[0092] Step 205: perform accuracy verification on the target data segment based on the header word length in the message data to be verified and the plaintext message header to obtain an accuracy verification result.
[0093] As an optional implementation, step 205 performs accuracy verification on the target data segment based on the header word length in the message data to be verified and the plaintext message header, and the accuracy verification result can be obtained in the following manner:
[0094] Obtaining the current verification code in the message data to be verified;
[0095] Calculate the actual check code based on the header word length in the message data to be checked, the plaintext message header and the target data segment;
[0096] If the actual check code is the same as the current check code, the target data segment is accurately determined as the accuracy check result.
[0097] Among them, by implementing this implementation method, the actual check code can be recalculated according to the header word length, the plaintext message header and the target data segment in the message data to be checked, and the actual check code is compared with the current check code in the message data to be checked. Only when the actual check code is the same as the current check code, can the target data segment be considered accurate, thereby improving the accuracy of the accuracy check result.
[0098] Step 206: If the accuracy check result indicates that the target data segment is accurate, it is determined that the to-be-checked message data has passed the check.
[0099] As an optional implementation, after step 206, the following steps may also be included:
[0100] Replacing the encrypted message header and the encrypted data segment of the message data to be verified that have passed the verification based on the plaintext message header and the target data segment to obtain the plaintext message data;
[0101] Sending the plaintext message data to a data processing module so that the data processing module parses the plaintext message data to obtain a parsing result, and sending the parsing result to a host device corresponding to the parsing result;
[0102] Deleting the message data to be checked in the cache, and detecting whether there is readable data in the cache to obtain a detection result;
[0103] If the detection result indicates that the readable data does not exist in the cache, determining that the message verification is completed;
[0104] If the detection result indicates that the readable data exists in the cache, the steps from performing integrity check on the to-be-checked message data read from the cache to obtaining the accuracy check result are executed.
[0105] Among them, by implementing this implementation method, the verified message data to be verified can be updated to plaintext message data, and the plaintext message data can be sent to the data processing module, so that the data processing module can parse the plaintext message data and send the parsing result to the host device, so that the host device can execute the parsing result, thereby ensuring the accuracy of the parsing result executed by the host device.
[0106] In addition, the message data to be checked can also be deleted from the cache, thereby avoiding repeated checking of the message data to be checked and reducing the failure rate of message checking.
[0107] By implementing the above-mentioned steps 201 to 206, only when both the integrity check and the accuracy check are passed, the message data to be checked is considered to have passed the check, thereby improving the accuracy of the message check. In addition, the present application can also improve the accuracy of the integrity check. In addition, the present application can also improve the accuracy of the symbol check. In addition, the present application can also improve the accuracy of the length check result. In addition, the present application can also improve the accuracy of the accuracy check result. In addition, the present application can also ensure the accuracy of the parsing result executed by the upper device. In addition, the present application can also reduce the failure rate of the message check.
[0108] The present application also provides an application scenario, which applies the above-mentioned message verification method. Specifically: The message verification method provided in this embodiment can be applied in an industrial application scenario. The collection device in the industrial application scenario collects information in the industrial application scenario, and sends the collected information to the message verification device in the form of message data, so that the message verification device performs integrity verification and accuracy verification on the received message data, and then can parse the verified message data, and send the obtained parsed data to the upper device.
[0109] Based on the same inventive concept, the embodiment of the present application also provides a message verification device for implementing the message verification method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more message verification device embodiments provided below can refer to the limitations on the message verification method above, and will not be repeated here.
[0110] In an exemplary embodiment, Figure 4 As shown, a message verification device is provided, comprising:
[0111] The integrity check unit 401 is used to perform integrity check on the message data to be checked read from the cache to obtain an integrity check result;
[0112] A decoding unit 402 is configured to decode the encrypted message header in the message data to be checked to obtain a plaintext message header and a key identifier if the integrity check result indicates that the message data to be checked is complete data;
[0113] An acquiring unit 403 is used to acquire a target key corresponding to the key identifier from a key database;
[0114] A decryption unit 404 is used to decrypt the encrypted data segment in the message data to be verified by using the target key to obtain a target data segment;
[0115] The accuracy checking unit 405 is used to perform an accuracy check on the target data segment based on the header word length in the message data to be checked and the plaintext message header to obtain an accuracy check result;
[0116] The determination unit 406 is configured to determine that the verification of the message data to be verified has passed if the accuracy verification result indicates that the target data segment is accurate.
[0117] As an optional implementation manner, the integrity check unit 401 performs integrity check on the message data to be checked read from the cache, and the manner in which the integrity check result is obtained may specifically be:
[0118] Identify the symbols contained in the message data to be checked read from the cache to obtain an identification result;
[0119] If the recognition result indicates that the symbol check in the message data to be checked passes, obtaining the header word length and the encrypted message header in the message data to be checked;
[0120] Verify the length of the encrypted message header based on the header word length to obtain a length verification result;
[0121] If the length check result indicates that the length check of the encrypted message header passes, the message data to be checked is determined as complete data as the integrity check result.
[0122] Among them, when implementing this implementation method, the symbols contained in the message data to be checked can be checked first. When the symbol check passes, the length of the encrypted message header can be checked. Only when both the symbol check and the length check pass, can it be considered that the integrity check of the message data to be checked passes, thereby improving the accuracy of the integrity check.
[0123] As an optional implementation manner, the integrity checking unit 401 identifies the symbols contained in the message data to be checked read from the cache, and the manner of obtaining the identification result may specifically be:
[0124] Identify the start symbol and the end symbol contained in the message data to be checked read from the cache to obtain the start symbol information and the end symbol information; wherein the start symbol information at least includes the number of start symbols and the start symbol position, and the end symbol information at least includes the number of end symbols and the end symbol position;
[0125] If the number of starting symbols and the number of ending symbols are both 1, and the starting symbol position is at the starting position of the message data to be checked and the ending symbol position is at the ending position of the message data to be checked, then the symbol check in the message data to be checked is determined as the recognition result.
[0126] Among them, by implementing this implementation method, the starting symbol information and the ending symbol information in the message data to be checked can be identified, the number of starting symbols, the position of the starting symbols in the message data to be checked, the number of ending symbols and the position of the ending symbols in the message data to be checked can be obtained, and the starting symbol information and the ending symbol information can be verified. Only when it is identified that the number of starting symbols and the number of ending symbols are both 1, and the starting symbol position is at the starting position of the message data to be checked and the ending symbol position is at the ending position of the message data to be checked, can it be determined that the symbol verification in the message data to be checked has passed, thereby improving the accuracy of symbol verification.
[0127] As an optional implementation manner, the integrity check unit 401 checks the length of the encrypted message header based on the header word length, and the length check result can be obtained in the following manner:
[0128] The encrypted header word length of the encrypted message header is calculated according to the header word length;
[0129] Obtaining the actual header length of the encrypted message header;
[0130] If the actual header word length is greater than or equal to the encrypted header word length, the length check of the encrypted message header is passed and determined as the length check result.
[0131] Among them, by implementing this implementation method, the encrypted header word length of the encrypted message header can be calculated based on the obtained header word length, and the actual word length of the encrypted message header can be obtained, and then the encrypted header word length can be compared with the actual header word length. Only when the actual header word length is greater than or equal to the encrypted header word length, can the encrypted message header characters be considered complete, thereby improving the accuracy of the length verification result.
[0132] As an optional implementation, the accuracy verification unit 405 performs an accuracy verification on the target data segment based on the header word length in the message data to be verified and the plaintext message header, and the accuracy verification result can be obtained in the following manner:
[0133] Obtaining the current verification code in the message data to be verified;
[0134] Calculate the actual check code based on the header word length in the message data to be checked, the plaintext message header and the target data segment;
[0135] If the actual check code is the same as the current check code, the target data segment is accurately determined as the accuracy check result.
[0136] Among them, by implementing this implementation method, the actual check code can be recalculated according to the header word length, the plaintext message header and the target data segment in the message data to be checked, and the actual check code is compared with the current check code in the message data to be checked. Only when the actual check code is the same as the current check code, can the target data segment be considered accurate, thereby improving the accuracy of the accuracy check result.
[0137] As an optional implementation manner, the determining unit 406 is further configured to:
[0138] Replacing the encrypted message header and the encrypted data segment of the message data to be verified that have passed the verification based on the plaintext message header and the target data segment to obtain the plaintext message data;
[0139] Sending the plaintext message data to a data processing module so that the data processing module parses the plaintext message data to obtain a parsing result, and sending the parsing result to a host device corresponding to the parsing result;
[0140] Deleting the message data to be checked in the cache, and detecting whether there is readable data in the cache to obtain a detection result;
[0141] If the detection result indicates that the readable data does not exist in the cache, determining that the message verification is completed;
[0142] If the detection result indicates that the readable data exists in the cache, the steps from performing integrity check on the to-be-checked message data read from the cache to obtaining the accuracy check result are executed.
[0143] Among them, by implementing this implementation method, the verified message data to be verified can be updated to plaintext message data, and the plaintext message data can be sent to the data processing module, so that the data processing module can parse the plaintext message data and send the parsing result to the host device, so that the host device can execute the parsing result, thereby ensuring the accuracy of the parsing result executed by the host device.
[0144] In addition, the message data to be checked can also be deleted from the cache, thereby avoiding repeated checking of the message data to be checked and reducing the failure rate of message checking.
[0145] By implementing the above implementation mode, only when both the integrity check and the accuracy check are passed, the message data to be checked is considered to have passed the check, thereby improving the accuracy of the message check. In addition, the present application can also improve the accuracy of the integrity check. In addition, the present application can also improve the accuracy of the symbol check. In addition, the present application can also improve the accuracy of the length check result. In addition, the present application can also improve the accuracy of the accuracy check result. In addition, the present application can also ensure the accuracy of the parsing result executed by the upper device. In addition, the present application can also reduce the failure rate of the message check.
[0146] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 5As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store video tag processing data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a message verification method is implemented.
[0147] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0148] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0149] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0150] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0151] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0152] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0153] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0154] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0155] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A message verification method, characterized in that: The message verification method comprises: Performing integrity check on the message data to be checked read from the cache to obtain an integrity check result; If the integrity check result indicates that the message data to be checked is complete data, the encrypted message header in the message data to be checked is decoded to obtain a plaintext message header and a key identifier; Acquire a target key corresponding to the key identifier from a key database; Decrypting the encrypted data segment in the message data to be verified by using the target key to obtain the target data segment; Performing accuracy verification on the target data segment based on the header word length in the message data to be verified and the plaintext message header to obtain an accuracy verification result; If the accuracy check result indicates that the target data segment is accurate, it is determined that the to-be-checked message data has passed the check.
2. The message verification method according to claim 1, characterized in that: The step of performing integrity check on the message data to be checked read from the cache to obtain an integrity check result specifically includes: Identify the symbols contained in the message data to be checked read from the cache to obtain an identification result; If the recognition result indicates that the symbol check in the message data to be checked passes, obtaining the header word length and the encrypted message header in the message data to be checked; Verify the length of the encrypted message header based on the header word length to obtain a length verification result; If the length check result indicates that the length check of the encrypted message header passes, the message data to be checked is determined as complete data as the integrity check result.
3. The message verification method according to claim 2, characterized in that: The identifying of symbols contained in the message data to be checked read from the cache to obtain an identification result specifically includes: Identify the start symbol and the end symbol contained in the message data to be checked read from the cache to obtain the start symbol information and the end symbol information; wherein the start symbol information at least includes the number of start symbols and the start symbol position, and the end symbol information at least includes the number of end symbols and the end symbol position; If the number of starting symbols and the number of ending symbols are both 1, and the starting symbol position is at the starting position of the message data to be checked and the ending symbol position is at the ending position of the message data to be checked, then the symbol check in the message data to be checked is determined as the recognition result.
4. The message verification method according to claim 2 or 3, characterized in that: The checking the length of the encrypted message header based on the header word length to obtain a length check result specifically includes: The encrypted header word length of the encrypted message header is calculated according to the header word length; Obtaining the actual header length of the encrypted message header; If the actual header word length is greater than or equal to the encrypted header word length, the length check of the encrypted message header is passed and determined as the length check result.
5. The message verification method according to claim 1, characterized in that: The performing accuracy verification on the target data segment based on the header word length in the message data to be verified and the plaintext message header to obtain an accuracy verification result specifically includes: Obtaining the current verification code in the message data to be verified; Calculate the actual check code based on the header word length in the message data to be checked, the plaintext message header and the target data segment; If the actual check code is the same as the current check code, the target data segment is accurately determined as the accuracy check result.
6. The message verification method according to claim 1, characterized in that: The message verification method also includes: Replacing the encrypted message header and the encrypted data segment of the message data to be verified that have passed the verification based on the plaintext message header and the target data segment to obtain the plaintext message data; Sending the plaintext message data to a data processing module so that the data processing module parses the plaintext message data to obtain a parsing result, and sending the parsing result to a host device corresponding to the parsing result; Deleting the message data to be checked in the cache, and detecting whether there is readable data in the cache to obtain a detection result; If the detection result indicates that the readable data does not exist in the cache, determining that the message verification is completed; If the detection result indicates that the readable data exists in the cache, the steps from performing integrity check on the to-be-checked message data read from the cache to obtaining the accuracy check result are executed.
7. A message verification device, characterized in that: The message checking device comprises: The integrity check unit is used to perform integrity check on the message data to be checked read from the cache to obtain an integrity check result; A decoding unit, configured to decode the encrypted message header in the message data to be checked to obtain a plaintext message header and a key identifier if the integrity check result indicates that the message data to be checked is complete data; An acquisition unit, used for acquiring a target key corresponding to the key identifier from a key database; A decryption unit, used to decrypt the encrypted data segment in the message data to be verified by using the target key to obtain a target data segment; An accuracy checking unit, configured to perform an accuracy check on the target data segment based on the header word length in the message data to be checked and the plaintext message header, to obtain an accuracy check result; A determination unit is used to determine that the verification of the message data to be verified has passed if the accuracy verification result indicates that the target data segment is accurate.
8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the message verification method described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the message verification method described in any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the message verification method described in any one of claims 1 to 6 are implemented.
