Message processing method, device, equipment, storage medium and program product

By generating a set of verification keys and encryption keys, the message authentication code and encryption results are determined, the authentication message is generated and decrypted, the problem of insufficient protection strength of existing message authentication code technology is solved, and high-intensity security protection for target messages is achieved, and quantum computing attacks are resisted.

CN119544384BActive Publication Date: 2025-08-19成方金融科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510088920.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-08-19
Estimated Expiration
2045-01-21

AI Technical Summary

Technical Problem

The existing message authentication code technology is relatively limited in terms of protection form, and the protection intensity is insufficient, making it difficult to deal with the growing security threat, especially to resist quantum computing attacks.

Method used

By obtaining the pre-generated verification key and encryption key set, the message authentication code and the first encryption result of the target message are determined, and the second encryption result is generated based on the target message, and the authentication message is generated in combination with the message authentication code, the first encryption result and the second encryption result is sent to the receiving terminal for decryption processing to obtain the target message.

Benefits of technology

It improves the security protection intensity of target messages, increases the difficulty of enemy cracking, enhances privacy protection capabilities, and resists quantum computing attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544384B_ABST
    Figure CN119544384B_ABST
Patent Text Reader

Abstract

The present invention discloses a message processing method, apparatus, device, storage medium, and program product, relating to the field of data encryption and decryption technology. The method comprises obtaining a target message and a pre-generated verification key and encryption key set; determining a message authentication code for the target message based on the verification key, and determining a first encryption result for the target message based on an encryption key in the encryption key set; determining a second encryption result for a set digital sequence based on the encryption key, the digital sequence being generated based on the target message; generating an authentication message for the target message based on the message authentication code, the first encryption result, and the second encryption result, and sending the authentication message to a receiving terminal, so that the receiving terminal performs message authentication and obtains the target message through decryption processing. This method increases the uncertainty of the position of the first encryption result, thereby improving the security protection strength of the target message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data encryption and decryption, and in particular to a message processing method, apparatus, device, storage medium and program product. Background Art

[0002] With the rapid development of information technology, message authentication code (MAC) technology has become a key technology for ensuring data integrity and authenticating message origins. A MAC algorithm uses a key and a message as input to produce a fixed-length output, the MAC value, to verify the integrity and authenticity of the message.

[0003] Typical message authentication code technologies focus primarily on message integrity and authentication, but do not provide adequate protection for the message content itself. These technologies typically send messages in plaintext, making them suitable only for public information transmission and unsuitable for private data transmission.

[0004] Although some modified MAC technologies can encrypt message content, the protection they provide for messages is relatively limited and the protection strength is insufficient, making it difficult to cope with growing security threats, especially resisting attacks from quantum computing. Summary of the Invention

[0005] The present invention provides a message processing method, apparatus, device, storage medium and program product to solve the problem that the existing message authentication code technology has limited protection forms and insufficient protection strength.

[0006] In a first aspect, an embodiment of the present invention provides a message processing method, the method comprising:

[0007] Obtaining a target message and obtaining a pre-generated verification key and encryption key set, where the verification key and encryption key set are pre-generated by the sending terminal through key negotiation with the receiving terminal based on a root key;

[0008] determining a message authentication code of the target message based on the verification key, and determining a first encryption result of the target message based on an encryption key in the encryption key set;

[0009] determining, based on the encryption key, a second encryption result of a set digital sequence, the digital sequence being generated based on the target message;

[0010] An authentication message of the target message is generated according to the message authentication code, the first encryption result and the second encryption result, and the authentication message is sent to a receiving terminal, so that the receiving terminal performs message authentication and obtains the target message through decryption processing.

[0011] In a second aspect, an embodiment of the present invention provides a message processing method, the method comprising:

[0012] After receiving an authentication message corresponding to a target message transmitted by a sending terminal, obtaining a message authentication code and a ciphertext set included in the authentication message, the ciphertext set being generated by the sending terminal using the determined first encryption result and the determined second encryption result;

[0013] Performing a first decryption process on the ciphertext set using a homomorphic decryption strategy and a root key pre-received from a sending terminal to obtain a first decryption result;

[0014] Perform a second decryption process on the first decryption result to obtain a second decryption result, and when the second decryption result is consistent with the message authentication code, restore the target message according to the first decryption result.

[0015] In a third aspect, an embodiment of the present invention provides a message processing device, applied to a sending terminal, the device including:

[0016] A key acquisition module, configured to acquire a target message and obtain a pre-generated verification key and encryption key set, wherein the verification key and encryption key set are pre-generated by the sending terminal through key negotiation with the receiving terminal based on a root key;

[0017] a first encryption result determination module, configured to determine a message authentication code of the target message based on the verification key, and determine a first encryption result of the target message based on an encryption key in the encryption key set;

[0018] a second encryption result determination module, configured to determine a second encryption result of a set digital sequence according to the encryption key, the digital sequence being generated based on the target message;

[0019] The authentication message sending module is used to generate an authentication message of the target message according to the message authentication code, the first encryption result and the second encryption result, and send the authentication message to the receiving terminal so that the receiving terminal performs message authentication and obtains the target message through decryption processing.

[0020] In a fourth aspect, an embodiment of the present invention provides a message processing device, applied to a receiving terminal, the device including:

[0021] an authentication message receiving module, configured to, upon receiving an authentication message corresponding to a target message transmitted by a sending terminal, obtain a message authentication code and a ciphertext set included in the authentication message, the ciphertext set being generated by the sending terminal using the determined first encryption result and second encryption result;

[0022] A first decryption result determination module is configured to perform a first decryption process on the ciphertext set using a homomorphic decryption strategy and a root key received in advance from a sending terminal to obtain a first decryption result;

[0023] The target message restoration module is used to perform a second decryption process on the first decryption result to obtain a second decryption result, and when the second decryption result is consistent with the message authentication code, restore the target message according to the first decryption result.

[0024] In a fifth aspect, an embodiment of the present invention provides an electronic device, comprising:

[0025] at least one processor;

[0026] and a memory communicatively coupled to the at least one processor;

[0027] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the message processing method described in any embodiment of the present invention.

[0028] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the message processing method described in any embodiment of the present invention when executed.

[0029] In a seventh aspect, an embodiment of the present invention further provides a computer program product, characterized in that the computer program product comprises a computer program, and when the computer program is executed by a processor, it implements the message processing method according to any embodiment of the present invention.

