A method and apparatus for secure transmission of private information between tasks in an embedded system
By using a one-time pad encryption communication method and message authentication code verification, encryption keys are dynamically generated and destroyed, solving the security problem of key management in embedded devices, realizing secure transmission and reliable restoration of information within embedded devices, and meeting the high privacy requirements of power systems.
Patent Information
- Application Number
- CN202511165039.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-20
- Publication Date
- 2026-07-03
- Estimated Expiration
- 2045-08-20
AI Technical Summary
Existing key management methods for embedded devices are vulnerable to reverse engineering and memory analysis, and long-term use of a single key is easily cracked. Manually setting keys increases the risk of leakage and makes it difficult to meet the privacy requirements of secure information transmission within embedded devices.
The system employs a one-time key encryption method, dynamically generating encryption keys through random number exchange and parameter sharing between the initiator and receiver. These keys are destroyed immediately after each use, and the system combines this with message authentication code verification to ensure the authenticity and integrity of the transmission.
It effectively reduces the exposure time of keys in memory and the risk of being analyzed and cracked, prevents replay attacks and third-party attacks, and realizes the secure transmission and reliable restoration of key private information in embedded devices, meeting the high privacy requirements of power systems for information transmission.
Smart Images

Figure CN120915553B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and device for securely transmitting private information between tasks in an embedded system, belonging to the field of power system communication security technology. Background Technology
[0002] With the increasing demands for network security in power systems, higher requirements are being placed on the confidentiality of transmitted information. Embedded devices, as a crucial component of the power system, are key support facilities for the reliable operation of the power grid and a fundamental guarantee for power system network security. In embedded device systems, tasks often need to exchange critical information involving strict confidentiality protection, and the receiving end needs to recover the plaintext. For such critical information requiring both confidentiality protection and information recovery, symmetric encryption is currently the primary security measure. The core of symmetric encryption algorithms lies in the secure management of the key. Currently, commonly used key management methods include software code embedding and periodic key updates. Software code embedding achieves encryption and decryption by directly embedding the key into the programs of both parties; periodic key updates involve manual intervention to periodically change the key, reducing the risk of long-term use of a single key.
[0003] Existing key management methods still have significant shortcomings in ensuring secure information transmission within embedded devices, specifically:
[0004] The software code embedding method, by directly embedding the key in the program, poses a risk of reverse engineering and cracking the executable program. Furthermore, the key's resident nature in memory makes it vulnerable to memory image analysis. In addition, prolonged use of a single key for encryption and decryption gradually increases the risk of key cracking, and failure to update the key synchronously when the software changes can cause system compatibility issues. While periodically setting and updating the key can mitigate the risk of cracking a single key over a long period, it still cannot eliminate the risk of reverse engineering or memory analysis. More importantly, manually setting encryption keys directly increases the risk of key leakage, further threatening the confidentiality of information transmission.
[0005] The aforementioned deficiencies make it difficult for existing technologies to effectively meet the privacy requirements of secure information transmission within embedded devices, and a more reliable solution is urgently needed to address the core issues in key security management. Summary of the Invention
[0006] The purpose of this invention is to provide a method and device for securely transmitting private information between tasks in an embedded system. By using a one-time key encryption communication method, it solves the problem of secure information transmission within embedded devices, reduces the exposure time of keys in memory and the risk of being analyzed and cracked, and also has the ability to prevent replay attacks and third-party attacks.
[0007] To solve the above-mentioned technical problems, the present invention is implemented using the following technical solution:
[0008] This invention provides a method for securely transmitting private information between tasks in an embedded system, comprising:
[0009] Using the initiator via request message The first random number and request authentication code Transmitted to the receiver ;
[0010] Using the receiver Receive request message After the legitimacy is verified, a response message is sent. The second random number and Response Authentication Code Send to the initiator ;
[0011] Using the initiator Receive response message After legality verification, based on the first random number Second random number and shared parameters Calculate the encryption key using the agreed-upon algorithm According to the encryption key plaintext Encrypt and obtain ciphertext Based on the second random number He Mingwen Calculate message authentication code using agreed-upon algorithm By encrypting data packets The second random number and ciphertext and message authentication code Send to the recipient ;
[0012] Using the receiver Receive encrypted data packets And for the second random number Mark the response flag after performing a correctness check. Response messages via encrypted data The first random number Response flag and message authentication code Send to the initiator ;
[0013] Using the initiator Receive encrypted data response message And for the first random number Perform correctness checks and response flags All process data will be destroyed immediately after verification.
[0014] Among them, encryption key It is destroyed immediately after each use, and the initiator and the recipient All process data will be destroyed immediately upon the occurrence or termination of communication anomalies.
[0015] Furthermore, this also includes the period before the initiator and receiver begin formal communication:
[0016] Agree on secure storage and reusable shared parameters ;
[0017] The default algorithm is a hash algorithm. ,in, The input string for calculating the hash value;
[0018] Agreement in plain text The calculation method is as follows ,in, Indicates a decryption operation;
[0019] Agreed cipher The calculation method is as follows ,in, Indicates an encryption operation;
[0020] Agreed Request Authentication Code The calculation method is as follows , Statement of authentication key, , Indicates the authentication value algorithm;
[0021] Agreed Response Authentication Code The calculation method is as follows ;
[0022] Agreed message response authentication code The calculation method is as follows , Indicates a response flag;
[0023] Agree on encryption key The calculation method is expressed as ;
[0024] Agreed message authentication code The calculation method is as follows .
[0025] Furthermore, the legality verification includes:
[0026] Extraction request message / Response message / encrypted data message The corresponding fields;
[0027] Based on the request message / Response message / encrypted data message The corresponding fields are recalculated to obtain the message authentication code and the result is obtained.
[0028] Compare the calculation results with the request message / Response message / encrypted data message Compare the corresponding fields:
[0029] If they match, the validity verification is considered successful;
[0030] If there is no discrepancy, the validity verification is deemed to have failed.
[0031] Furthermore, regarding the second random number Mark the response flag after performing a correctness check. ,include:
[0032] If the second random number If an error occurs, the encrypted data message will be discarded and all process data will be destroyed immediately.
[0033] If the second random number If correct, then use the encryption key. Ciphertext fields in encrypted data packets Decrypt and obtain the corresponding plaintext fields. ;
[0034] Based on the second random number and plaintext fields Calculate message authentication check code using a pre-defined algorithm and the message authentication code Compare:
[0035] like Then the response flag will be displayed. Mark as successful, otherwise respond. Marked as failed.
[0036] Furthermore, for the first random number Perform correctness checks and response flags All process data will be destroyed immediately after verification, including:
[0037] If the first random number If an error occurs, the encrypted data response message will be discarded.
[0038] If the first random number If correct, then the encrypted data message... Perform a validity verification:
[0039] If encrypted data message If the validity verification is successful, the response flag will be determined. correct;
[0040] If encrypted data message If the validity verification fails, the encrypted data response message will be discarded and all process data will be destroyed immediately.
[0041] Furthermore, encryption key It is destroyed immediately after each use, including:
[0042] In obtaining the ciphertext Then, immediately destroy the encryption key. ;
[0043] In obtaining plaintext Then, immediately destroy the encryption key. .
[0044] Furthermore, the initiator and the recipient All process data is destroyed immediately upon the occurrence or termination of a communication anomaly, including that of the initiator. and the recipient A timer is used to detect communication anomalies in real time.
[0045] Furthermore, the initiator Destroy all process data, including:
[0046] Initiator After sending the request message, the first timer is started immediately. If no message is received from the receiver within the first preset time, the timer will be activated. If a correct response message is received, the message containing the first random number will be destroyed. All process data, including those from the communication process, are removed, and the communication flow is terminated.
[0047] Initiator The second timer is started immediately after the encrypted data packet is sent. If the recipient is not received within the second preset time If a correct encrypted data response message is received, the message containing the first random number will be destroyed. Second random number All process data, including those from the communication process, are removed, and the communication flow is terminated.
[0048] Initiator In response flag Once verified, all process data will be destroyed immediately.
[0049] Furthermore, the recipient Destroy all process data, including:
[0050] Recipient After sending the response message, a third timer is immediately started. If no response is received from the initiator within the third preset time, the timer will continue to run. If the correctly encrypted data message is received, then the message containing the first random number will be destroyed. Second random number All process data, including those from the communication process, are removed, and the communication flow is terminated.
[0051] Recipient Ciphertext fields in encrypted data packets Destroy the encryption key immediately after decryption. ;
[0052] Recipient Immediately after sending the response message, destroy the message containing the first random number. Second random number All process data, including those from the process.
[0053] In a second aspect, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements the steps of the method for securely transmitting private information between embedded system tasks as described in the first aspect.
[0054] Compared with the prior art, the beneficial effects achieved by the present invention are as follows:
[0055] 1. This invention dynamically generates an encryption key by using an agreed-upon algorithm based on an interactive first random number, a second random number, and shared parameters between the initiator and receiver. This key is destroyed immediately after each use, and all process data is destroyed immediately upon communication failure or termination. This effectively solves the problems of reverse engineering and memory analysis risks caused by key solidification in existing technologies, as well as the vulnerability of long-term single keys to cracking. Furthermore, by combining message authentication code verification, this invention ensures the authenticity and integrity of transmitted messages, avoiding the risk of leakage from manually set keys. This achieves secure transmission and reliable restoration of critical private information within embedded devices, meeting the high privacy requirements of power systems for embedded device information transmission.
[0056] 2. This invention dynamically generates an encryption key using a pre-defined hash algorithm based on an interactive first random number, a second random number, and preset shared parameters between the initiator and receiver. The key is destroyed immediately after each use when the ciphertext or plaintext is obtained. Furthermore, a timer triggers the immediate destruction of all process data in case of communication failure or termination. This fundamentally solves the risks of reverse engineering and memory image analysis that arise from key fixation in existing technologies. It avoids the problem of a single key being easily cracked over a long period, eliminates the risk of leakage due to manual key updates, and achieves secure management of the key throughout its entire lifecycle.
[0057] 3. This invention utilizes the receiver's ability to extract message fields, recalculate the authentication code, and compare it with the carried authentication code to verify the legitimacy of the transmitted message. Simultaneously, in encrypted data message processing, the receiver recalculates the authentication verification code based on the decrypted plaintext and a second random number, comparing it with the message authentication code to further verify that the data has not been tampered with. This multi-level authentication mechanism effectively prevents security threats such as man-in-the-middle attacks and data tampering, ensuring the integrity and authenticity of transmitted data and meeting the requirements for reliable transmission of critical private information between embedded system tasks.
[0058] 4. This invention uses timers set by both the initiator and the receiver to detect communication timeouts in real time. If a correct response message is not received from the other party within a preset time, all process data is immediately destroyed and the communication process is terminated. This effectively addresses abnormal scenarios such as communication interruption and malicious blocking, avoids the risk of leakage caused by process data remaining in abnormal states for a long time, and cuts off the possibility of attackers deducing keys or plaintext by intercepting historical communication data from the attack path, further improving the security of information transmission in embedded devices. Attached Figure Description
[0059] Figure 1 It is the initiator provided in the embodiments of the present invention. and the recipient A diagram illustrating the process of securely transmitting private information. Detailed Implementation
[0060] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations thereof. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.
[0061] The term "and / or" simply describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0062] Example 1
[0063] This embodiment describes a method for securely transmitting private information between tasks in an embedded system, including:
[0064] Step 1: Utilize the initiator via request message The first random number and request authentication code Transmitted to the receiver .
[0065] This invention involves the initiator transmitting a first random number and a request authentication code to the receiver in the request message. The unpredictability of the random number effectively resists replay attacks, while the request authentication code verifies the legitimacy of the initiator's identity, ensuring security in the initial stage of communication and preventing unauthorized devices from impersonating the initiator to launch malicious requests.
[0066] Step Two: Utilize the receiver Receive request message After the legitimacy is verified, a response message is sent. The second random number and Response Authentication Code Send to the initiator .
[0067] This invention achieves two-way authentication by having the receiver verify the legitimacy of the request message and then return a second random number and an authentication code. The initiator verifies the identity of the receiver, and the receiver verifies the identity of the initiator. The second random number provides dynamic parameters for subsequent key negotiation, and the authentication code further ensures the authenticity of the response message and prevents man-in-the-middle tampering or forgery of the response content.
[0068] Step 3: Utilize the initiator Receive response message After legality verification, based on the first random number Second random number and shared parameters Calculate the encryption key using the agreed-upon algorithm And according to the encryption key plaintext Encrypt and obtain ciphertext Based on the second random number He Mingwen Calculate message authentication code using agreed-upon algorithm By encrypting data packets The second random number and ciphertext and message authentication code Send to the recipient .
[0069] This invention enables the initiator to dynamically calculate an encryption key based on a first random number, a second random number, and shared parameters. The encryption key is unique for each session. The encryption key is used to encrypt plaintext to generate ciphertext. At the same time, the second random number and plaintext are combined to calculate the message authentication code. This ensures the confidentiality of data transmission through encryption and ensures data integrity by verifying that the data has not been tampered with through the authentication code. Furthermore, the dynamic generation of the encryption key avoids the risk of leakage caused by the long-term use of static keys.
[0070] Step 4: Utilize the receiver Receive encrypted data packets And for the second random number Mark the response flag after performing a correctness check. Response messages via encrypted data The first random number Response flag and message authentication code Send to the initiator .
[0071] This invention ensures that encrypted data messages are not reused or tampered with by having the receiver check the correctness of the second random number and mark an acknowledgment flag. The acknowledgment flag provides the initiator with a data reception confirmation mechanism to avoid data residue or duplicate processing due to communication anomalies. At the same time, the acknowledgment message returns the first random number and message authentication code, providing a basis for the initiator's subsequent verification.
[0072] Step 5: Utilize the initiator Receive encrypted data response message And for the first random number Perform correctness checks and response flags All process data will be destroyed immediately after verification.
[0073] This invention destroys all process data, including random numbers, keys, and plaintext, immediately after the initiator verifies the first random number and the response flag. Combined with the technical features of "destroying the encryption key after each use" and "destroying all process data after communication abnormality or termination", this invention completely eliminates the risk of temporary data residue and prevents sensitive information such as keys and random numbers from being maliciously extracted or reverse analyzed, thereby strengthening system security from the perspective of data lifecycle management.
[0074] Among them, encryption key It is destroyed immediately after each use, and the initiator and the recipient All process data will be destroyed immediately upon the occurrence or termination of communication anomalies.
[0075] Example 2
[0076] Based on the same inventive concept as Embodiment 1, this embodiment introduces a method for securely transmitting private information between tasks in an embedded system, by introducing a first random number between the communicating parties. Second random number This system implements a one-time pad encryption communication method, and combined with a message authentication code mechanism, it enables identity verification between the communicating parties. This significantly increases the difficulty of cracking the encrypted data throughout the communication process, and also effectively enhances the ability to resist replay attacks and third-party attacks through parameter sharing. By combining random numbers with a key-derived method and employing a strategy of immediate destruction after use, this approach differs from conventional symmetric encryption algorithms and possesses forward security capabilities. This enhances the reliability of secure information transmission between embedded devices in power systems.
[0077] The implementation steps of the method for securely transmitting private information between tasks in an embedded system, as described in this embodiment, are as follows: Figure 1 As shown, it includes:
[0078] Step 1: Utilize the initiator via request message The first random number and request authentication code Transmitted to the receiver .
[0079] In this embodiment, before the initiator and receiver begin formal communication:
[0080] Step 1.1: Agree on securely stored and reusable shared parameters .
[0081] In this embodiment, shared parameters The length is 256 bits.
[0082] Step 1.2: The default algorithm is a hash algorithm. ,in, This represents the input string for calculating the hash value.
[0083] In this embodiment, the default algorithm is the SHA256 hash algorithm, also known as the HMAC algorithm.
[0084] Step 1.3: Agree on the plaintext The calculation method is as follows ,in, This indicates a decryption operation.
[0085] In this embodiment, plaintext is agreed upon. The calculation method is as follows ,in, This indicates the decryption operation corresponding to the AES-256 algorithm.
[0086] Step 1.4: Agree on the ciphertext The calculation method is as follows ,in, This indicates an encryption operation.
[0087] In this implementation, encrypted text is agreed upon. The calculation method is as follows ,in, This indicates the encryption operation corresponding to the AES-256 algorithm.
[0088] Step 1.5: Agree on the request authentication code The calculation method is as follows , Statement of authentication key, , This represents the authentication value algorithm.
[0089] In this implementation, an authentication code is requested. The calculation method is as follows , ,in, This indicates an authentication value algorithm based on a hash algorithm. This indicates an authentication value algorithm based on the SHA256 hash algorithm.
[0090] Step 1.6: Agree on the response authentication code The calculation method is as follows .
[0091] In this implementation, a response authentication code is agreed upon. The calculation method is as follows .
[0092] Step 1.7: Agree on the message response authentication code The calculation method is as follows , Indicates a response flag.
[0093] In this implementation, a message response authentication code is agreed upon. The calculation method is as follows .
[0094] Step 1.8: Agree on the encryption key The calculation method is expressed as .
[0095] In this embodiment, an encryption key is agreed upon. The calculation method is expressed as ;in, The key for the HMAC algorithm, the first random number Second random number The length is 256 bits, and the input string for the HMAC algorithm is the first random number. Second random number string concatenation .
[0096] Step 1.9: Agree on message authentication code The calculation method is as follows .
[0097] In this implementation, a message authentication code is agreed upon. The calculation method is as follows .
[0098] In this implementation, the initiator Generate the first random number via request message The first random number and request authentication code Transmit to Among them, the request authentication code Initiator send The first timer is started immediately after the message is sent. If the recipient is not received within the first preset time If a correct response message is received, the message containing the first random number will be destroyed. This includes all process data and terminates the communication process.
[0099] Step 2: Utilize the receiver Receive request message After the legitimacy is verified, a response message is sent. The second random number and Response Authentication Code Send to the initiator .
[0100] In this embodiment, the receiver Received After the validity is verified, a second random number is generated. via response message The second random number and Response Authentication Code Send to the initiator Among them, request authentication code .
[0101] Recipient send The third timer is started immediately after the message is sent. If no response is received from the initiator within the third preset time period If the correctly encrypted data message is received, then the message containing the first random number will be destroyed. Second random number This includes all process data and terminates the communication process.
[0102] In this embodiment, the legality verification includes:
[0103] Extraction request message / Response message / encrypted data message The corresponding fields;
[0104] Based on the request message / Response message / encrypted data message The corresponding fields are recalculated to obtain the message authentication code and the result is obtained.
[0105] Compare the calculation results with the request message / Response message / encrypted data message Compare the corresponding fields:
[0106] If they match, the validity verification is considered successful;
[0107] If there is no discrepancy, the validity verification is deemed to have failed.
[0108] Step 3: Utilize the initiator Receive response message After legality verification, based on the first random number Second random number and shared parameters Calculate the encryption key using the agreed-upon algorithm And according to the encryption key plaintext Encrypt and obtain ciphertext Based on the second random number He Mingwen Calculate message authentication code using agreed-upon algorithm By encrypting data packets The second random number and ciphertext and message authentication code Send to the recipient .
[0109] In this implementation, the initiator Received After the validity is verified, a second random number is obtained. Based on the first random number Second random number and shared parameters Calculate the encryption key using the agreed-upon algorithm Secondly, and based on the encryption key Obtain the ciphertext He Mingwen ,Right now Then use a second random number He Mingwen The concatenated string is used for input calculation. Finally, encrypted data packets are used. The second random number ciphertext and message authentication code Send to the recipient .
[0110] In this implementation, the initiator Complete the plaintext The encryption key is destroyed immediately after the encryption calculation. .
[0111] In this implementation, the initiator Send encrypted data packets Then, immediately start the second timer. If the recipient is not received within the second preset time If a correct encrypted data response message is received, the message containing the first random number will be destroyed. Second random number This includes all process data and terminates the communication process.
[0112] Step 4: Utilize the receiver Receive encrypted data packets And for the second random number Mark the response flag after performing a correctness check. Response messages via encrypted data The first random number Response flag and message authentication code Send to the initiator .
[0113] In this embodiment, the receiver Received encrypted data packet Then, first, the second random number... The correctness of the second random number is checked. If incorrect, the encrypted data packet will be discarded. If the second random number Correct, firstly through Calculate the encryption key Secondly, the ciphertext field in the encrypted data message... Decrypt to obtain the corresponding plaintext field Then, using a second random number... With plaintext fields The concatenated string is the input calculated authentication verification code, and is combined with the message authentication code. Compare:
[0114] like Then the response flag will be displayed. Mark as successful, otherwise respond. Marked as a failure; finally, via a response message. The first random number Response flag and message authentication code Send to the initiator Message authentication code .
[0115] Recipient Ciphertext fields in encrypted data packets Destroy the encryption key immediately after decryption. ;
[0116] Recipient Immediately after sending the response message, destroy the message containing the first random number. Second random number All process data, including those from the process.
[0117] In this implementation, the second random number Mark the response flag after performing a correctness check. ,include:
[0118] If the second random number If an error occurs, the encrypted data message will be discarded and all process data will be destroyed immediately.
[0119] If the second random number If correct, then use the encryption key. Ciphertext fields in encrypted data packets Decrypt and obtain the corresponding plaintext fields. ;
[0120] Based on the second random number and plaintext fields Calculate message authentication check code using a pre-defined algorithm and the message authentication code Compare:
[0121] like Then the response flag will be displayed. Mark as successful, otherwise respond. Marked as failed.
[0122] Step 5: Utilize the initiator Receive encrypted data response message And for the first random number Perform correctness checks and response flags All process data will be destroyed immediately after verification.
[0123] Initiator Received encrypted data response message Then, first, the first random number... The correctness is checked; if the correct first random number is not included. The encrypted data response message is discarded directly. Then respond with encrypted data messages. A validity verification is performed. If the validity verification is successful, the response flag is determined. The result is correct; otherwise, the encrypted data response message is discarded. .
[0124] Initiator In response flag Once verified, all process data will be destroyed immediately.
[0125] In this implementation, the first random number Perform correctness checks and response flags All process data will be destroyed immediately after verification, including:
[0126] If the first random number If an error occurs, the encrypted data response message will be discarded.
[0127] If the first random number If correct, then the encrypted data message... Perform a validity verification:
[0128] If encrypted data message If the validity verification is successful, the response flag will be determined. correct;
[0129] If encrypted data message If the validity verification fails, the encrypted data response message will be discarded and all process data will be destroyed immediately.
[0130] Among them, encryption key It is destroyed immediately after each use, and the initiator and the recipient All process data will be destroyed immediately upon the occurrence or termination of communication anomalies.
[0131] In this embodiment, the encryption key It is destroyed immediately after each use, including:
[0132] In obtaining the ciphertext Then, immediately destroy the encryption key. ;
[0133] In obtaining plaintext Then, immediately destroy the encryption key. .
[0134] In this embodiment, the initiator and the recipient All process data is destroyed immediately upon the occurrence or termination of a communication anomaly, including that of the initiator. and the recipient A timer is used to detect communication anomalies in real time.
[0135] This embodiment introduces a first random number. Second random number This enables one-time pad encryption for data transmission, which not only increases the difficulty of cracking encrypted data but also effectively enhances the ability to resist replay attacks. Furthermore, the introduction of an authentication code verification mechanism effectively improves the ability to defend against third-party attacks. In actual computation, shared parameters... It does not directly participate in ciphertext calculation, but participates in ciphertext and authentication code calculation in a derived manner, thus reducing... The possibility of direct cracking is reduced; and the strategy of destroying the encryption key immediately after encryption and decryption greatly reduces the possibility of it being directly obtained by malicious attackers. This embodiment also reduces the possibility of it being obtained even if it is not directly cracked. In such cases, attackers cannot directly recover historical ciphertext information, giving conventional symmetric encryption algorithms forward security capabilities. This embodiment significantly improves the reliability of secure information transmission between embedded tasks without significantly increasing embedded computing resources, and can be applied to secure information transmission between embedded devices.
[0136] Example 3
[0137] Based on the same inventive concept as other embodiments, this embodiment describes a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method for securely transmitting private information between embedded system tasks as described in Embodiment 1 or Embodiment 2.
[0138] In summary, this invention dynamically generates an encryption key using an agreed-upon algorithm based on an interactive first random number, a second random number, and shared parameters between the initiator and receiver. This key is destroyed immediately after each use, and all process data is destroyed immediately upon communication failure or termination. This effectively solves the problems of reverse engineering and memory analysis risks caused by key solidification in existing technologies, as well as the vulnerability of long-term single keys to cracking. Furthermore, by combining message authentication code verification, this invention ensures the authenticity and integrity of transmitted messages, avoiding the risk of leakage from manually set keys. This achieves secure transmission and reliable restoration of critical private information within embedded devices, meeting the high privacy requirements of power systems for embedded device information transmission.
[0139] This invention dynamically generates an encryption key using a pre-defined hash algorithm based on an interactive first random number, a second random number, and preset shared parameters between the initiator and receiver. The key is destroyed immediately after each use when the ciphertext or plaintext is obtained. Furthermore, a timer triggers the immediate destruction of all process data in case of communication failure or termination. This fundamentally solves the risks of reverse engineering and memory image analysis that arise from key fixation in existing technologies. It avoids the problem of a single key being easily cracked over a long period, eliminates the risk of leakage due to manual key updates, and achieves secure management of the key throughout its entire lifecycle.
[0140] This invention utilizes the receiver's ability to extract message fields, recalculate the authentication code, and compare it with the carried authentication code to verify the legitimacy of the transmitted message. Simultaneously, in the processing of encrypted data messages, the receiver recalculates the authentication verification code based on the decrypted plaintext and a second random number, and compares it with the message authentication code to further verify that the data has not been tampered with. This multi-level authentication mechanism effectively prevents security threats such as man-in-the-middle attacks and data tampering, ensuring the integrity and authenticity of transmitted data and meeting the requirements for reliable transmission of critical private information between embedded system tasks.
[0141] This invention uses timers set by both the initiator and the receiver to detect communication timeouts in real time. If a correct response message is not received from the other party within a preset time, all process data is immediately destroyed and the communication process is terminated. This effectively addresses abnormal scenarios such as communication interruption and malicious blocking, avoids the risk of leakage caused by process data remaining in abnormal states for a long time, and cuts off the possibility of attackers deducing keys or plaintext by intercepting historical communication data from the attack path, further improving the security of information transmission in embedded devices.
[0142] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0143] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0144] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0145] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0146] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.
Claims
1. A method for securely transmitting confidential information between tasks in an embedded system, characterized in that, include: With initiator Through request message Transmit first random number And request authentication code To receiver ; With the receiver Receiving the request message After the legality verification, sending the response message The second random number And the response authentication code To the initiator ; Using the initiator Receive response message After legality verification, based on the first random number Second random number and shared parameters Calculate the encryption key using the agreed-upon algorithm And according to the encryption key plaintext Encrypt and obtain ciphertext Based on the second random number He Mingwen Calculate message authentication code using agreed-upon algorithm By encrypting data packets The second random number and ciphertext and message authentication code Send to the recipient ; Using the receiver Receive encrypted data packets And for the second random number Mark the response flag after performing a correctness check. Response messages via encrypted data The first random number Response flag and message authentication code Send to the initiator ; Using the initiator Receive encrypted data response message And for the first random number Perform correctness checks and response flags All process data will be destroyed immediately after verification. wherein the encryption key is destroyed immediately after each use and the initiator and the receiver all process data is destroyed immediately when the communication is abnormal or after the end.
2. The method for secure transmission of private information among embedded system tasks of claim 1, wherein, This also includes the period before the initiator and receiver begin formal communication: Agreement on secure storage and reusable shared parameters ; The preset agreement algorithm is a hash algorithm wherein, represents an input string for calculating a hash value; Agreement in plain text The calculation method is wherein, denotes a decryption operation; Agreement ciphertext The calculation method is wherein, denotes an encryption operation; Agreement request authentication code The calculation method is , The expression authentication code key, , The authentication value algorithm; Agreement response authentication code The calculation method is ; Agreement message response authentication code The calculation method is , represents a response flag; Agreement encryption key The computational method is represented as ; Agreement message authentication code The calculation method is .
3. The method for secure transmission of private information among embedded system tasks of claim 1, wherein, The legitimacy verification includes: Extraction request message / Response message / encrypted data message The corresponding fields; Request message Response message Encrypted data message The corresponding field recalculates the message authentication code to obtain a calculation result. The calculation result is compared with the request message / response message / encrypted data message The corresponding fields are compared: If they match, the validity verification is considered successful; If there is no discrepancy, the validity verification is deemed to have failed.
4. The method for secure transmission of private information among embedded system tasks of claim 1, wherein, a second random number marking the response flag after a correctness check comprising: If the second random number If the error, discard the encrypted data packet immediately destroy all process data; If the second random number is correct, the encrypted key is decrypted and the corresponding plaintext field is obtained ; Based on the second random number and the plaintext field The message authentication code is calculated using the agreed algorithm and compared with the message authentication code If then the reply flag is marked as success, otherwise the reply flag is marked as failure.
5. The method for secure transmission of private information among embedded system tasks of claim 1, wherein, On the first random number Performing a correctness check and a reply flag Destroying all process data immediately after verification, including: If the first random number If an error occurs, the encrypted data response message will be discarded. If the first random number is correct, the encrypted data message is verified for legality: If the encrypted data packet By legality verification, it is determined that the response flag Correct; If the encrypted data packet If the encrypted data packet is not verified for legality, discard the encrypted data response packet and immediately destroy all process data.
6. The method for secure transmission of private information among embedded system tasks of claim 1, wherein, Encryption key destroyed immediately after each use, including: In obtaining the ciphertext Then, immediately destroy the encryption key. ; Upon obtaining the plaintext The encryption key is destroyed immediately after .
7. The method for securely transmitting private information between tasks in an embedded system according to claim 6, characterized in that, The initiator and the receiver Destroy all process data immediately after the communication has failed or ended, wherein the initiator and the receiver Detect the communication failure in real time by means of a timer.
8. The method for securely transmitting private information between tasks in an embedded system according to claim 7, characterized in that, Originator Destroy all process data, including: initiator After sending the request message, the first timer is started immediately. If the correct response message of the receiver is not received within the first preset time, all process data containing the first random number are destroyed, and the communication process is terminated. Initiator The second timer is started immediately after the encrypted data packet is sent. If the recipient is not received within the second preset time If a correct encrypted data response message is received, the message containing the first random number will be destroyed. Second random number All process data, including those from the communication process, are removed, and the communication flow is terminated. Initiator In-Progress Ack Flag Upon verification, all process data is immediately destroyed.
9. The method for securely transmitting private information between tasks in an embedded system according to claim 7, characterized in that, Recipient Destroy all process data, including: Recipient After sending the response message, a third timer is immediately started. If no response is received from the initiator within the third preset time, the timer will continue to run. If the correctly encrypted data message is received, then the message containing the first random number will be destroyed. Second random number All process data, including those from the communication process, are removed, and the communication flow is terminated. Receiving party Cipher field in encrypted data message Destroy encryption key immediately after decryption ; Receiving party Immediately after sending the reply message, all process data contained in the first random number , the second random number are destroyed.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method for securely transmitting private information between embedded system tasks as described in any one of claims 1 to 9.
Citation Information
Patent Citations
HTTP-Digest improved AKA identity authentication system and method based on symmetric key pool
CN108599926A
Lightweight terminal security access authentication method based on edge computing
CN116015807A
