Information synchronous exchange method and device, electronic equipment and storage medium
Through the information exchange method combined with symmetric and asymmetric encryption algorithms, the correctness of the other party's key is verified, the problem of unfair information exchange in the prior art is solved, and the fairness and security of information exchange are realized.
Patent Information
- Application Number
- CN202510007672.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-01-03
AI Technical Summary
There is a fairness problem with the existing information exchange methods. If one party does not provide or provides the wrong decryption key, the other party cannot decrypt it correctly, resulting in unfair information exchange.
The symmetric encryption algorithm exchanges the ciphertext of the information to be transmitted with the counterpart, the asymmetric encryption algorithm exchanges the hash value of the random information, and verifies the correctness of the opponent's key through the exchange of multiple sets of keys and ciphertext combinations to ensure the synchronous exchange and fairness of the information.
The fairness of information exchange is achieved, ensuring that either party can promptly detect the other party's fraud or transmission errors, and avoid the consequences of one party benefiting while the other party suffers damage.
Smart Images

Figure CN119814284A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of data security technology, and in particular to an information synchronization exchange method, device, electronic device and storage medium. Background Art
[0002] In general, when parties A and B need to exchange information, they usually encrypt their own information to be transmitted, and then transmit the ciphertext and decryption key to each other. Finally, both parties use the key to decrypt the ciphertext and obtain the plaintext result. However, this information exchange method has a significant fairness problem. If one party receives the ciphertext and decryption key transmitted by the other party, but does not provide its own decryption key to the other party or provides the wrong decryption key, it will result in one party benefiting while the other party cannot decrypt correctly. Summary of the invention
[0003] The present invention provides a method, device, electronic device and storage medium for synchronous information exchange, which can realize synchronous information exchange between two communicating parties, avoid the consequence that one party benefits while the other party is harmed, and thus ensure the fairness of information exchange.
[0004] In a first aspect, an embodiment of the present invention provides a method for synchronously exchanging information, including:
[0005] Exchange the ciphertext to be transmitted corresponding to the respective information to be transmitted with the other end of the communication through a symmetric encryption algorithm;
[0006] Exchanging hash values of respective random information with the peer end through an asymmetric encryption algorithm;
[0007] Exchanging respective multiple ciphertext combinations with the opposite end through a symmetric encryption algorithm, wherein the respective multiple ciphertext combinations are obtained by encrypting the hash value of the information to be transmitted and the hash value of the random information of the other party through each of the multiple keys of the respective multiple keys; the multiple keys of the respective multiple keys are generated based on the symmetric keys used to encrypt the information to be transmitted;
[0008] exchanging respective multiple groups of keys with the opposite end by means of key splitting transmission, so that both communicating parties can verify the correctness of the key based on the received key and the received multiple groups of ciphertext combinations;
[0009] When the verification is successful, the information to be transmitted of the other end is determined based on the multiple groups of keys of the other end and the ciphertext to be transmitted of the other end.
[0010] In a second aspect, an embodiment of the present invention provides an information synchronization exchange device, including:
[0011] A first exchange module, used to exchange ciphertexts to be transmitted corresponding to respective information to be transmitted with a communication counterpart through a symmetric encryption algorithm;
[0012] A second exchange module, used to exchange hash values of respective random information with the opposite end through an asymmetric encryption algorithm;
[0013] A third exchange module is used to exchange respective multiple sets of ciphertext combinations with the opposite end through a symmetric encryption algorithm, wherein the respective multiple sets of ciphertext combinations are obtained by encrypting the hash value of the information to be transmitted and the hash value of the random information of the other party through each set of keys in the respective multiple sets of keys; the respective multiple sets of keys are generated based on the respective symmetric keys for encrypting the information to be transmitted;
[0014] A fourth exchange module, used for exchanging respective multiple groups of keys with the opposite end by means of splitting and transmitting the keys, so that both communicating parties can verify the correctness of the keys based on the received keys and the received multiple groups of ciphertext combinations;
[0015] The decryption module is used to determine the information to be transmitted by the other end based on the multiple groups of keys of the other end and the ciphertext to be transmitted by the other end when the verification is passed.
[0016] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program executable 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 perform the method according to the first aspect.
[0020] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.
[0021] According to the technical solution of the embodiment of the present invention, both communicating parties use their own multiple groups of keys to encrypt the hash value of their own information to be transmitted and the hash value of the other party's random information to obtain multiple groups of ciphertext combinations; through the exchange and transmission of the multiple groups of ciphertext combinations of the communicating parties and the split exchange and transmission of the multiple groups of keys of the communicating parties, the communicating parties can verify the correctness of the keys transmitted by the other party; if the verification is successful, the communicating parties can determine the other party's information to be transmitted based on the received keys and the other party's ciphertext to be transmitted. This solution can realize the synchronous exchange of information to be transmitted, and during the information exchange process, the correctness of the key can be verified to ensure that either party can promptly discover the other party's fraudulent behavior or errors in the transmission process, avoid the consequence that one party benefits while the other party suffers, and thus ensure the fairness of information exchange.
[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] 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.
[0024] Figure 1 is a flow chart of a method for synchronously exchanging information provided according to Embodiment 1 of the present invention;
[0025] Figure 2 is a flow chart of a method for synchronously exchanging information provided according to Embodiment 2 of the present invention;
[0026] Figure 3 is a flow chart of a method for synchronously exchanging information provided according to Embodiment 3 of the present invention;
[0027] Figure 4 is a schematic diagram of the structure of an information synchronization exchange device provided according to Embodiment 4 of the present invention;
[0028] Figure 5 It is a schematic diagram of the structure of an electronic device implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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 described embodiments 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 creative work should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first", "second", etc. in the present invention are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data 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 that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] Embodiment 1
[0032] Figure 1 This is a flow chart of a method for synchronous information exchange provided according to Embodiment 1 of the present invention. This embodiment is applicable to the case of synchronous information exchange with a communicating peer. The method can be executed by an information synchronous exchange device, which can be implemented in the form of software and / or hardware and integrated in an electronic device. Furthermore, the electronic device includes but is not limited to: a computer, a laptop, etc.
[0033] like Figure 1 As shown, the method includes:
[0034] S110, exchanging ciphertexts to be transmitted corresponding to respective information to be transmitted with the communicating counterpart through a symmetric encryption algorithm.
[0035] In the embodiment of the present invention, the electronic device needs to synchronously exchange the information to be transmitted with the communicating peer. The electronic device in the embodiment of the present invention can be considered as device A, and the peer communicating with device A can be considered as device B. Device B can be a device capable of information exchange with device A, such as a computer, a laptop, etc., which is not limited here.
[0036] The information to be transmitted can be information to be transmitted to the other party of the communication. For example, the information to be transmitted is information that device A needs to transmit to device B, which is denoted by M. A ; For example, if the information to be transmitted is the information that device B needs to transmit to device A, it is recorded as M B The specific content of the information to be transmitted is not limited. The ciphertext to be transmitted may be the ciphertext obtained by encrypting the information to be transmitted using a symmetric encryption algorithm.
[0037] A symmetric encryption algorithm can be an algorithm in which the sender and the receiver use the same key to encrypt and decrypt data, that is, the encryption and decryption keys of the symmetric encryption algorithm are the same, and can mainly include two types: sequence ciphers and block ciphers. The present invention does not specify a specific symmetric encryption algorithm, and any symmetric encryption algorithm that can meet the protocol flow and security requirements can be used, but device A and device B must use the same symmetric encryption algorithm. Optionally, the symmetric encryption algorithm can be the national secret SM4 algorithm.
[0038] In this step, device A randomly generates a key for the symmetric encryption algorithm Enc(), and uses the same key for encryption and decryption, denoted as keyA; keyA and Enc() are used to encrypt M A Get M A The corresponding ciphertext to be transmitted Enc keyA (M A ), and the ciphertext to be transmitted Enc keyA (M A ) is transmitted to device B.
[0039] Similarly, device B randomly generates a key for the symmetric encryption algorithm Enc(), and uses the same key for encryption and decryption, denoted as keyB; keyB and Enc() are used to encrypt M B Get M B The corresponding ciphertext to be transmitted Enc keyB (M B ), and the ciphertext to be transmitted Enc keyB (M B ) is transmitted to device A.
[0040] At this point, device A and device B, that is, the communicating parties, have exchanged the ciphertexts to be transmitted corresponding to their respective information to be transmitted.
[0041] S120. Exchange hash values of respective random information with the opposite end through an asymmetric encryption algorithm.
[0042] Asymmetric encryption algorithms are also called public key encryption algorithms. A pair of mathematically related keys can be used to perform encryption and decryption processes. The pair of keys are a public key and a private key, where the public key is used for encryption and is public; the private key is used for decryption and is confidential, and the decryption key cannot be derived from the encryption key. The present invention does not specify a specific asymmetric encryption algorithm. Any asymmetric encryption algorithm that can meet the protocol flow and security requirements is acceptable, but device A and device B must use the same asymmetric encryption algorithm. Optionally, the asymmetric encryption algorithm can be a lattice cipher encryption algorithm.
[0043] The random information may be randomly generated information, and the specific content of the random information is not limited. The random information of device A can be recorded as m A , the random information of device B can be recorded as m B .
[0044] The hash value of random information can be the result obtained by processing the random information through a hash function (also known as a hash algorithm). The hash function can process and convert input data of any length into a string of fixed length. The present invention does not specify a specific hash algorithm, as long as it can meet the functional requirements and security requirements of the hash algorithm, but device A and device B need to use the same hash algorithm. Optionally, the hash algorithm can be the national secret hash algorithm SM3.
[0045] In this step, device A randomly generates a public-private key pair (pk A ,sk A ), where the public key pk A Sent to device B, private key sk A Similarly, device B randomly generates a public and private key pair (pk B ,sk B ), where the public key pk B Sent to device A, private key sk B Store properly.
[0046] Device A generates random information m A , use the hash algorithm H() to generate m A The hash value H(m A ), using asymmetric encryption algorithm Enc'() and public key pk B Encryption H(m A )get Will Sent to device B, H(m A ) is properly stored. Similarly, device B generates random information m B , use the hash algorithm H() to generate m B The hash value H(m B ), using asymmetric encryption algorithm Enc'() and public key pk A Encryption H(m B )get Will Send to device A, H(m B ) Keep it properly.
[0047] Device A uses the asymmetric decryption algorithm Dec'() and private key sk corresponding to the asymmetric encryption algorithm A Decryption get Similarly, device B uses Dec'() and private key sk B Decryption get
[0048]
[0049] At this point, the communicating parties have exchanged the hash values of their respective random information.
[0050] S130. Exchanging respective multiple ciphertext combinations with the opposite end through a symmetric encryption algorithm. Each of the multiple ciphertext combinations is obtained by encrypting the hash value of its own information to be transmitted and the hash value of the other party's random information through each of the multiple keys. The multiple keys are generated based on the symmetric keys used to encrypt the information to be transmitted.
[0051] In one embodiment, each of the plurality of key groups includes a random key and a calculated key, wherein the calculated key is the XOR result of the random key and the symmetric key used to encrypt the information to be transmitted; the random key is used to encrypt the hash value of the information to be transmitted; and the calculated key is used to encrypt the hash value of the random information of the other party. The random key may be a key randomly generated under a symmetric encryption algorithm, which is not limited here; the calculated key is the XOR result of the random key and the key (i.e., the symmetric key) used to symmetrically encrypt the information to be transmitted in S110.
[0052] In this step, device A generates n sets of keys (n is not limited) of the symmetric encryption algorithm, and the n sets of keys are represented as {(a 1 ,a 1 ′),(a 2 ,a′ 2 ),…,(an,a′n)}, where, a i is a random key, for a i The corresponding calculated key, i = 1, 2, ..., n, Represents bitwise XOR operation; uses hash algorithm H() to generate the information M to be transmitted A The hash value H(M A ) ; Combined with symmetric encryption algorithm and random key a i Encryption H(M A )get Using the calculated key a i ′ Encryption H(m B )get Get n groups of ciphertext combinations The obtained n groups of ciphertext combinations are transmitted to device B.
[0053] Similarly, device B generates n sets of keys (n is not limited) for the symmetric encryption algorithm, and the n sets of keys are represented as {(b 1 ,b 1 ′),(b 2 ,b 2 ′),…,(bn,bn′)}, where bi is a random key, for b i The corresponding calculated key, i = 1, 2, ..., n; the hash algorithm H() is used to generate the information M to be transmitted B The hash value H(M B );Combined with symmetric encryption algorithm and random key b i Encryption H(M B )get Using the calculated key b i ′ Encryption H(m A )get Then we get n groups of ciphertext combinations The obtained n groups of ciphertext combinations are transmitted to device A.
[0054] At this point, the communicating parties have exchanged their respective multiple ciphertext combinations.
[0055] S140, exchanging respective multiple groups of keys with the opposite end by means of key splitting transmission, so that both communicating parties can verify the correctness of the key based on the received key and the received multiple groups of ciphertext combinations.
[0056] In this step, there is no limitation on the method of splitting and transmitting multiple groups of keys. For example, it can be based on the oblivious transfer protocol transmission, or it can be to convert multiple groups of keys into corresponding binary bits and transmit them in the order of the binary bits, or it can be a combination of the above two.
[0057] Among them, the Oblivious Transfer (OT) protocol is a cryptographic protocol widely used in the field of multi-party secure computing. The present invention can adopt a 2-choose-1 oblivious transfer protocol, which means that the sender sends two messages to the receiver, and the receiver can selectively receive any one of the two messages through a selection bit. At the same time, the sender cannot determine which message the receiver has received, and the receiver cannot determine the other message that has not been received.
[0058] In this step, device A can transmit n groups of keys {(a 1 ,a 1 ′),(a 2 ,a′ 2 ),…,(a n ,a′ n )}; Similarly, device B can transmit n groups of keys {(b 1 ,b 1 ′),(b 2 ,b 2 ′),…,(b n ,b n′)}; At this point, both communicating parties have obtained the other party's partial key, and can use the obtained partial key to decrypt the corresponding ciphertext in the other party's multiple ciphertext combinations to verify the correctness of the obtained partial key.
[0059] Device A can convert its n groups of keys into corresponding binary bits, and transmit the n groups of keys to device B in the order of the binary bits, one binary bit at a time; similarly, device B can convert its n groups of keys into corresponding binary bits, and transmit the n groups of keys to device A in the order of the binary bits, one binary bit at a time; when the above-mentioned communicating parties exchange binary bits in multiple groups of keys, the communicating parties can verify the correctness of the other party's multiple groups of keys based on the received binary bits, based on the partial keys received by inadvertent transmission of 2 out of 1, and based on the ciphertext in the other party's multiple groups of ciphertext combinations.
[0060] In the above verification process, if the verification fails, the key transmission can be stopped, so that the other party cannot obtain its complete key; if the verification succeeds, the transmission will continue until the transmission of multiple sets of keys is completed.
[0061] S150. When the verification is successful, determine the information to be transmitted of the other end based on the multiple groups of keys of the other end and the ciphertext to be transmitted of the other end.
[0062] In this step, when device A verifies that the multiple sets of keys transmitted by device B are correct, the multiple sets of keys transmitted by device B are based on the transmitted information M. B The encrypted symmetric key is generated, then device A can determine the device B's access to M through the multiple sets of keys transmitted by device B. B The encrypted symmetric key is used to determine the information to be transmitted by device B based on the determined symmetric key and the ciphertext to be transmitted transmitted by device B. Similarly, device B can determine the information to be transmitted by device A through multiple groups of keys transmitted by device A and the ciphertext to be transmitted transmitted by device A.
[0063] In one embodiment, the information to be transmitted of the other end is determined based on the multiple groups of keys of the other end and the ciphertext to be transmitted of the other end, including: performing an XOR operation based on a random key and a post-operation key included in any group of keys of the multiple groups of keys of the other end to obtain a symmetric key for encrypting the information to be transmitted by the other end; and decrypting the ciphertext to be transmitted of the other end by a symmetric decryption algorithm based on the symmetric key obtained by the XOR operation to obtain the information to be transmitted of the other end.
[0064] Specifically, device A can transmit n groups of keys {(b 1 ,b 1 ′),(b 2 ,b 2 ′),…,(b n,b n ′)}, and determine how device B treats the transmitted information M B The encrypted symmetric key is Through the symmetric decryption algorithm Dec() and key B Decrypt the ciphertext Enc to be transmitted by device B keyB (M B ), get the information M to be transmitted of device B B =Dec keyB (Enc keyB (M B )).
[0065] Similarly, device B can transmit n sets of keys {(a 1 ,a 1 ′),(a 2 ,a′ 2 ),…,(a n ,a′ n )}, and determine how device A treats the transmitted information M A The encrypted symmetric key is Through the symmetric decryption algorithm Dec() and key A Decrypt the ciphertext Enc to be transmitted by device A keyA (M A ), get the information M to be transmitted of device A A =Dec keyA (Enc keyA (M A )).
[0066] At this point, both communicating parties have successfully exchanged their respective information to be transmitted with each other.
[0067] According to the technical solution of the embodiment of the present invention, both communicating parties use their own multiple groups of keys to encrypt the hash value of their own information to be transmitted and the hash value of the other party's random information to obtain multiple groups of ciphertext combinations; through the exchange and transmission of the multiple groups of ciphertext combinations of the communicating parties and the split exchange and transmission of the multiple groups of keys of the communicating parties, the communicating parties can verify the correctness of the keys transmitted by the other party; if the verification is successful, the communicating parties can determine the other party's information to be transmitted based on the received keys and the other party's ciphertext to be transmitted. This solution can realize the synchronous exchange of information to be transmitted, and during the information exchange process, the correctness of the key can be verified to ensure that either party can promptly discover the other party's fraudulent behavior or errors in the transmission process, avoid the consequence that one party benefits while the other party suffers, and thus ensure the fairness of information exchange.
[0068] Embodiment 2
[0069] Figure 2It is a flowchart of a method for synchronous information exchange provided according to embodiment 2 of the present invention. This embodiment is based on the above-mentioned embodiment 1, and further refines the method of exchanging respective multiple groups of keys with the opposite end by splitting and transmitting the keys, so that both communicating parties can verify the correctness of the key based on the received key and the received multiple groups of ciphertext combinations.
[0070] like Figure 2 As shown, the method includes:
[0071] S110, exchanging ciphertexts to be transmitted corresponding to respective information to be transmitted with the communicating counterpart through a symmetric encryption algorithm.
[0072] S120. Exchange hash values of respective random information with the opposite end through an asymmetric encryption algorithm.
[0073] S130. Exchanging respective multiple ciphertext combinations with the opposite end through a symmetric encryption algorithm. Each of the multiple ciphertext combinations is obtained by encrypting the hash value of its own information to be transmitted and the hash value of the other party's random information through each of the multiple keys. The multiple keys are generated based on the symmetric keys used to encrypt the information to be transmitted.
[0074] S141. Exchange one of each key in the respective multiple sets of keys with the opposite end through the oblivious transfer protocol as the first exchange, so that both communicating parties perform the first verification based on the received multiple sets of ciphertext combinations and the keys received in the first exchange.
[0075] In this step, device A can 1 ,a 1 ′),(a 2 ,a′ 2 ),…,(a n ,a′ n )} each set of keys (a i ,a i ′) respectively execute the 2-choose-1 oblivious transfer protocol transmission, so that device B selectively receives one of each set of keys (ai, ai′), such as receiving a i or receive a i ', but device A cannot determine which one device B has received. Eventually, device B can obtain half of the n keys of device A, that is, n keys.
[0076] Similarly, device B can 1 ,b 1 ′),(b 2 ,b 2 ′),…,(b n ,b nEach key (b i ,b i ′) respectively perform 2-choose-1 oblivious transfer protocol transmission, so that device A selectively receives one of each set of keys (bi,bi′), such as receiving b i Or receive b i ', but device B cannot determine which one device A has received. Eventually, device A can obtain half of the n keys of device B, that is, n keys.
[0077] At this point, both communicating parties have successfully obtained half of the other party's n sets of keys, and the two communicating parties can then perform the first verification based on the received half key and the other party's multiple sets of ciphertext combinations.
[0078] In one embodiment, a first verification is performed based on the received multiple ciphertext combinations and the key received in the first exchange, including: decrypting the corresponding ciphertexts in the received multiple ciphertext combinations by using the key received in the first exchange to obtain a first decryption result; in the first decryption result, if the result decrypted by using the random key in the key received in the first exchange is consistent, and the result decrypted by using the post-operation key in the key received in the first exchange is consistent, then the first verification is passed.
[0079] Device A can receive the key based on the first exchange, that is, {(b 1 ,b 1 ′),(b 2 ,b 2 ′),…,(b n ,b n ′)}, one of the keys (b i or b i ′), decrypt multiple ciphertext combinations using a symmetric decryption algorithm The corresponding ciphertext in the first decryption result is obtained. The decrypted ciphertext can be understood as b i For decryption b i ' is used for decryption In the first decryption result, if b i The decrypted results are all H(M B ), through b i The decrypted results are all H(m A ), the first verification passes.
[0080] Similarly, device B can receive the key based on the first exchange, that is, {(a 1 ,a 1 ′),(a 2 ,a′ 2 ),…,(an ,a′ n )}, each key (a i ,a i ′) of one of them (a i or a i ′), decrypt multiple ciphertext combinations using a symmetric decryption algorithm The corresponding ciphertext in the first decryption result is obtained. The decrypted ciphertext can be understood as a i For decryption a i ' is used for decryption In the first decryption result, if a i The decrypted results are all H(M A ), through a i The decrypted results are all H(m B ), the first verification passes.
[0081] During the first verification process, if one party finds that the key transmitted by the other party is incorrect, relevant measures can be taken, such as stopping the transmission.
[0082] S142. Exchanging respective multiple groups of keys with the opposite end according to binary bits through the asymmetric encryption algorithm as the second exchange, so that both communicating parties perform a second verification based on the key received by the second exchange and the key received by the first exchange, and perform a third verification based on the received multiple groups of ciphertext combinations and the key received by the second exchange.
[0083] In this step, device A can 1 ,a 1 ′),(a 2 ,a′ 2 ),…,(a n ,a′ n )} All are converted into binary bits, and the first binary bit after conversion is taken 1 a,a′ (0 or 1), through the asymmetric encryption algorithm Enc'() and the public key pk of device B B Encrypt the binary bit to get Will Transmitted to device B. Then device B can use asymmetric decryption algorithm Dec'() and private key sk B Decryption get
[0084] Similarly, device B can 1 ,b 1 ′),(b 2 ,b 2′),…,(b n ,b n ′)} are all converted to binary bit form, and the first binary bit after conversion is taken 1 b,b′ (0 or 1), through the asymmetric encryption algorithm Enc'() and the public key pk of device A A Encrypt the binary bit to get Will Transmitted to device A. Then device A can use asymmetric decryption algorithm Dec'() and private key sk A Decryption get
[0085] At this point, the communicating parties have successfully exchanged the first binary bit after the conversion of their respective multi-group keys. For the other binary bits after the conversion, they are exchanged in sequence in the same way until the two parties successfully exchange all the binary bits in their respective multi-group keys, which is the second exchange. During the entire process from the beginning to the end of the second exchange, the communicating parties can perform a second verification based on the key received in the second exchange and the key received in the first exchange.
[0086] In one embodiment, a second verification is performed based on the key received in the second exchange and the key received in the first exchange, including: during the second exchange, comparing the binary bits received in the second exchange with the binary bits of the key received in the first exchange, and skipping if there are no corresponding binary bits; if there are corresponding binary bits and the corresponding binary bits are consistent, the second verification is passed.
[0087] During the second exchange, device A compares each bit received from device B with the bit of the key received during the first exchange. 1 b,b ′ and (b 1 ,b 1 ′) in the first exchange of the received key (b 1 or b 1 ′) comparison, specifically: if the key received in the first exchange is b 1 , then bit 1 b,b′ With b 1 The first binary bit of the exchange is compared, and if they match, the next newly received binary bit is matched; if the key received in the first exchange is b 1 ′, then bit 1 b,b′ Does not participate in matching, but receives a fixed amount (can be b 1After the number of corresponding binary bits) binary bits, the newly received binary bit is compared with b 1 ′, if they match, proceed to match the next binary bit.
[0088] Similarly, during the second exchange, device B can compare the binary bits of device A received in the second exchange with the binary bits of the key of device A received in the first exchange in a similar manner.
[0089] During the second verification process, if there is always a key received in the second exchange in each key group that can match the key received in the first exchange in the key group, the second verification passes, otherwise the verification fails. If the second verification passes, the communicating parties can perform a third verification based on the key received in the second exchange and the other party's multiple ciphertext combinations.
[0090] In one embodiment, a third verification is performed based on the received multiple groups of ciphertext combinations and the key received in the second exchange, including: decrypting the ciphertext in the received multiple groups of ciphertext combinations that was not decrypted during the first verification through the key received in the second exchange, to obtain a second decryption result; in the second decryption result, if the first result decrypted by the random key in the key received in the second exchange is consistent with the second result decrypted by the calculated key in the key received in the second exchange, and the first result is consistent with the result decrypted by the random key in the first verification, and the second result is consistent with the result decrypted by the calculated key in the first verification, then the third verification is passed.
[0091] During the first verification, both communicating parties decrypted one of the ciphertexts in each of the other party's multiple ciphertext combinations for verification, and during the second exchange, both parties obtained all of the other party's multiple keys. Therefore, during the third verification, the ciphertext in each of the other party's ciphertext combinations that was not decrypted during the first verification can be decrypted based on all of the other party's multiple keys.
[0092] In the third verification, the two parties use the same method to decrypt the ciphertexts in each ciphertext combination that were not decrypted in the first verification, that is, they use the key corresponding to the ciphertext in each ciphertext combination that was not decrypted to obtain the second decryption result, which will not be described here. Then the ciphertext decrypted by bi and not decrypted is Then the ciphertext decrypted by bi′ and not decrypted is Then the ciphertext decrypted by ai and not decrypted is Then through a i ’Decryption.
[0093] In the second decryption result, if the first result obtained by decrypting the random key in the key received by the second exchange is consistent, and the first result is consistent with the result obtained by decrypting the random key during the first verification, such as the first verification and the third verification through a i The decrypted results are all H(M A ), through b i The decrypted results are all H(M B ); if the second result obtained by decrypting the calculated key in the received key through the second exchange is consistent, and the second result is consistent with the result obtained by decrypting the calculated key during the first verification, such as the first verification and the third verification through a i The decrypted results are all H(m B ), through b i The decrypted results are all H(m A ); the third verification is successful.
[0094] The first verification, the second verification and the third verification mentioned above are combined into key correctness verification. When all three verifications are passed, the ciphertext to be transmitted by the receiving party can be decrypted.
[0095] S150. When the verification is successful, determine the information to be transmitted of the other end based on the multiple groups of keys of the other end and the ciphertext to be transmitted of the other end.
[0096] According to the technical solution of the embodiment of the present invention, during the information exchange process, both communicating parties can verify the correctness of the other party's key multiple times without obtaining the other party's symmetric key used to encrypt the information to be transmitted in advance, that is, the other party's ciphertext to be transmitted cannot be decrypted during the verification process. Only when the verification is passed can the other party's ciphertext to be transmitted be decrypted, which can protect the interests of both communicating parties at the same time.
[0097] Embodiment 3
[0098] Figure 3 is a flow chart of a method for synchronously exchanging information provided according to Embodiment 3 of the present invention. Figure 3 The process shown is an exemplary description of the process in the above embodiments. Figure 3 As shown in the figure, the two communicating parties perform 11 steps in a peer-to-peer manner, as follows:
[0099] In the first step, both parties encrypt the information to be exchanged and send it to each other.
[0100] 1-A: Device A uses keyA and Enc() to encrypt M A Get Enc keyA (M A ) and then transmitted to device B;
[0101] 1-B: Device B uses keyB and Enc() to encrypt M B Get Enc keyB (M B ) and then transmitted to device A.
[0102] In the second step, both parties generate a public and private key pair of asymmetric encryption algorithm and send the public key to each other.
[0103] 2-A: Device A generates a public-private key pair (pk A ,sk A ), where the public key pk A Sent to device B, private key sk A Keep it properly;
[0104] 2-B: Device B generates a public-private key pair (pk B ,sk B ), where the public key pk B Sent to device A, private key sk B Store properly.
[0105] In the third step, both parties generate the random information required for the subsequent steps and send it to the other party after encryption.
[0106] 3-A: Device A uses Enc'() and public key pk B Encrypted random information m A The hash value H(m A )get Transmit to device B, so that device B uses Dec'() and private key sk B Decryption Get H(m A );
[0107] 3-B: Device B uses Enc'() and public key pk A Encrypted random information m B The hash value H(m B )get Transmit to device A, so that device A uses Dec'() and private key sk A Decryption Get H(m B ).
[0108] Step 4: Both parties use n sets of keys to generate n sets of ciphertext combinations and send them to each other.
[0109] 4-A: Device A generates n sets of keys {(a 1 ,a 1 ′),(a 2 ,a′ 2),…,(an,a′n)}, where a i is a random key, for a i The corresponding calculated key; combined with Enc() and a i Encryption H(M A )get Using a i ′ Encryption H(m B )get Get n groups of ciphertext combinations The obtained n groups of ciphertext combinations are transmitted to device B;
[0110] 4-B: Device B generates n sets of keys {(b 1 ,b 1 ′),(b 2 ,b 2 ′),…,(bn,bn′)}, where b i is a random key, for b i The corresponding calculated key; combined with Enc() and b i Encryption H(M B )get Using b i ′ Encryption H(m A )get Get n groups of ciphertext combinations The obtained n groups of ciphertext combinations are transmitted to device A.
[0111] Step 5: Both parties execute the 2-choose-1 oblivious transfer protocol for the n groups of keys, that is, the first exchange in the second embodiment.
[0112] 5-A: Device A has a key for each group (a i ,a i ′) respectively execute the 2-choose-1 oblivious transfer protocol transmission, so that device B selectively receives each group of keys (a i ,a i ')one of the;
[0113] 5-B: Device B has a key for each group (b i ,b i ′) respectively execute the 2-choose-1 oblivious transfer protocol transmission, so that device A selectively receives each set of keys (b i ,b i ')one of the.
[0114] Step 6. Both parties verify the n keys received in step 5 respectively.
[0115] 6-A: Device A performs the first verification in Embodiment 2;
[0116] 6-B: Device B performs the first verification in the second embodiment.
[0117] Step 7: Both parties transmit n groups of binary bits of the key, which is the second exchange in the second embodiment.
[0118] 7-A: Device A will {(a 1 ,a 1 ′),(a 2 ,a′ 2 ),…,(a n ,a′ n )} Convert all to binary bits and take the first binary bit after conversion 1 a,a′ Through Enc'() and device B's public key pk B Encrypted Will Transmitted to device B, device B based on Dec'() and private key sk B Decryption Get bits 1 a ,a′ ;
[0119] 7-B: Device B will {(b 1 ,b 1 ′),(b 2 ,b 2 ′),…,(b n ,b n ′)} Convert all to binary bits and take the first binary bit after conversion 1 b,b′ Through Enc'() and device A's public key pk A Encrypted Will Transmitted to device A, device A based on Dec'() and private key sk A Decryption Get bits 1 b ,b′ .
[0120] Step 8. Both parties continue to transmit n groups of binary bits of the key and perform real-time verification.
[0121] 8-AB: For the second, third, and other binary bits of the n groups of keys of device A and device B respectively, step 7 is repeated in sequence until all the binary bits of the n groups of keys of both parties are transmitted, that is, the second exchange is completed; and during the second exchange process, device A and device B each perform the second verification in embodiment 2.
[0122] Step 9: Both parties conduct complete verification of n sets of keys
[0123] 9-A: Device A performs the third verification in Example 2;
[0124] 9-B: Device B performs the third verification in the second embodiment.
[0125] Step 10. Both parties obtain the symmetric key for decrypting the ciphertext to be transmitted.
[0126] 10-A: Device A confirms
[0127] 10-B: Device B confirms
[0128] Step 11. Both parties obtain the information to be transmitted exchanged by the other party and verify it.
[0129] 11-A: Device A uses Dec() and key B Decrypt Enc keyB (M B ) to get M B , calculate M B The hash value of the result should be the same as the M obtained by decryption in the above step. B If the hash value is consistent, the verification is successful;
[0130] 11-B: Device B uses Dec() and key A Decrypt Enc keyA (M A ) to get M A , calculate M A The hash value of the result should be the same as the M obtained by decryption in the above step. A If the hash value is consistent, the verification is successful.
[0131] It should be noted that if the output length of the hash function used in the present invention is doubled (such as the output is changed from 256 bits to 512 bits), the key length of the symmetric encryption is doubled (such as a 128-bit key is changed to 256 bits), and lattice cryptography technology and an oblivious transfer protocol that meets security requirements (such as quantum oblivious transfer or a 2-in-1 oblivious transfer protocol based on post-quantum cryptography technology) are used at the same time, the present invention will have the ability to resist quantum computing attacks.
[0132] The technical solution of the embodiment of the present invention may have the following advantages:
[0133] 1. Both parties can achieve synchronous data exchange, that is, while one party obtains the other party's key, decrypts the other party's ciphertext and obtains plaintext information, the other party can also complete the same operation synchronously.
[0134] 2. The entire process verifies the keys transmitted by both parties three times to varying degrees, which can detect the correctness of the key transmission process in real time and promptly discover anomalies in the key transmission process.
[0135] 3. The n ciphertext combinations in the fourth step include both the hash value of the information to be transmitted by the party and the hash value of the random information randomly generated by the other party, which makes it easier for the other party to verify the validity of the key decryption and the integrity of the exchanged information.
[0136] 4. In the fifth and sixth steps, both parties can verify the validity of each other's key without obtaining the other party's key information in advance, which protects the interests of both parties. If A wants to break the agreement and deceive B in this process and pass this verification, due to the characteristics of 2-choose-1 inadvertent transmission, A needs to guess B's key selection every time and send the corresponding correct key, so the probability of A successfully deceiving B is 1 / 2 n , the larger the value of n, the lower the probability of A's success. When n=7, the probability of A's success is already less than 1%. If A guesses B's choice wrong once and sends the wrong key, B can discover A's deception through the verification process of step 6-B, so that B can take relevant measures to stop the damage to its own interests. At the same time, since Party B can only obtain any one of each set of keys, and there is no correlation between the sets of keys, it is impossible to restore the key for encrypting the exchanged information through XOR operations, thus protecting Party A's interests.
[0137] 5. In the process of transmitting n sets of complete keys in steps 7 and 8, both parties will follow the protocol instead of sending random binary bits. If A wants to break the protocol and deceive B in this process to pass this verification, A needs to accurately guess which of the sets of keys B has received, so the probability of A successfully deceiving B is also 1 / 2 n , the larger the value of n is, the lower the probability of A succeeding, so A will not take risks.
[0138] 6. The present invention is not limited to a specific hash algorithm, symmetric cryptographic algorithm, asymmetric cryptographic algorithm and oblivious transfer protocol, and is applicable to general security environments and environments that can resist quantum computing attacks. Select asymmetric cryptographic technology based on lattice cryptography (or other anti-quantum computing attacks), select quantum oblivious transfer or a 2-choice oblivious transfer protocol based on post-quantum cryptography technology, and double the output length of the hash algorithm (hash function) and the key length of the symmetric cryptographic algorithm, then the entire information exchange scheme will have the characteristics of resisting quantum computing attacks.
[0139] Embodiment 4
[0140] Figure 4 1 is a schematic diagram of the structure of an information synchronization exchange device provided according to Embodiment 4 of the present invention. This embodiment is applicable to the case of synchronously exchanging information with a communication peer. Figure 4 As shown, the specific structure of the device includes:
[0141] The first exchange module 41 is used to exchange the ciphertext to be transmitted corresponding to the respective information to be transmitted with the communication counterpart through a symmetric encryption algorithm;
[0142] A second exchange module 42, configured to exchange hash values of respective random information with the opposite end through an asymmetric encryption algorithm;
[0143] The third exchange module 43 is used to exchange multiple ciphertext combinations with the peer end through a symmetric encryption algorithm, wherein each of the multiple ciphertext combinations is obtained by encrypting the hash value of the information to be transmitted and the hash value of the random information of the other party through each of the multiple keys of the respective multiple keys; the multiple keys of the respective multiple keys are generated based on the symmetric keys used to encrypt the information to be transmitted;
[0144] A fourth exchange module 44 is used to exchange respective multiple groups of keys with the opposite end by means of splitting and transmitting the keys, so that both communicating parties can verify the correctness of the keys based on the received keys and the received multiple groups of ciphertext combinations;
[0145] The decryption module 45 is used to determine the information to be transmitted of the opposite end based on the multiple groups of keys of the opposite end and the ciphertext to be transmitted of the opposite end when the verification is passed.
[0146] The information synchronization exchange device provided in this embodiment exchanges the ciphertexts to be transmitted corresponding to the respective information to be transmitted with the communicating counterpart through a symmetric encryption algorithm through a first exchange module; exchanges the hash values of the respective random information with the communicating counterpart through an asymmetric encryption algorithm through a second exchange module; exchanges the respective multiple ciphertext combinations with the communicating counterpart through a symmetric encryption algorithm through a third exchange module, wherein the respective multiple ciphertext combinations are obtained by encrypting the hash values of their own information to be transmitted and the hash values of the other party's random information through each key in their respective multiple keys; the respective multiple keys are generated based on the respective symmetric keys for encrypting the information to be transmitted; the respective multiple keys are exchanged with the communicating counterpart through a key split transmission method through a fourth exchange module, so that both communicating parties verify the correctness of the key based on the received key and the received multiple ciphertext combinations; the decryption module determines the information to be transmitted of the communicating counterpart based on the multiple keys of the communicating counterpart and the ciphertext to be transmitted of the communicating counterpart when the verification is passed. This scheme can realize the synchronous exchange of information to be transmitted. During the information exchange process, the correctness of the key can be verified to ensure that either party can promptly discover the other party's fraudulent behavior or errors in the transmission process, avoiding the consequence that one party benefits while the other party suffers, thereby ensuring the fairness of information exchange.
[0147] Furthermore, each group of keys in the respective multiple groups of keys includes a random key and a calculated key, and the calculated key is the XOR operation result of the random key and the symmetric key used to encrypt the information to be transmitted;
[0148] The random key is used to encrypt the hash value of the information to be transmitted; the calculated key is used to encrypt the hash value of the other party's random information.
[0149] Furthermore, the fourth switching module 44 is specifically configured to:
[0150] exchanging one of each of the multiple sets of keys with the peer end through an oblivious transfer protocol as a first exchange, so that both communicating parties perform a first verification based on the received multiple sets of ciphertext combinations and the keys received in the first exchange;
[0151] Exchanging respective multiple groups of keys with the opposite end according to binary bits through the asymmetric encryption algorithm as the second exchange, so that both communicating parties perform a second verification based on the key received in the second exchange and the key received in the first exchange, and perform a third verification based on the received multiple groups of ciphertext combinations and the key received in the second exchange;
[0152] The key correctness verification includes the first verification, the second verification and the third verification.
[0153] Further, performing a first verification based on the received multiple ciphertext combinations and the key received in the first exchange includes:
[0154] Decrypting the corresponding ciphertexts in the received multiple ciphertext combinations using the key received in the first exchange to obtain a first decryption result;
[0155] In the first decryption result, if the result obtained by decrypting the random key in the key received in the first exchange is consistent, and the result obtained by decrypting the calculated key in the key received in the first exchange is consistent, the first verification is passed.
[0156] Further, performing a second verification based on the key received by the second exchange and the key received by the first exchange includes:
[0157] During the second exchange, the binary bits received in the second exchange are compared with the binary bits of the key received in the first exchange. If there is no corresponding binary bit, it is skipped. If there is a corresponding binary bit and the corresponding binary bits are consistent, the second verification is passed.
[0158] Further, performing a third verification based on the received multiple ciphertext combinations and the key received in the second exchange includes:
[0159] Decrypting the ciphertexts in the received multiple ciphertext combinations that have not been decrypted during the first verification by using the key received in the second exchange to obtain a second decryption result;
[0160] In the second decryption result, if the first result obtained by decrypting the random key in the key received in the second exchange is consistent with the second result obtained by decrypting the calculated key in the key received in the second exchange, and the first result is consistent with the result obtained by decrypting the random key during the first verification, and the second result is consistent with the result obtained by decrypting the calculated key during the first verification, then the third verification is passed.
[0161] Furthermore, the decryption module 45 is specifically used for:
[0162] Based on the random key and the calculated key included in any one of the multiple key groups of the peer end, an XOR operation is performed to obtain the symmetric key of the peer end for encrypting the information to be transmitted;
[0163] The symmetric key obtained by the symmetric decryption algorithm based on the XOR operation is used to decrypt the ciphertext to be transmitted at the other end to obtain the information to be transmitted at the other end.
[0164] The information synchronization exchange device provided in the embodiment of the present invention can execute the information synchronization exchange method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0165] Embodiment 5
[0166] Figure 5 Schematic diagram of the structure of the electronic device implementing the embodiment of the present invention. 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 may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, 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 required herein.
[0167] like Figure 5As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0168] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0169] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the information synchronization exchange method.
[0170] In some embodiments, the information exchange method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the information exchange method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the information exchange method in any other appropriate manner (for example, by means of firmware).
[0171] Various implementations of the systems and techniques described above herein 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), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including 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.
[0172] 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, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0173] 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 combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, 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.
[0174] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: 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 a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0175] The systems and techniques described herein may be implemented in a computing system that includes backend 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 frontend components (e.g., a user computer with a graphical user interface or a 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 backend components, middleware components, or frontend components. The components of the system may 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.
[0176] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0177] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0178] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for synchronous information exchange, characterized in that: include: Exchange the ciphertext to be transmitted corresponding to the respective information to be transmitted with the other end of the communication through a symmetric encryption algorithm; Exchanging hash values of respective random information with the peer end through an asymmetric encryption algorithm; Exchanging respective multiple ciphertext combinations with the opposite end through a symmetric encryption algorithm, wherein the respective multiple ciphertext combinations are obtained by encrypting the hash value of the information to be transmitted and the hash value of the random information of the other party through each of the multiple keys of the respective multiple keys; the multiple keys of the respective multiple keys are generated based on the symmetric keys used to encrypt the information to be transmitted; exchanging respective multiple groups of keys with the opposite end by means of key splitting transmission, so that both communicating parties can verify the correctness of the key based on the received key and the received multiple groups of ciphertext combinations; When the verification is successful, the information to be transmitted of the other end is determined based on the multiple groups of keys of the other end and the ciphertext to be transmitted of the other end.
2. The method according to claim 1, characterized in that Each group of keys in the respective multiple groups of keys includes a random key and a calculated key, wherein the calculated key is an XOR operation result of the random key and a symmetric key used to encrypt the information to be transmitted; The random key is used to encrypt the hash value of the information to be transmitted; the calculated key is used to encrypt the hash value of the other party's random information.
3. The method according to claim 1, characterized in that Exchanging respective multiple groups of keys with the opposite end by means of key splitting transmission, so that both communicating parties verify the correctness of the key based on the received key and the received multiple groups of ciphertext combinations, including: exchanging one of each of the multiple sets of keys with the peer end through an oblivious transfer protocol as a first exchange, so that both communicating parties perform a first verification based on the received multiple sets of ciphertext combinations and the keys received in the first exchange; Exchanging respective multiple groups of keys with the opposite end according to binary bits through the asymmetric encryption algorithm as the second exchange, so that both communicating parties perform a second verification based on the key received in the second exchange and the key received in the first exchange, and perform a third verification based on the received multiple groups of ciphertext combinations and the key received in the second exchange; The key correctness verification includes the first verification, the second verification and the third verification.
4. The method according to claim 3, characterized in that Performing a first verification based on the received multiple ciphertext combinations and the key received in the first exchange, including: Decrypting corresponding ciphertexts in the received multiple ciphertext combinations using the key received in the first exchange to obtain a first decryption result; In the first decryption result, if the result obtained by decrypting the random key in the key received in the first exchange is consistent, and the result obtained by decrypting the calculated key in the key received in the first exchange is consistent, the first verification is passed.
5. The method according to claim 3, characterized in that: Performing a second verification based on the key received by the second exchange and the key received by the first exchange, comprising: During the second exchange, the binary bits received in the second exchange are compared with the binary bits of the key received in the first exchange. If there is no corresponding binary bit, it is skipped. If there is a corresponding binary bit and the corresponding binary bits are consistent, the second verification is passed.
6. The method according to claim 3, characterized in that Performing a third verification based on the received multiple ciphertext combinations and the key received in the second exchange, including: Decrypting the ciphertexts in the received multiple ciphertext combinations that have not been decrypted during the first verification by using the key received in the second exchange to obtain a second decryption result; In the second decryption result, if the first result obtained by decrypting the random key in the key received in the second exchange is consistent with the second result obtained by decrypting the calculated key in the key received in the second exchange, and the first result is consistent with the result obtained by decrypting the random key during the first verification, and the second result is consistent with the result obtained by decrypting the calculated key during the first verification, then the third verification is passed.
7. The method according to claim 1, characterized in that Determining the information to be transmitted by the peer end based on the multiple groups of keys of the peer end and the ciphertext to be transmitted by the peer end includes: Based on the random key and the calculated key included in any one of the multiple key groups of the peer end, an XOR operation is performed to obtain the symmetric key of the peer end for encrypting the information to be transmitted; The symmetric key obtained by the symmetric decryption algorithm based on the XOR operation is used to decrypt the ciphertext to be transmitted at the other end to obtain the information to be transmitted at the other end.
8. An information synchronous exchange device, characterized in that: include: A first exchange module, used to exchange ciphertexts to be transmitted corresponding to respective information to be transmitted with a communication counterpart through a symmetric encryption algorithm; A second exchange module, used to exchange hash values of respective random information with the opposite end through an asymmetric encryption algorithm; A third exchange module is used to exchange respective multiple sets of ciphertext combinations with the opposite end through a symmetric encryption algorithm, wherein the respective multiple sets of ciphertext combinations are obtained by encrypting the hash value of the information to be transmitted and the hash value of the random information of the other party through each set of keys in the respective multiple sets of keys; the respective multiple sets of keys are generated based on the respective symmetric keys for encrypting the information to be transmitted; A fourth exchange module, used for exchanging respective multiple groups of keys with the opposite end by means of splitting and transmitting the keys, so that both communicating parties can verify the correctness of the keys based on the received keys and the received multiple groups of ciphertext combinations; The decryption module is used to determine the information to be transmitted by the other end based on the multiple groups of keys of the other end and the ciphertext to be transmitted by the other end when the verification is passed.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable 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 perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Data processing method and device and storage medium
CN110795749A
Session key negotiation method
CN113612610A
Data verification method and system, data providing end and data verification end
CN114429347A
Unmanned aerial vehicle flight control and communication data encryption method and system based on quantum key
CN118659879A
Casual transmission method, system and device based on secret sharing and medium
CN119071089A