[0030] The technical solution of an embodiment of the present invention obtains a target message and a pre-generated verification key and encryption key set, which are pre-generated by the sending terminal through key negotiation with the receiving terminal based on a root key. Based on the verification key, a message authentication code (MAC) of the target message is determined, and based on an encryption key from the encryption key set, a first encryption result of the target message is determined. Based on the encryption key, a second encryption result of a set digital sequence is determined, the digital sequence is generated based on the target message. Based on the message authentication code, the first encryption result, and the second encryption result, an authentication message for the target message is generated, and the authentication message is sent to the receiving terminal, allowing the receiving terminal to authenticate the message and obtain the target message through decryption. This method encrypts the message content by flexibly selecting an encryption key from the encryption key set to determine the first encryption result of the target message, thereby improving the security protection of the target message. By obtaining the second encryption result of the set digital sequence and combining it with the first encryption result to generate the authentication message for the target message, the uncertainty of the position of the first encryption result is increased, thereby increasing the difficulty of cracking by an adversary and further improving the privacy protection of the target message.

[0031] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 A flowchart of a message processing method applied to a sending terminal provided by an embodiment of the present invention;

[0034] Figure 2 A flowchart of a message processing method applied to a receiving terminal provided by an embodiment of the present invention;

[0035] Figure 3 A schematic structural diagram of a message processing device applied to a sending terminal provided by an embodiment of the present invention;

[0036] Figure 4 A schematic structural diagram of a message processing device applied to a receiving terminal provided by an embodiment of the present invention;

[0037] Figure 5A schematic structural diagram of an electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0038] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0039] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0040] It's important to note that typical message authentication code (MAC) technology focuses primarily on message integrity and authentication, but doesn't provide adequate protection for the message content itself, making it unsuitable for transmitting private data. While modified MAC technology can encrypt message content, the protection it provides is limited and insufficient, making it difficult to address growing security threats, particularly those stemming from quantum computing.

[0041] Based on this, an embodiment of the present invention provides a message processing method. Figure 1 A flowchart of a message processing method applied to a sending terminal is provided in an embodiment of the present invention. The embodiment of the present invention can be applied to scenarios where messages to be sent are encrypted to deal with security threats. The method can be executed by a message processing device, which is applied to the sending terminal and can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, which is preferably a mobile terminal, a desktop computer, a laptop computer, a server, etc.

[0042] like Figure 1 As shown, the message processing method provided by the embodiment of the present invention may specifically include:

[0043] S101. Obtain a target message and obtain a pre-generated verification key and encryption key set. The verification key and encryption key set are pre-generated by a sending terminal through key negotiation with a receiving terminal based on a root key.

[0044] Among them, the target message can be understood as a message that needs to be sent and received and has encryption requirements. Exemplarily, the target message can be a finite-length number, text or picture, which is not limited in the embodiments of the present invention. The verification key can be understood as a key used to verify the identities of both communicating parties, ensuring that both communicating parties are the expected participants and preventing security threats such as man-in-the-middle attacks. The verification key can be determined through negotiation between the communicating parties and replaced regularly. The encryption key set can be understood as a set of encryption keys used to encrypt the target message. The root key can be understood as the initially generated shared key, which is usually used to generate other keys, including verification keys and encryption keys.

[0045] In this embodiment, the sending terminal obtains the target message. The method of obtaining the target message can be reading a locally stored file or detecting an editing operation on the editing area in the current interface. The target message is then determined based on the editing operation. The editing operation can be the user entering the target message content or the target message content selected in a drop-down box. The embodiment of the present invention does not limit this. In addition, a pre-generated verification key and encryption key set are obtained. The generation process of the verification key and encryption key set can be that the sending terminal pre-generates a root key according to the encryption key generation algorithm, shares the root key with the receiving terminal through a secure communication method, and negotiates the generation rules of the verification key. The sending terminal generates the verification key using the root key and the negotiated verification key generation rules, and simultaneously generates the encryption key set in combination with the key generation algorithm.

[0046] S102: Determine a message authentication code of the target message according to the verification key, and determine a first encryption result of the target message according to the encryption key in the encryption key set.

[0047] The message authentication code can be understood as a short message used to verify the integrity, correctness and sender identity of data. The first encryption result can be understood as the encryption result obtained after performing a first encryption process on the target message.

[0048] In this embodiment, the method of determining the message authentication code of the target message based on the verification key can be: processing the target message according to the verification key, and obtaining the message authentication code through a specific algorithm such as the HMAC algorithm; or first performing binary conversion on the target message to obtain a message sequence, dividing the target message according to the length of the verification password, using the verification key to process each group of divided message sequences, and then obtaining the message authentication code through a specific algorithm.

[0049] In this embodiment, one or more suitable encryption keys are flexibly selected from the encryption key set, the target message converted into binary is encrypted according to the encryption algorithm and the selected encryption key, and a first encryption result of the target message is determined.

[0050] It should be noted that the embodiments of the present invention do not limit the specific technology used in the encryption algorithm, as long as the asymmetric cryptographic algorithm can meet the security requirements and can meet the additive homomorphic encryption technology (at least additive semi-homomorphic encryption technology), such as Paillier et al.

[0051] It should be noted that when it is necessary to resist quantum computing attacks, there is no need to adjust the processing flow of the message processing method provided in this embodiment. Quantum computing attacks of various intensities can be resisted by selecting one or more of the following alternative options: for example, the specific algorithm for generating a message authentication code is set to an algorithm such as the SM3 algorithm that can output a summary with a length of 256 bits; the technology used in the encryption algorithm is set to a lattice cryptography technology with additive homomorphism.

[0052] S103. Determine a second encryption result of the set digital sequence according to the encryption key, where the digital sequence is generated based on the target message.

[0053] The second encryption result can be understood as the result of encrypting a set digital sequence, which is used to confuse the first encryption result to increase the difficulty of cracking the first encryption result. The digital sequence can be understood as a pre-set sequence used to process the first encryption result, which can be one or more.

[0054] In this embodiment, a preset digital sequence is encrypted using an encryption algorithm according to an encryption key to determine a second encryption result. The length of the preset digital sequence is the same as the number of binary bits after binary conversion of the target message, and each bit in the digital sequence has a preset bit value, such as all 0.

[0055] It should be noted that the results of encrypting the same number are usually different.

[0056] It is understandable that encryption algorithms can be adaptively and flexibly set when it is necessary to resist quantum computing attacks.

[0057] S104. Generate an authentication message of the target message according to the message authentication code, the first encryption result, and the second encryption result, and send the authentication message to the receiving terminal, so that the receiving terminal performs message authentication and obtains the target message through decryption processing.

[0058] The authentication message may be understood as a message sent by a sending terminal to a receiving terminal, for the receiving terminal to obtain a target message and confirm the correctness of the target message.

[0059] In this embodiment, the message authentication code, the first encryption result, and the second encryption result are integrated to generate an authentication message for the target message. It will be appreciated that if the second encryption result is obtained by encrypting multiple numeric sequences, the second encryption result includes the encryption results corresponding to each numeric sequence. When generating the authentication message for the target message, the first encryption result can be obfuscated with the encryption results corresponding to each numeric sequence in the second encryption result. After the authentication message is generated, it is sent to a receiving terminal, which decrypts the target message to verify the target message and obtain the target message.

[0060] An embodiment of the present invention provides a message processing method that obtains a target message and a pre-generated verification key and encryption key set, which are pre-generated by a sending terminal through key negotiation with a receiving terminal based on a root key. A message authentication code (MAC) of the target message is determined based on the verification key, and a first encryption result of the target message is determined based on an encryption key from the encryption key set. A second encryption result of a set digital sequence is determined based on the encryption key, where the digital sequence is generated based on the target message. An authentication message for the target message is generated based on the message authentication code, the first encryption result, and the second encryption result, and the authentication message is sent to the receiving terminal, allowing the receiving terminal to authenticate the message and obtain the target message through decryption. This method encrypts the message content by flexibly selecting an encryption key from the encryption key set to determine the first encryption result of the target message, thereby enhancing the security protection of the target message. By obtaining a second encryption result of a set digital sequence and combining it with the first encryption result to generate the authentication message for the target message, the uncertainty of the position of the first encryption result is increased, thereby making it more difficult for an adversary to crack the message and further enhancing the privacy protection of the target message.

[0061] As a first optional embodiment of this embodiment, based on the above embodiment, the verification key and encryption key set may be generated by performing key negotiation with the receiving terminal based on the root key, which may be specifically implemented as follows:

[0062] a1) Generate the root key using a key generation method of an asymmetric homomorphic encryption algorithm, and send the root key to a receiving terminal through a key exchange strategy.

[0063] In this embodiment, a root key (i.e., a private key for asymmetric encryption) is generated using a key generation method using an asymmetric homomorphic encryption algorithm (e.g., the Paillier algorithm). This root key is then sent to the receiving terminal using a key exchange strategy. Exemplary key exchange strategies include quantum key distribution and Diffie-Hellman key exchange.

[0064] b1) generating the verification key and the encryption key set according to the received key generation rule, wherein the key generation rule is generated based on the root key through negotiation with the receiving terminal.

[0065] In this embodiment, after the root key is sent to the receiving terminal, key generation rules or methods are negotiated with the receiving terminal based on the sent root key, as well as the regularly updated root key and verification key generation rules. After receiving the agreed-upon key generation rules, a verification key is generated based on the root key and the received key generation rules. The key generation algorithm used in the encryption algorithm is then used to generate an encryption key set, i.e., a set of public keys for asymmetric encryption. It should be noted that the private key corresponding to each public key in the public key set is a root key.

[0066] The above technical solution of this embodiment jointly ensures that the sending terminal can securely share and use the root key with the receiving terminal through an asymmetric homomorphic encryption algorithm and a key exchange strategy. Moreover, since all keys after sharing are derived from the same root key, the security and consistency of the key are ensured. At the same time, by negotiating the key generation rules, it is ensured that the communicating parties use the same method to generate the verification key, thereby achieving correct decryption.

[0067] As a second optional embodiment of this embodiment, based on the above embodiment, determining the message authentication code of the target message according to the verification key can be specifically implemented as the following steps:

[0068] a2) converting the target message into a binary bit sequence to obtain a message sequence, and acquiring the key length of the verification key.

[0069] In this embodiment, a corresponding encoding method is used to convert the target message into a binary bit sequence, and the converted sequence is determined to be a message sequence, that is, a sequence consisting of 0s and 1s. Simultaneously, the verification key is converted into a binary bit sequence, and the key length of the verification key is obtained. The key length can be understood as the number of bits contained in the binary bit sequence corresponding to the verification key.

[0070] Exemplarily, the target message is converted into a binary bit sequence to obtain a message sequence It can be expressed as:

[0071] ;

[0072] in, is the length of the binary bit sequence, that is, the length of the message sequence, For target message Performs binary conversion operation.

[0073] b2) dividing the message sequence into a plurality of message subsequences each having the key length, wherein the last message subsequence obtained by the division has the key length after being padded with the determined padding length using bit values.

[0074] In this embodiment, a message sequence is divided into multiple message subsequences, each having the key length. That is, the sequence length of each message subsequence is the same as the key length. It should be noted that if the sequence length of the last message subsequence obtained by division is less than the key length, a padding length is determined (i.e., the number of bits required to pad the message to the same key length). The last message subsequence is then padded at the end with a pre-agreed bit value (i.e., 0 or 1) according to the determined padding length, so that the padded message subsequence has the key length.

[0075] For example, following the above example, the key length for obtaining the verification key is , then the message sequence Divided into message subsequences, each containing binary bits, where To round up. The message sequence is denoted as , , if the last message subsequence Bit length less than , then fill the last message subsequence at the end with the binary bit value (0 or 1) agreed by both parties to a length of bit.

[0076] c2) For each message subsequence, perform an XOR operation on the message subsequence using the verification key, and use the first Hash function to obtain the XOR operation result to generate an encrypted subsequence of the message subsequence.

[0077] In this embodiment, for each message subsequence, a bitwise XOR operation is performed on the verification key and each message subsequence to obtain an XOR operation result, and the XOR operation result is processed by a first hash function, such as SM3, SHA-256, etc., which is pre-agreed and determined by the transmitting terminal and the receiving terminal to generate an encrypted subsequence of each message subsequence.

[0078] Exemplarily, following the above example description, the verification key For the first message subsequence The bitwise XOR operation can be expressed as ; The first hash function can be expressed as , the process of generating the encrypted subsequence of the message subsequence by the first hash function can be expressed as .

[0079] d2) splicing the encrypted subsequences and processing them through a second hash function to generate the message authentication code.

[0080] In this embodiment, the encrypted subsequences are concatenated and merged, and the merged result is processed by a second hash function to generate a message authentication code.

[0081] It should be noted that when it is necessary to resist quantum computing attacks, the hash function used can be directly set to a function that can output a digest with a length of 256 bits.

[0082] For example, following the above example, each encrypted subsequence is spliced together to obtain the combined result. The process can be expressed as:

[0083] .

[0084] Exemplarily, the combined result is processed by a second hash function to generate a message authentication code The process can be expressed as:

[0085] .

[0086] The above technical solution of this embodiment improves the efficiency of the verification key in processing the target message by converting the target message into a binary bit sequence and dividing it into message subsequences, and supplementing and padding the message subsequences. At the same time, through two hash function processes, it is difficult to find two different input values that produce the same output hash value, that is, the reliability of the generated message authentication code is improved, providing strong support for the receiving terminal to perform accurate message verification.

[0087] As a third optional embodiment of this embodiment, determining the first encryption result of the target message according to the encryption key in the encryption key set can be specifically optimized into the following steps:

[0088] a3) Randomly selecting a key from the encryption key set as the encryption key.

[0089] In this embodiment, the randomly selected key may select one or more keys.

[0090] b3) encrypting each binary bit in the target message represented by the binary bit sequence using a homomorphic encryption algorithm and the encryption key.

[0091] In this embodiment, a homomorphic encryption algorithm is used to encrypt each binary bit in the binary bit sequence converted from the target message according to an encryption key to obtain an encryption result of each binary bit, that is, a corresponding ciphertext.

[0092] Exemplarily, the process of encrypting each binary bit can be expressed as:

[0093] ;

[0094] ;

[0095] ;

[0096] in, is the encryption key, For the encryption key The encryption algorithm when The first bit in the binary bit sequence The bit value of a binary digit, The first bit in the binary bit sequence The encrypted result of binary bits.

[0097] c3) forming a first encryption result of the target message based on the encryption result of each binary digit.

[0098] The first encryption result may be understood as the result obtained after encrypting the target message.

[0099] In this embodiment, the encryption results of each binary bit are combined to form a first encryption result of the target message.

[0100] Exemplarily, following the above example, the first encryption result of the target message is formed based on the encryption result of each binary bit. The process can be expressed as:

[0101] ;

[0102] ;

[0103] in, For The encryption result of For The encryption result.

[0104] The above technical solution of this embodiment encrypts each binary bit by randomly selecting a key as an encryption key, thereby realizing the encryption of the target message and protecting the security of the target message. By adopting a homomorphic encryption algorithm, the number of subsequent decryptions is reduced while ensuring the security of the target message, thereby improving the decryption efficiency.

[0105] As a fourth optional embodiment of this embodiment, the step of determining the second encryption result of the set digital sequence according to the encryption key may be optimized to include the following steps:

[0106] a4) obtaining a binary bit sequence of the target message and generating at least one digital sequence having a sequence length identical to that of the binary bit sequence, wherein each bit in the digital sequence has a set bit value.

[0107] In this embodiment, a binary bit sequence of the target message is obtained, a sequence length of the binary bit sequence is determined, and at least one digital sequence is generated based on the sequence length. The sequence length of the digital sequence is the same as the sequence length of the binary bit sequence, and each bit in the digital sequence has a set bit value. Exemplarily, the bit value of each bit is 0.

[0108] b4) encrypting each of the digital sequences using a homomorphic encryption algorithm and the encryption key to obtain a second encryption result corresponding to each of the digital sequences.

[0109] The second encryption result can be understood as the result obtained after encrypting the digital sequence.

[0110] In this embodiment, each bit in each digital sequence is encrypted using an encryption key through a homomorphic encryption algorithm to obtain a second encryption result corresponding to each digital sequence.

[0111] For example, let the number of digital sequences be , the bit value of each bit in the digital sequence is 0, and the sequence length of the digital sequence is , the process of obtaining the second encryption result of the digital sequence can be expressed as:

[0112] ;

[0113] ;

[0114] ;

[0115] ;

[0116] in, For the first bits through the homomorphic encryption algorithm and encryption key The bit value 0 of this bit is encrypted, and the encryption result obtained is for The second encryption result corresponding to the corresponding digital sequence.

[0117] It is understandable that since cryptographic algorithms that meet security requirements have the property of ciphertext indistinguishability, even if the same plaintext is encrypted, the resulting ciphertext will be different.

[0118] It should be noted that if the number of digital sequences If the value is greater than 1, the encryption process is repeated for each digital sequence, obtaining the corresponding second encryption result for each digital sequence. As can be understood, as the number of digital sequences increases, it becomes more difficult for the adversary to determine which is the first encryption result corresponding to the target message, increasing the difficulty of cracking. However, this also increases computational cost and loss. Therefore, appropriate parameters can be selected based on security and efficiency requirements.

[0119] When it is necessary to resist quantum computing attacks, the homomorphic encryption algorithm can be conveniently set to a homomorphic encryption algorithm based on lattice cryptography (which must satisfy the homomorphic addition property) without changing the message processing process.

[0120] The above technical solution of this embodiment generates at least one digital sequence with the same sequence length as the binary bit sequence, and encrypts each digital sequence separately through the homomorphic encryption algorithm and the encryption key, thereby producing a second encryption result similar to the first encryption result, thereby increasing the difficulty for the adversary to determine the first encryption result, increasing the difficulty of cracking, and improving the protection strength of the target message; and by using the homomorphic encryption algorithm, it provides strong support for ensuring data security and efficiency in the subsequent decryption process.

[0121] As a fifth optional embodiment of this embodiment, the step of generating the authentication message of the target message according to the message authentication code, the first encryption result, and the second encryption result may be specifically implemented as follows:

[0122] a5) constructing a ciphertext set of the target message based on the first encryption result and the second encryption result.

[0123] The ciphertext set may be understood as a set formed by combining the first encryption result and the second encryption result.

[0124] In this embodiment, the first encryption result and at least one second encryption result are combined to form a ciphertext set for the target message. It should be noted that when the second encryption result is not unique, the first encryption result and each second encryption result in the ciphertext set may be arranged in random order to increase the difficulty for an adversary to crack the ciphertext and ensure the security of the target message.

[0125] Exemplarily, when the second encryption result is unique, the ciphertext set can be expressed as: ,or ;

[0126] For example, when the second encryption result is 2, the ciphertext set can be expressed as: ;or ;or ;or wait;

[0127] in, and are the second encryption results corresponding to each digital sequence.

[0128] b5) constructing an authentication message of the target message based on the ciphertext set and the message authentication code.

[0129] In this embodiment, the ciphertext set and the message authentication code are integrated as the authentication message of the target message.

[0130] For example, the authentication message can be expressed as .

[0131] The above technical solution of this embodiment constitutes a ciphertext set of the target message based on the first encryption result and the second encryption result, and realizes that any number of second encryption results can be sent, and the second encryption results can be arranged in a random order with the first encryption results corresponding to the target message, so that the enemy cannot determine the first encryption result corresponding to the target message, increases the difficulty for the enemy to crack, and further improves the security protection strength of the target message.

[0132] In order to cope with the growing security threats, especially to resist quantum computing attacks, the message processing method provided in an embodiment of the present invention can resist quantum computing attacks of varying degrees by flexibly replacing the hash function with a hash function with doubled output length (256 bits) and / or selecting a homomorphic encryption algorithm that is resistant to quantum computing attacks according to actual needs without changing the message processing process.

[0133] Figure 2 A flowchart of a message processing method applied to a receiving terminal is provided in an embodiment of the present invention. The embodiment of the present invention is applicable to the scenario of decrypting encrypted messages. The method can be executed by a message processing device, which is applied to the receiving terminal and can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, which is preferably a mobile terminal, desktop computer, laptop computer, server, etc.

[0134] like Figure 2 As shown, the message processing method provided by the embodiment of the present invention may specifically include:

[0135] S201. After receiving an authentication message corresponding to a target message transmitted by a sending terminal, obtain a message authentication code and a ciphertext set included in the authentication message, where the ciphertext set is generated by the sending terminal through a determined first encryption result and a determined second encryption result.

[0136] In this embodiment, an authentication message corresponding to a target message transmitted by a sending terminal is received, and a message authentication code and a ciphertext set included in the authentication message are obtained. It is understood that the ciphertext set includes a first encryption result and a second encryption result determined by the sending terminal.

[0137] S202. Perform a first decryption process on the ciphertext set using a homomorphic decryption strategy and a root key received in advance from a sending terminal to obtain a first decryption result.

[0138] The first decryption result may be understood as the decryption result of the binary bit sequence corresponding to the target message determined by the receiving terminal.

[0139] In this embodiment, a first decryption process is performed on the ciphertext set using a root key received in advance from the sending terminal through a homomorphic decryption strategy, that is, the second encryption result is removed and the first encryption result is decrypted to obtain a first decryption result.

[0140] S203. Perform a second decryption process on the first decryption result to obtain a second decryption result. When the second decryption result is consistent with the message authentication code, restore the target message according to the first decryption result.

[0141] The second decryption result may be understood as the result of the corresponding message authentication code determined by the receiving terminal.

[0142] In this embodiment, a second decryption process is performed on the first decryption result. Specifically, the first decryption result is subjected to the processing performed by the sending terminal on the binary bit sequence of the target message, such as grouping, XOR operation, and hash function processing, to determine the message authentication code corresponding to the first decryption result, i.e., the second decryption result. The second decryption result is compared with the message authentication code to determine whether they are consistent. If they are consistent, the message is authenticated correctly, i.e., the first decryption result is consistent with the binary bit sequence of the target message. The target message is then obtained by performing the inverse binary conversion operation on the first decryption result.

[0143] A message processing method provided by an embodiment of the present invention obtains a message authentication code and a ciphertext set included in the authentication message after receiving an authentication message corresponding to a target message transmitted by a sending terminal. The ciphertext set is generated by the sending terminal through a determined first encryption result and a second encryption result; a first decryption process is performed on the ciphertext set through a homomorphic decryption strategy and a root key received in advance from the sending terminal to obtain a first decryption result; a second decryption process is performed on the first decryption result to obtain a second decryption result, and when the second decryption result is consistent with the message authentication code, the target message is restored based on the first decryption result. This method performs a first decryption process on the ciphertext set through a homomorphic decryption strategy and a root key received in advance from the sending terminal, thereby improving the efficiency and security of obtaining the first decryption result; a second decryption result is obtained by performing a second decryption process on the first decryption result, and the target message is restored based on the consistency of the second decryption result with the message authentication code, thereby ensuring the accuracy of the target message obtained by the receiving terminal.

[0144] As a first optional embodiment of this embodiment, the ciphertext set may be subjected to a first decryption process using the homomorphic decryption strategy and the root key pre-received from the sending terminal to obtain a first decryption result, which may be specifically implemented as follows:

[0145] a6) Obtaining all ciphertext elements included in the ciphertext set, and performing homomorphic addition calculation on the ciphertext elements to obtain an addition calculation result.

[0146] The ciphertext elements can be understood as the elements corresponding to the first encryption result and each binary bit encryption in each second encryption result in the ciphertext set. The addition calculation result can be understood as the result obtained after performing the homomorphic addition calculation, which is used to retain only the first encryption result.

[0147] In this embodiment, all ciphertext elements included in the ciphertext set are obtained, and homomorphic addition calculation is performed on all ciphertext elements in the same position to restore the first encryption result, that is, to obtain the addition calculation result.

[0148] For example, if the ciphertext set includes , the addition calculation result is obtained The process can be expressed as: , about to 、 and The ciphertext elements at the same position in are added together.

[0149] It should be noted that if the second encryption result contained in the ciphertext set has a large value and the noise superposition in the ciphertext reaches or exceeds the threshold, ciphertext refresh processing is required to ensure that the homomorphic addition calculation and subsequent decryption of the addition calculation results can be executed normally.

[0150] b6) decrypting the addition calculation result according to the homomorphic decryption algorithm and the root key received in advance from the sending terminal to obtain a decrypted binary bit sequence with a sequence length of a set value.

[0151] The set value may be understood as the sequence length of the binary bit sequence of the target message.

[0152] In this embodiment, the addition calculation result is decrypted according to the homomorphic decryption algorithm and the root key received in advance from the sending terminal to obtain a decrypted binary bit sequence, and the sequence length of the decrypted binary bit sequence is a set value, that is, the same as the sequence length of the binary bit sequence of the target message.

[0153] It should be noted that the result of adding the homomorphic ciphertexts is the same as the result of adding the corresponding plaintexts after decryption. Therefore, if the authentication message has not been tampered with, the decrypted binary bit sequence is the binary bit sequence of the target message.

[0154] For example, following the above example description, according to the homomorphic decryption algorithm and the root key received in advance from the sending terminal , the addition result Decryption to obtain a decrypted binary bit sequence with a sequence length of the set value The process can be expressed as:

[0155] ;

[0156] in, The decrypted binary bit sequence corresponds to the restored target message.

[0157] It is understandable that Should be the same as the binary bit sequence of the target message Consistent, when The sequence length is When the setting value is .

[0158] c6) Determine the decrypted binary bit sequence as the first decryption result.

[0159] The above technical solution of this embodiment can obtain the encryption result of the target message by performing homomorphic addition calculation on the ciphertext elements. There is no need for the receiving terminal to know the meaning or order of each encryption result in the ciphertext set, and no decryption is required during the calculation process, thereby ensuring data security during the calculation; at the same time, only the final addition calculation result of the homomorphic addition calculation needs to be decrypted, which reduces the number of decryption times and improves decryption efficiency.

[0160] As a second optional embodiment of this embodiment, the first decryption result may be subjected to a second decryption process to obtain a second decryption result, which is specifically optimized into the following steps:

[0161] a7) Obtaining a decrypted binary bit sequence representing the first decryption result.

[0162] In this embodiment, a decrypted binary bit sequence representing the first decryption result is obtained.

[0163] b7) dividing the decrypted binary bit sequence according to the key length of the generated verification key to obtain at least one decrypted subsequence, wherein the last decrypted subsequence obtained by the division has the key length after being padded with the determined padding length using bit values.

[0164] In this embodiment, the receiving terminal generates a verification key using the received root key and verification key generation rules. The receiving terminal then divides the decrypted binary bit sequence into at least one decrypted subsequence according to the key length of the generated verification key. If the sequence length of the last decrypted subsequence is less than the key length, a padding length is determined, i.e., the number of bits required to ensure that the sequence length of the last decrypted subsequence is the same as the key length. The last decrypted subsequence is then padded at the end with a pre-agreed bit value (i.e., 0 or 1) according to the determined padding length, so that the padded last decrypted subsequence meets the key length.

[0165] It is understandable that the key length of the verification key generated by the receiving terminal should be the same as the key length of the verification key generated by the sending terminal, and the number of decryption subsequences divided accordingly should be the same as the number of message subsequences divided by the sending terminal.

[0166] c7) performing an XOR operation on each of the decryption subsequences using the verification key, processing each of the XOR operation results using a first hash function, and concatenating each of the first hash results and processing them using a second hash function to generate a decryption authentication code as a second decryption result.

[0167] The decryption authentication code may be understood as an authentication code used to compare with the message authentication code included in the authentication message to confirm whether the first decryption result obtained by decryption is correct.

[0168] In this embodiment, an XOR operation is performed on each of the decryption subsequences using a verification key, and each XOR operation result is processed using a first hash function to obtain each first hash result. The first hash results are then concatenated and processed using a second hash function to generate a decryption authentication code, which is used as the second decryption result.

[0169] For example, generate a decryption authentication code The process can be expressed as:

[0170] ;

[0171] in, For the A decrypted subsequence.

[0172] The above technical solution of this embodiment divides the decrypted binary bit sequence representing the first decryption result according to the key length of the verification key, obtains the decrypted subsequence and adaptively fills the last decrypted subsequence, and performs the same XOR operation and hash function processing as the sending end on the decrypted subsequence to generate a second decryption result corresponding to the message authentication code sent by the sending terminal, thereby verifying the correctness of the first decryption result, ensuring that the restored target message is correct, and preventing the target message content from being tampered with.

[0173] Figure 3 Schematic diagram of a message processing device for a sending terminal provided by an embodiment of the present invention. Figure 3 As shown, the device includes: a key acquisition module 31, a first encryption result determination module 32, a second encryption result determination module 33 and an authentication message sending module 34, wherein,

[0174] A key acquisition module 31 is configured to acquire a target message and obtain a pre-generated verification key and encryption key set, wherein the verification key and encryption key set are pre-generated by the sending terminal through key negotiation with the receiving terminal based on a root key;

[0175] A first encryption result determination module 32 is configured to determine a message authentication code of the target message based on the verification key, and determine a first encryption result of the target message based on an encryption key in the encryption key set;

[0176] A second encryption result determination module 33 is configured to determine a second encryption result of a set digital sequence according to the encryption key, the digital sequence being generated based on the target message;

[0177] The authentication message sending module 34 is used to generate an authentication message of the target message according to the message authentication code, the first encryption result and the second encryption result, and send the authentication message to the receiving terminal so that the receiving terminal performs message authentication and obtains the target message through decryption processing.

[0178] An embodiment of the present invention provides a message processing device that obtains a target message and a pre-generated verification key and encryption key set, which are pre-generated by a sending terminal through key negotiation with a receiving terminal based on a root key. Based on the verification key, a message authentication code (MAC) of the target message is determined, and based on an encryption key from the encryption key set, a first encryption result of the target message is determined. Based on the encryption key, a second encryption result of a set digital sequence is determined, where the digital sequence is generated based on the target message. Based on the message authentication code, the first encryption result, and the second encryption result, an authentication message for the target message is generated, and the authentication message is sent to the receiving terminal, allowing the receiving terminal to authenticate the message and obtain the target message through decryption. This method encrypts the message content and improves the security protection of the target message by flexibly selecting an encryption key from the encryption key set to determine the first encryption result of the target message. By obtaining the second encryption result of the set digital sequence and combining it with the first encryption result to generate the authentication message for the target message, the uncertainty of the position of the first encryption result is increased, thereby increasing the difficulty for an adversary to crack the message and further improving the privacy protection of the target message. Furthermore, the message processing device also includes a negotiation generation module, which can be specifically used to:

[0179] Generate the root key using a key generation method of an asymmetric homomorphic encryption algorithm, and send the root key to the receiving terminal through a key exchange strategy;

[0180] The verification key and the encryption key set are generated according to the received key generation rule, wherein the key generation rule is generated based on the root key through negotiation with the receiving terminal.

[0181] Furthermore, the first encryption result determination module 32 may be specifically configured to:

[0182] Convert the target message into a binary bit sequence to obtain a message sequence, and obtain the key length of the verification key;

[0183] Dividing the message sequence into a plurality of message subsequences each having the key length, wherein the last message subsequence obtained by the division has the key length after being padded with the determined padding length using bit values;

[0184] For each message subsequence, perform an XOR operation on the message subsequence using the verification key, and generate an encrypted subsequence of the message subsequence by processing the obtained XOR operation result through a first hash function;

[0185] The encrypted subsequences are concatenated and processed through a second hash function to generate the message authentication code.

[0186] Furthermore, the first encryption result determination module 32 may be further configured to:

[0187] Randomly selecting a key from the encryption key set as an encryption key;

[0188] Encrypting each binary bit in a target message represented by a binary bit sequence using a homomorphic encryption algorithm and the encryption key;

[0189] A first encryption result of the target message is formed based on the encryption result of each binary bit.

[0190] Furthermore, the second encryption result determination module 33 may be specifically configured to:

[0191] Obtaining a binary bit sequence of the target message and generating at least one digital sequence having a sequence length equal to the sequence length of the binary bit sequence, wherein each bit in the digital sequence is a set bit value;

[0192] Each of the digital sequences is encrypted using a homomorphic encryption algorithm and the encryption key to obtain a second encryption result corresponding to each of the digital sequences.

[0193] Furthermore, the authentication message sending module 34 may be specifically configured to:

[0194] Constructing a ciphertext set of the target message based on the first encryption result and the second encryption result;

[0195] An authentication message of the target message is constructed based on the ciphertext set and the message authentication code.

[0196] The message processing device provided by the embodiment of the present invention can execute the message processing method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0197] Figure 4 Schematic diagram of a message processing device applied to a receiving terminal provided by an embodiment of the present invention. Figure 4 As shown, the device includes: an authentication message receiving module 41, a first decryption result determination module 42 and a target message restoration module 43, wherein:

[0198] An authentication message receiving module 41 is configured to, upon receiving an authentication message corresponding to a target message transmitted by a sending terminal, obtain a message authentication code and a ciphertext set included in the authentication message, the ciphertext set being generated by the sending terminal using the determined first encryption result and second encryption result;

[0199] A first decryption result determination module 42 is configured to perform a first decryption process on the ciphertext set using a homomorphic decryption strategy and a root key pre-received from a sending terminal to obtain a first decryption result;

[0200] The target message restoration module 43 is configured to perform a second decryption process on the first decryption result to obtain a second decryption result, and when the second decryption result is consistent with the message authentication code, restore the target message according to the first decryption result.

[0201] A message processing device provided by an embodiment of the present invention obtains a message authentication code and a ciphertext set included in the authentication message after receiving an authentication message corresponding to a target message transmitted by a sending terminal. The ciphertext set is generated by the sending terminal through a determined first encryption result and a second encryption result; a first decryption result is obtained by performing a first decryption process on the ciphertext set through a homomorphic decryption strategy and a root key received in advance from the sending terminal; a second decryption result is obtained by performing a second decryption process on the first decryption result, and when the second decryption result is consistent with the message authentication code, the target message is restored based on the first decryption result. This method performs a first decryption process on the ciphertext set through a homomorphic decryption strategy and a root key received in advance from the sending terminal, thereby improving the efficiency and security of obtaining the first decryption result; a second decryption result is obtained by performing a second decryption process on the first decryption result, and the target message is restored based on the consistency between the second decryption result and the message authentication code, thereby ensuring the accuracy of the target message obtained by the receiving terminal.

[0202] Furthermore, the first decryption result determination module 42 may be specifically configured to:

[0203] Obtaining all ciphertext elements included in the ciphertext set, and performing homomorphic addition calculation on the ciphertext elements to obtain an addition calculation result;

[0204] Decrypting the addition calculation result according to a homomorphic decryption algorithm and a root key received in advance from the sending terminal to obtain a decrypted binary bit sequence with a sequence length of a set value;

[0205] The decrypted binary bit sequence is determined as the first decryption result.

[0206] Furthermore, the target message restoration module 43 may be specifically configured to:

[0207] Obtaining a decrypted binary bit sequence representing a first decryption result;

[0208] Dividing the decrypted binary bit sequence according to the key length of the generated verification key to obtain at least one decrypted subsequence, wherein the last decrypted subsequence obtained by the division has the key length after being padded with the determined padding length using bit values;

[0209] An XOR operation is performed on each of the decryption subsequences using the verification key, and each XOR operation result is processed using a first Hash function, and the first Hash results are concatenated and processed using a second Hash function to generate a decryption authentication code as a second decryption result.

[0210] The message processing device provided by the embodiment of the present invention can execute the message processing method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0211] Figure 5 A schematic diagram of an electronic device 50 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0212] like Figure 5 As shown, electronic device 50 includes at least one processor 51 and memory, such as read-only memory (ROM) 52 and random access memory (RAM) 53, communicatively connected to the at least one processor 51. The memory stores computer programs executable by the at least one processor. Processor 51 can perform various appropriate actions and processes based on the computer programs stored in ROM 52 or loaded from storage unit 58 into RAM 53. RAM 53 can also store various programs and data required for the operation of electronic device 50. Processor 51, ROM 52, and RAM 53 are interconnected via bus 54. An input / output (I / O) interface 55 is also connected to bus 54.

[0213] Multiple components in the electronic device 50 are connected to the I / O interface 55, including an input unit 56, such as a keyboard, a mouse, etc.; an output unit 57, such as various types of displays, speakers, etc.; a storage unit 58, such as a magnetic disk, an optical disk, etc.; and a communication unit 59, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 59 allows the electronic device 50 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0214] The processor 51 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 51 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any other suitable processor, controller, microcontroller, etc. The processor 51 executes the various methods and processes described above, such as the message processing method.

[0215] In some embodiments, the message processing method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 58. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 50 via ROM 52 and / or communication unit 59. When the computer program is loaded into RAM 53 and executed by processor 51, one or more steps of the message processing method described above may be performed. Alternatively, in other embodiments, processor 51 may be configured to perform the message processing method in any other suitable manner (e.g., via firmware).

[0216] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0217] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0218] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or apparatus. A computer-readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0219] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device that has: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0220] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0221] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0222] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0223] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A message processing method, characterized in that: Applicable to the sending terminal, including: Obtaining a target message and obtaining a pre-generated verification key and encryption key set, where the verification key and encryption key set are pre-generated by the sending terminal through key negotiation with the receiving terminal based on a root key; determining a message authentication code of the target message based on the verification key, and determining a first encryption result of the target message based on an encryption key in the encryption key set; determining, based on the encryption key, a second encryption result of a set digital sequence, the digital sequence being generated based on the target message; generating an authentication message of the target message based on the message authentication code, the first encryption result, and the second encryption result, and sending the authentication message to a receiving terminal, so that the receiving terminal performs message authentication and obtains the target message through a decryption process; Wherein, determining the message authentication code of the target message according to the verification key includes: Convert the target message into a binary bit sequence to obtain a message sequence, and obtain the key length of the verification key; Dividing the message sequence into a plurality of message subsequences each having the key length, wherein the last message subsequence obtained by the division has the key length after being padded with the determined padding length using bit values; For each message subsequence, perform an XOR operation on the message subsequence using the verification key, and generate an encrypted subsequence of the message subsequence by processing the obtained XOR operation result through a first hash function; splicing the encrypted subsequences and processing them through a second hash function to generate the message authentication code; The step of determining a second encryption result of the set digital sequence according to the encryption key includes: Obtaining a binary bit sequence of the target message and generating at least one digital sequence having a sequence length equal to the sequence length of the binary bit sequence, wherein each bit in the digital sequence is a set bit value; Each of the digital sequences is encrypted using a homomorphic encryption algorithm and the encryption key to obtain a second encryption result corresponding to each of the digital sequences.

2. The method according to claim 1, characterized in that The step of generating the verification key and the encryption key set by performing key negotiation with the receiving terminal according to the root key includes: Generate the root key using a key generation method of an asymmetric homomorphic encryption algorithm, and send the root key to the receiving terminal through a key exchange strategy; The verification key and the encryption key set are generated according to the received key generation rule, wherein the key generation rule is generated based on the root key through negotiation with the receiving terminal.

3. The method according to claim 1, characterized in that Determining a first encryption result of the target message according to an encryption key in the encryption key set includes: Randomly selecting a key from the encryption key set as an encryption key; Encrypting each binary bit in a target message represented by a binary bit sequence using a homomorphic encryption algorithm and the encryption key; A first encryption result of the target message is formed based on the encryption result of each binary bit.

4. The method according to claim 1, wherein Generating an authentication message of the target message according to the message authentication code, the first encryption result, and the second encryption result includes: Constructing a ciphertext set of the target message based on the first encryption result and the second encryption result; An authentication message of the target message is constructed based on the ciphertext set and the message authentication code.

5. A message processing method, characterized in that: The method is applied to a receiving terminal, and is used to process an authentication message received from the sending terminal according to claim 1, the method comprising: After receiving an authentication message corresponding to a target message transmitted by a sending terminal, obtaining a message authentication code and a ciphertext set included in the authentication message, the ciphertext set being generated by the sending terminal using the determined first encryption result and the determined second encryption result; Performing a first decryption process on the ciphertext set using a homomorphic decryption strategy and a root key pre-received from a sending terminal to obtain a first decryption result; Performing a second decryption process on the first decryption result to obtain a second decryption result, and when the second decryption result is consistent with the message authentication code, restoring the target message according to the first decryption result; The step of performing a first decryption process on the ciphertext set using a homomorphic decryption strategy and a root key pre-received from a sending terminal to obtain a first decryption result includes: Obtaining all ciphertext elements included in the ciphertext set, and performing homomorphic addition calculation on the ciphertext elements to obtain an addition calculation result; Decrypting the addition calculation result according to a homomorphic decryption algorithm and a root key received in advance from the sending terminal to obtain a decrypted binary bit sequence with a sequence length of a set value; Determining the decrypted binary bit sequence as the first decryption result; The performing a second decryption process on the first decryption result to obtain a second decryption result includes: Obtaining a decrypted binary bit sequence representing a first decryption result; Dividing the decrypted binary bit sequence according to the key length of the generated verification key to obtain at least one decrypted subsequence, wherein the last decrypted subsequence obtained by the division has the key length after being padded with the determined padding length using bit values; An XOR operation is performed on each of the decryption subsequences using the verification key, and each XOR operation result is processed using a first Hash function, and the first Hash results are concatenated and processed using a second Hash function to generate a decryption authentication code as a second decryption result.

6. A message processing device, characterized in that: Applicable to the sending terminal, including: A key acquisition module, configured to acquire a target message and obtain a pre-generated verification key and encryption key set, wherein the verification key and encryption key set are pre-generated by the sending terminal through key negotiation with the receiving terminal based on a root key; a first encryption result determination module, configured to determine a message authentication code of the target message based on the verification key, and determine a first encryption result of the target message based on an encryption key in the encryption key set; a second encryption result determination module, configured to determine a second encryption result of a set digital sequence according to the encryption key, the digital sequence being generated based on the target message; an authentication message sending module, configured to generate an authentication message of the target message based on the message authentication code, the first encryption result, and the second encryption result, and to send the authentication message to a receiving terminal, so that the receiving terminal performs message authentication and obtains the target message through decryption processing; The first encryption result determination module is specifically configured to: Convert the target message into a binary bit sequence to obtain a message sequence, and obtain the key length of the verification key; Dividing the message sequence into a plurality of message subsequences each having the key length, wherein the last message subsequence obtained by the division has the key length after being padded with the determined padding length using bit values; For each message subsequence, perform an XOR operation on the message subsequence using the verification key, and generate an encrypted subsequence of the message subsequence by processing the obtained XOR operation result through a first hash function; splicing the encrypted subsequences and processing them through a second hash function to generate the message authentication code; The second encryption result determination module is specifically used to: Obtaining a binary bit sequence of the target message and generating at least one digital sequence having a sequence length equal to the sequence length of the binary bit sequence, wherein each bit in the digital sequence is a set bit value; Each of the digital sequences is encrypted using a homomorphic encryption algorithm and the encryption key to obtain a second encryption result corresponding to each of the digital sequences.

7. A message processing device, characterized in that: Applied to a receiving terminal, for processing an authentication message received from the sending terminal according to claim 6, the apparatus comprising: an authentication message receiving module, configured to, upon receiving an authentication message corresponding to a target message transmitted by a sending terminal, obtain a message authentication code and a ciphertext set included in the authentication message, the ciphertext set being generated by the sending terminal using the determined first encryption result and second encryption result; A first decryption result determination module is configured to perform a first decryption process on the ciphertext set using a homomorphic decryption strategy and a root key received in advance from a sending terminal to obtain a first decryption result; a target message restoration module, configured to perform a second decryption process on the first decryption result to obtain a second decryption result, and when the second decryption result is consistent with the message authentication code, restore the target message according to the first decryption result; The first decryption result determination module is specifically configured to: Obtaining all ciphertext elements included in the ciphertext set, and performing homomorphic addition calculation on the ciphertext elements to obtain an addition calculation result; Decrypting the addition calculation result according to a homomorphic decryption algorithm and a root key received in advance from the sending terminal to obtain a decrypted binary bit sequence with a sequence length of a set value; Determining the decrypted binary bit sequence as the first decryption result; The target message restoration module is specifically used to: Obtaining a decrypted binary bit sequence representing a first decryption result; Dividing the decrypted binary bit sequence according to the key length of the generated verification key to obtain at least one decrypted subsequence, wherein the last decrypted subsequence obtained by the division has the key length after being padded with the determined padding length using bit values; An XOR operation is performed on each of the decryption subsequences using the verification key, and each XOR operation result is processed using a first Hash function, and the first Hash results are concatenated and processed using a second Hash function to generate a decryption authentication code as a second decryption result.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the message processing method according to any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the message processing method according to any one of claims 1 to 5 when executed.

10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the message processing method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Message transmission method, message verification method, device, equipment, medium and product

    CN116684102A

  • Message transmission method and device, terminal, server and medium

    CN118057759A