PSI method, device, communication equipment and storage medium resistant to quantum attack

By using QKD hardware devices to pre-prepare key pairs for encryption and decryption in the PSI protocol, the problem of the traditional PSI protocol being unable to resist quantum attacks in a quantum computing environment is solved, and efficient privacy set intersection and data comparison are achieved, improving the Quantum-resistant properties and compatibility of the protocol.

CN118400096BActive Publication Date: 2024-10-25成方金融科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410852945.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-25
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

The traditional PSI protocol does not have the characteristics of resisting quantum attacks and cannot effectively protect privacy in a quantum computing environment.

Method used

A pair of key pairs prepared in advance based on QKD hardware devices are used for encryption and decryption. By randomly generating strings and performing XOR operations, the process of intersection of privacy sets is realized to ensure the security and efficiency of data comparison.

Benefits of technology

It improves the PSI protocol's resistance to quantum attacks, improves overall efficiency and compatibility, and ensures data privacy protection in a quantum computing environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118400096B_ABST
    Figure CN118400096B_ABST
Patent Text Reader

Abstract

The present invention provides a quantum attack-resistant PSI method, device, communication equipment and storage medium, which relate to the field of privacy computing technology. The method comprises: a first communication device randomly generates two character strings for each bit of first data; based on a first encryption key and a first mask sent by a second communication device, the two character strings corresponding to the first bit are respectively encrypted and sent to the second communication device, and the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on a QKD hardware device; after encrypting the two character strings corresponding to each bit of the first data and sending them to the second communication device, an XOR result of the first character string sent by the second communication device is received; the XOR result of the first character string is compared with the XOR result of the second character string obtained by local operation of the first communication device to determine whether the first data is the same as the second data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of privacy computing technology, and in particular to a PSI method, device, communication equipment and storage medium that are resistant to quantum attacks. Background Art

[0002] With the rapid development and popularization of information technology, information security has received more and more attention because it involves almost all aspects of modern society. Cryptography technology is the foundation, core and support of information security, and its security is the bottom line to be adhered to in the information security architecture. However, with the rapid development of quantum computers, some classic quantum algorithms, such as Shor's algorithm, can solve complex mathematical problems such as large integer decomposition and discrete logarithm solution in polynomial time, so it can quickly crack widely used public key cryptography such as RSA, ECC, DSA, etc., which poses a security threat to algorithms built on public key cryptography. The privacy-preserving set intersection (PSI) protocol is a specific problem of privacy computing, that is, it allows participants to input private sets and jointly calculate the intersection of private sets without leaking any information other than the intersection. Usually, PSI can be implemented based on the oblivious transfer (OT) basic operator, and OT is an operator built on the public key cryptography system, which makes the traditional PSI not resistant to quantum attacks. Summary of the invention

[0003] The present invention provides a quantum attack-resistant PSI method, device, communication equipment and storage medium, so as to solve the defect that the traditional PSI is not quantum attack-resistant and realize the quantum attack-resistant PSI protocol.

[0004] The present invention provides a PSI method for resisting quantum attacks, which is applied to a first communication device and includes the following steps:

[0005] For first data to be compared by the first communication device, randomly generate two character strings for each bit of the first data;

[0006] For a first bit, two character strings corresponding to the first bit are encrypted based on a first encryption key and a first mask sent by a second communication device, and then sent to the second communication device, so that the second communication device selects an encrypted character string from the two encrypted character strings sent by the first communication device for decryption based on a first decryption key, a value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, and the character strings obtained by decrypting each bit are subjected to an XOR operation to obtain a first character string XOR result; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on a QKD hardware device;

[0007] After encrypting two character strings corresponding to each bit of the first data and sending them to the second communication device, receiving an XOR result of the first character string sent by the second communication device;

[0008] The first character string XOR result is compared with the second character string XOR result obtained by local operation of the first communication device, and whether the first data is the same as the second data is determined according to the comparison result.

[0009] According to a quantum attack-resistant PSI method provided by the present invention, the two character strings corresponding to the first bit are encrypted based on the first encryption key and the first mask sent by the second communication device, respectively, including:

[0010] Based on the first mask, determining two keys from the first encryption key for encrypting the two character strings respectively;

[0011] The two character strings are encrypted respectively using the keys corresponding to the two character strings.

[0012] According to a quantum attack-resistant PSI method provided by the present invention, the first mask is equal to the XOR result of c and b, where c represents the value of the second data corresponding to the first bit, and b represents an option, and the value of the option is 0 or 1.

[0013] The present invention also provides a PSI method resistant to quantum attacks, which is applied to a second communication device and comprises the following steps:

[0014] receiving two encrypted character strings sent by the first communication device for the first bit; the two encrypted character strings are generated by the first communication device randomly generating two character strings for each bit of the first data to be compared by the first communication device, and then encrypting the two character strings corresponding to the first bit based on the first encryption key and the first mask sent by the second communication device and sending them to the second communication device;

[0015] Based on a first decryption key, a value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, one encrypted string is selected from two encrypted strings sent by the first communication device for decryption; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on a QKD hardware device;

[0016] After the first communication device encrypts two character strings corresponding to each bit of the first data and sends them to the second communication device, the character strings obtained by decrypting each bit are subjected to an XOR operation to obtain an XOR result of the first character string;

[0017] The first string XOR result is sent to the first communication device, so that the first communication device compares the first string XOR result with the second string XOR result obtained by local calculation of the first communication device, and determines whether the first data is the same as the second data according to the comparison result.

[0018] According to a quantum attack-resistant PSI method provided by the present invention, based on a first decryption key, a value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, an encrypted string is selected from two encrypted strings sent by the first communication device for decryption, including:

[0019] Selecting one encrypted string from two encrypted strings sent by the first communication device based on the value of the second data corresponding to the first bit, and determining a key for decrypting the selected encrypted string from the first decryption key based on the value of the second data corresponding to the first bit and the first mask;

[0020] The selected encrypted string is decrypted using the determined key for decrypting the selected encrypted string.

[0021] According to a quantum attack-resistant PSI method provided by the present invention, the first mask is equal to the XOR result of c and b, where c represents the value of the second data corresponding to the first bit, and b represents an option, and the value of the option is 0 or 1.

[0022] The present invention also provides a PSI device resistant to quantum attacks, which is applied to a first communication device and includes the following modules:

[0023] A generating module, configured to randomly generate two character strings for each bit of the first data to be compared by the first communication device;

[0024] An encryption module is used for encrypting two strings corresponding to a first bit position based on a first encryption key and a first mask sent by a second communication device, and then sending the encrypted strings to the second communication device, so that the second communication device selects an encrypted string from the two encrypted strings sent by the first communication device for decryption based on a first decryption key, a value of the second data to be compared by the second communication device corresponding to the first bit position, and the first mask, and the strings obtained by decrypting each bit position are subjected to an XOR operation to obtain a first string XOR result; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on a QKD hardware device;

[0025] A first receiving module, configured to encrypt two strings corresponding to each bit of the first data and send them to the second communication device, and then receive an XOR result of the first string sent by the second communication device;

[0026] The comparison module is used to compare the XOR result of the first character string with the XOR result of the second character string obtained by local operation of the first communication device, and determine whether the first data is the same as the second data according to the comparison result.

[0027] The present invention also provides a PSI device resistant to quantum attacks, which is applied to a second communication device and includes the following modules:

[0028] A second receiving module is used to receive two encrypted character strings sent by the first communication device for the first bit; the two encrypted character strings are sent to the second communication device after the first communication device randomly generates two character strings for each bit of the first data to be compared by the first communication device, and the two character strings corresponding to the first bit are encrypted based on the first encryption key and the first mask sent by the second communication device respectively;

[0029] a decryption module, configured to select an encrypted string from two encrypted strings sent by the first communication device for decryption based on a first decryption key, a value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on a QKD hardware device;

[0030] a calculation module, configured to, after the first communication device encrypts two character strings corresponding to each bit of the first data and sends the two character strings to the second communication device, perform an XOR operation on the character strings obtained by decrypting each bit to obtain an XOR result of a first character string;

[0031] The sending module is used to send the first string XOR result to the first communication device, so that the first communication device compares the first string XOR result with the second string XOR result obtained by local calculation of the first communication device, and determines whether the first data is the same as the second data according to the comparison result.

[0032] The present invention also provides a communication device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the PSI method for resisting quantum attacks as described in any one of the above is implemented.

[0033] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described PSI methods for resisting quantum attacks.

[0034] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned PSI methods for resisting quantum attacks.

[0035] The quantum-attack-resistant PSI method, apparatus, communication equipment and storage medium provided by the present invention propose a soft-hard PSI protocol based on quantum key distribution, which has quantum-resistant characteristics on the basis of ensuring the basic functions of the PSI protocol, and improves the overall efficiency of the PSI protocol by pre-preparing key pairs based on QKD hardware equipment for real-time data comparison in the online stage. At the same time, the key generation of the QKD hardware and the upper-layer software encryption and decryption are decoupled, thereby improving the compatibility and scalability of the protocol. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0037] Figure 1 This is one of the flow charts of the PSI method for resisting quantum attacks provided by the present invention.

[0038] Figure 2 This is a diagram of the PSI protocol system architecture that is resistant to quantum attacks provided by the present invention.

[0039] Figure 3 This is the second flow chart of the PSI method for resisting quantum attacks provided by the present invention.

[0040] Figure 4 This is one of the structural schematic diagrams of the quantum attack-resistant PSI device provided by the present invention.

[0041] Figure 5 This is the second structural schematic diagram of the PSI device resistant to quantum attack provided by the present invention.

[0042] Figure 6 It is a schematic diagram of the physical structure of the communication device provided by the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are 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 are within the scope of protection of the present invention.

[0044] Combine the following Figure 1-Figure 6 Embodiments of the present invention are described.

[0045] Figure 1 is one of the flow charts of the PSI method for resisting quantum attack provided by the present invention, which is applied to a first communication device, such as Figure 1 As shown, the method includes step 101, step 102, step 103 and step 104.

[0046] Step 101: For first data to be compared by a first communication device, two character strings are randomly generated for each bit of the first data.

[0047] Step 102: For the first bit, two character strings corresponding to the first bit are encrypted based on the first encryption key and the first mask sent by the second communication device, and then sent to the second communication device, so that the second communication device can select an encrypted character string from the two encrypted character strings sent by the first communication device for decryption based on the first decryption key, the value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, and the character strings obtained by decrypting each bit are subjected to an XOR operation to obtain a first character string XOR result; wherein the first encryption key and the first decryption key are a pair of key pairs prepared in advance based on the QKD hardware device.

[0048] Step 103: After encrypting the two character strings corresponding to each bit of the first data and sending them to the second communication device, receive the XOR result of the first character string sent by the second communication device.

[0049] Step 104: compare the XOR result of the first character string with the XOR result of the second character string obtained by local operation of the first communication device, and determine whether the first data and the second data are the same according to the comparison result.

[0050] Specifically, the present invention provides a PSI protocol based on quantum key distribution (QKD), which has the characteristics of resisting quantum attacks and ensuring security under the impact of the rapid development of quantum computing. The first communication device and the second communication device are communication devices of both parties of the PSI protocol.

[0051] The goal of the PSI protocol is to find the intersection of the data sets at both ends (the first communication device and the second communication device) under the premise of protecting privacy. This problem can be simplified to how to compare whether two elements are the same without revealing the specific two elements in the two data sets. For example: Assume that the first communication device has a data set , the second communication device has a data set The privacy-preserving set intersection problem can be simplified to a privacy comparison problem, that is, comparing whether two elements are the same without revealing the specific two elements in the two data sets. For example, and Are they the same?

[0052] The first data is any data to be compared on the first communication device side, and the second data is any data to be compared on the second communication device side. For example, the first data is , the second data is , compared with the PSI method provided by the present invention and Are they the same?

[0053] The first data and the second data are both expressed in binary, and the number of binary bits of the two is equal. For example, the first data is , binary representation is 001, the second data is , which is represented as 101 in binary.

[0054] When performing privacy comparison, the first communication device first randomly generates two strings for each bit of the first data. The two strings can be understood as two strings corresponding to 0 and 1 respectively. For example, the first communication device randomly samples a string of k bits in length (k is an integer greater than 1) for 0 and 1 on each bit. For ease of description, the two strings can be represented as (corresponding to 0) and (corresponding to 1).

[0055] Then, the first communication device interacts with the second communication device, and the first communication device interacts with the second communication device once for each bit. The process of one interaction is described by taking the first bit (which can be any bit) as an example: the second communication device sends a first mask to the first communication device, and the first communication device encrypts two strings corresponding to the first bit based on the first encryption key and the first mask, and sends them to the second communication device; the second communication device selects an encrypted string from the two encrypted strings sent by the first communication device for decryption based on the first decryption key, the value of the second data corresponding to the first bit, and the first mask.

[0056] Among them, the first mask, the first encryption key, and the first decryption key refer to the mask, encryption key, and decryption key corresponding to the first bit, that is, different masks, encryption keys, and decryption keys can be used for different bits, and one interaction will consume a pair of key pairs (encryption key and decryption key).

[0057] Optionally, the first mask is equal to the XOR result of c and b, where c represents the value of the second data corresponding to the first bit, and b represents an option, and the value of the option is 0 or 1.

[0058] For example, assuming that the binary representation of the second data is 101, and the first bit is the first bit, then the value of the second data corresponding to the first bit is c=1. If the second communication device randomly selects b=0, then , Represents the exclusive-or operation.

[0059] Optionally, encrypting two character strings corresponding to the first bit respectively based on the first encryption key and the first mask sent by the second communication device includes:

[0060] Based on the first mask, determining two keys for encrypting the two character strings respectively from the first encryption key;

[0061] Encrypt the two strings separately using their corresponding keys.

[0062] For example, the first encryption key includes two keys and , which of the two keys is used? Encryption, which is right? Encryption can be determined based on the first mask. In some embodiments, right Encryption, using right encryption, Indicates XOR operation. Taking mask=1 as an example, use right Encryption, using right encryption.

[0063] Optionally, based on the first decryption key, the value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, selecting an encrypted string from two encrypted strings sent by the first communication device for decryption includes:

[0064] Selecting an encrypted string from two encrypted strings sent by the first communication device based on the value of the second data corresponding to the first bit, and determining a key for decrypting the selected encrypted string from the first decryption key based on the value of the second data corresponding to the first bit and the first mask;

[0065] The selected encrypted string is decrypted using the determined key for decrypting the selected encrypted string.

[0066] For example, the first communication device uses and For two strings and Encryption, two encrypted strings (Indicates the use of right Encrypted )、 (Indicates the use of right Encrypted ), the first communication device sends the two encrypted strings to the second communication device, and the second communication device selects an encrypted string from the two encrypted strings sent by the first communication device based on the value of the second data corresponding to the first bit. Which key is used to decrypt the selected encrypted string can be determined based on the value of the second data corresponding to the first bit and the first mask.

[0067] In some embodiments, the first decryption key includes two keys: and , the second communication device is based on (Indicates the use of right Decrypted ) to select the encrypted string and decrypt it to get the original string. For example, assuming c=1, mask=1, then select and use Decrypted .

[0068] After the second communication device decrypts each bit to obtain the corresponding string, it then performs an XOR operation on the string obtained by decrypting each bit to obtain the XOR result of the first string. For example, assuming that the binary representation of the second data is 101, the strings obtained by decrypting each bit are ,calculate , that is, get the first string XOR result ( ).

[0069] The first communication device locally selects corresponding character strings according to the values ​​of the first data corresponding to each bit, and performs an XOR operation on these character strings to obtain the XOR result of the second character string. For example, assuming that the binary representation of the first data is 001, the selected character strings are ,calculate , that is, get the second string XOR result ( ).

[0070] By comparing the XOR result of the first string with the XOR result of the second string, it is possible to determine whether the first data and the second data are the same. If the XOR result of the first string is the same as the XOR result of the second string, the first data and the second data are the same; if the XOR result of the first string is different from the XOR result of the second string, the first data and the second data are different.

[0071] In the present invention, the encryption key and decryption key corresponding to each bit are a pair of key pairs pre-prepared based on the QKD hardware device. The above privacy comparison process can be called the online stage, and the key preparation process can be called the offline stage. The offline stage is asynchronous with the online stage. The key pair is pre-prepared in the offline stage, and the online stage uses the key pair generated in the offline stage to perform real-time data comparison. This implementation method improves the overall efficiency of the PSI protocol, and decouples the key generation of the QKD hardware and the encryption and decryption of the upper-layer software, thereby improving the compatibility and scalability of the protocol.

[0072] Figure 2 This is the PSI protocol system architecture diagram for anti-quantum attack provided by the present invention. Figure 2 The system architecture shown in FIG. 1 illustrates the process of preparing the key pair in the offline phase. Figure 2 As shown in the figure, user A and user B represent the first communication device and the second communication device respectively. QKD hardware devices are deployed on both user A and user B sides. The QKD hardware devices are controlled through the PSI offline application. The keys are generated through the PSI offline application and added to the key pool for use in the online stage. The online stage uses traditional channel interaction, and QKD hardware devices communicate through quantum channels.

[0073] First, user A randomly generates a key (a binary string of length n, where n is an integer greater than 1) and polarization basis (Polarization base is a set of polarization bases, including n polarization bases, which correspond one to one with each bit of the key x). Modulate the photon signal and send the photon signal to user B to transmit the key x. Table 1 is a photon signal modulation table corresponding to different polarization bases. In the table, represents the horizontal and vertical polarization basis, represents the diagonal polarization basis, Indicates the polarization direction. The specific meanings of the symbols in the table can be found in the existing technical information and will not be elaborated here.

[0074] Table 1 Photon signal modulation table corresponding to different polarization bases

[0075]

[0076] Then, user B randomly generates a polarization basis Used to receive the photon signal (polarization based) sent by user A is a set of polarization bases, including n polarization bases. Each single-photon signal selects one polarization base for reception). The key is converted bit by bit according to the single-photon polarization state measurement to obtain the key. From the corresponding relationship of the conversion, it can be seen that when user A and user B select the same polarization base, the correct key bit can be measured. When user A and user B select different polarization bases, incorrect key bits will be measured. After a round of receiving measurement, B generates the key Table 2 is a table of received bits measured by different polarization bases at the receiving end. The specific meanings of the symbols in Table 2 are the same as those in Table 1 and will not be repeated here.

[0077] Table 2 Received bit table measured by different polarization bases at the receiving end

[0078]

[0079] Then, user A transmits his selected polarization base Send it to user B, and user B compares it and Can filter out Zhongyu Corresponding to the subsets with the same bit position and the same polarization basis, two sets are determined based on the screening results and , and Respectively and The polarization basis corresponding to bit position i in the graph is randomly selected by user B. , if b=0, and , if b=1, and User B uses the traditional channel to and Sent to user A.

[0080] Then, user A and The bit position of the marker is extracted from the key x and ,in (Extract from key x The bit value corresponding to the marked bit position is taken as ), (Extract from key x The bit value corresponding to the marked bit position is taken as ). User B also and The bit position of the mark is from the key Extract from and ,in (Indicates from the key Extract The bit value corresponding to the marked bit position is taken as ), (Indicates from the key Extract The bit value corresponding to the marked bit position is taken as ), and save the value of b selected this time. Thus, a pair of key pairs is prepared: encryption key ( , ) and the decryption key ( , ).

[0081] For user B, since the polarization basis is randomly generated , each bit is related to the polarization basis of user A The same probability is 1 / 2, which also means that the key generated by user B is 1 / 2 are correct, both user A and user B are correct. and Extracting the key can ensure that user B can correctly decrypt the information he wants to obtain. For example, suppose user A has information and , respectively use and Encryption ( , And send it to user B. If user B chooses b=0 (the value of b corresponds to the information index that user B wants to obtain), then , then the extracted and If they are the same, they can be decrypted correctly ,get , similarly, if b=1, then , then the extracted and If they are the same, they can be decrypted correctly ,get .

[0082] User A and user B repeat the above steps of preparing a key pair, and thus can prepare multiple key pairs for use in the online stage.

[0083] The following is an example of the real-time data privacy comparison process between user A and user B during the online phase.

[0084] Assume that user A has The binary representation of is 001, and user B has The binary representation of is 101, and the privacy comparison process is as follows.

[0085] (1) User A randomly samples a string of k bits long from 0 and 1 at each bit position, let .

[0086] (2) User A and User B interact with each other. User B The current value interacts with A, and selects the value sampled by user A at the current position without exposing the specific value of the current position. , that is, if the current bit is c=1, select , otherwise select To achieve this effect, this interaction consumes a key pair generated in the offline phase, assuming this key pair is A ( , ), B( , ) and B randomly selected b=0 when generating (i.e. ), user B calculates And send it to user A, who encrypts it using his own key pair , And send it to user B, who uses the b selected when the key pair was generated as the subscript to decrypt the string to be selected, that is, .

[0087] (3) User A and User B repeat steps (1) and (2). User B The specific value of each bit of , interacts with user A and obtains the string generated by the sampling of the corresponding bit, because The binary representation of is 101, so the corresponding string is ,calculate Then send it to user A.

[0088] (4) User A uses The value of each bit is selected, and the string corresponding to each bit is compressed using the same rules. In this example, The binary representation of is 001, so the selected strings are , use the same rules for compression , compare and , the same ,otherwise .

[0089] The quantum attack-resistant PSI method provided by the present invention proposes a soft-hard PSI protocol based on quantum key distribution, which has the characteristics of quantum resistance on the basis of ensuring the basic functions of the PSI protocol, and improves the overall efficiency of the PSI protocol by pre-preparing key pairs based on QKD hardware devices for real-time data comparison in the online stage. At the same time, the key generation of QKD hardware and the encryption and decryption of upper-layer software are decoupled, thereby improving the compatibility and scalability of the protocol.

[0090] Figure 3 2 is a flow chart of the PSI method for resisting quantum attack provided by the present invention, which is applied to a second communication device, such as Figure 3 As shown, the method includes step 301, step 302, step 303 and step 304.

[0091] Step 301, receiving two encrypted strings sent by the first communication device for the first bit; the two encrypted strings are sent to the second communication device after the first communication device randomly generates two strings for each bit of the first data to be compared by the first communication device, and then encrypts the two strings corresponding to the first bit based on the first encryption key and the first mask sent by the second communication device.

[0092] Step 302: Based on the first decryption key, the value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, select an encrypted string from the two encrypted strings sent by the first communication device for decryption; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on the QKD hardware device.

[0093] Step 303: After the first communication device encrypts two character strings corresponding to each bit of the first data and sends them to the second communication device, the character strings obtained by decrypting each bit are subjected to an XOR operation to obtain a first character string XOR result.

[0094] Step 304: Send the first string XOR result to the first communication device, so that the first communication device compares the first string XOR result with the second string XOR result obtained by local calculation of the first communication device, and determines whether the first data and the second data are the same according to the comparison result.

[0095] Optionally, based on the first decryption key, the value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, selecting an encrypted string from two encrypted strings sent by the first communication device for decryption includes:

[0096] Selecting an encrypted string from two encrypted strings sent by the first communication device based on the value of the second data corresponding to the first bit, and determining a key for decrypting the selected encrypted string from the first decryption key based on the value of the second data corresponding to the first bit and the first mask;

[0097] The selected encrypted string is decrypted using the determined key for decrypting the selected encrypted string.

[0098] Optionally, the first mask is equal to the XOR result of c and b, where c represents the value of the second data corresponding to the first bit, and b represents an option, and the value of the option is 0 or 1.

[0099] The methods provided in various embodiments of the present invention are based on the same inventive concept, so the implementation of the methods on the first communication device side and the second communication device side can refer to each other, and the repeated parts will not be repeated.

[0100] The following is a description of the PSI device that is resistant to quantum attacks provided by the present invention. The PSI device that is resistant to quantum attacks described below and the PSI method that is resistant to quantum attacks described above can be referenced to each other.

[0101] Figure 4 is one of the structural schematic diagrams of the PSI device for resisting quantum attack provided by the present invention, and the device is applied to a first communication device, such as Figure 4 As shown, the device comprises:

[0102] A generating module 410 is configured to randomly generate two character strings for each bit of the first data to be compared by the first communication device;

[0103] The encryption module 420 is used to encrypt two strings corresponding to the first bit based on the first encryption key and the first mask sent by the second communication device, and then send them to the second communication device, so that the second communication device selects an encrypted string from the two encrypted strings sent by the first communication device for decryption based on the first decryption key, the value of the second data to be compared by the second communication device corresponding to the first bit and the first mask, and the strings obtained by decrypting each bit are subjected to an XOR operation to obtain a first string XOR result; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on the QKD hardware device;

[0104] A first receiving module 430 is configured to encrypt two strings corresponding to each bit of the first data and send them to the second communication device, and then receive an XOR result of the first string sent by the second communication device;

[0105] The comparison module 440 is used to compare the XOR result of the first character string with the XOR result of the second character string obtained by local operation of the first communication device, and determine whether the first data and the second data are the same according to the comparison result.

[0106] Optionally, encrypting two character strings corresponding to the first bit respectively based on the first encryption key and the first mask sent by the second communication device includes:

[0107] Based on the first mask, determining two keys for encrypting the two character strings respectively from the first encryption key;

[0108] Encrypt the two strings separately using their corresponding keys.

[0109] Optionally, the first mask is equal to the XOR result of c and b, where c represents the value of the second data corresponding to the first bit, and b represents an option, and the value of the option is 0 or 1.

[0110] Figure 5 2 is a schematic diagram of the structure of the PSI device for resisting quantum attack provided by the present invention, which is applied to the second communication device, such as Figure 5 As shown, the device comprises:

[0111] The second receiving module 510 is used to receive two encrypted character strings sent by the first communication device for the first bit; the two encrypted character strings are sent to the second communication device after the first communication device randomly generates two character strings for each bit of the first data to be compared by the first communication device, and the two character strings corresponding to the first bit are encrypted based on the first encryption key and the first mask sent by the second communication device.

[0112] A decryption module 520 is used to select an encrypted string from two encrypted strings sent by the first communication device for decryption based on a first decryption key, a value of a first bit corresponding to the second data to be compared by the second communication device, and a first mask; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on the QKD hardware device;

[0113] The operation module 530 is used to obtain a first string XOR result by performing an XOR operation on the strings obtained by decrypting each bit after the first communication device encrypts two strings corresponding to each bit of the first data and sends the encrypted strings to the second communication device;

[0114] The sending module 540 is used to send the first string XOR result to the first communication device, so that the first communication device compares the first string XOR result with the second string XOR result obtained by the first communication device locally, and determines whether the first data and the second data are the same according to the comparison result.

[0115] Optionally, based on the first decryption key, the value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, selecting an encrypted string from two encrypted strings sent by the first communication device for decryption includes:

[0116] Selecting an encrypted string from two encrypted strings sent by the first communication device based on the value of the second data corresponding to the first bit, and determining a key for decrypting the selected encrypted string from the first decryption key based on the value of the second data corresponding to the first bit and the first mask;

[0117] The selected encrypted string is decrypted using the determined key for decrypting the selected encrypted string.

[0118] Optionally, the first mask is equal to the XOR result of c and b, where c represents the value of the second data corresponding to the first bit, and b represents an option, and the value of the option is 0 or 1.

[0119] Figure 6 is a schematic diagram of the physical structure of the communication device provided by the present invention, such as Figure 6 As shown, the communication device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute the PSI method for resisting quantum attacks described in the above embodiments.

[0120] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0121] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the PSI method against quantum attacks described in the above embodiments.

[0122] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the PSI method against quantum attacks described in the above embodiments.

[0123] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0124] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A PSI method resistant to quantum attacks, characterized in that: Applied to a first communication device, comprising: For first data to be compared by the first communication device, randomly generate two character strings for each bit of the first data; For a first bit, two character strings corresponding to the first bit are encrypted based on a first encryption key and a first mask sent by a second communication device, and then sent to the second communication device, so that the second communication device selects an encrypted character string from the two encrypted character strings sent by the first communication device for decryption based on a first decryption key, a value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, and the character strings obtained by decrypting each bit are subjected to an XOR operation to obtain a first character string XOR result; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on a QKD hardware device; After encrypting two character strings corresponding to each bit of the first data and sending them to the second communication device, receiving an XOR result of the first character string sent by the second communication device; Compare the XOR result of the first character string with the XOR result of the second character string obtained by local operation of the first communication device, and determine whether the first data is the same as the second data according to the comparison result; The step of encrypting two character strings corresponding to the first bit positions based on the first encryption key and the first mask sent by the second communication device respectively includes: Based on the first mask, determining two keys from the first encryption key for encrypting the two character strings respectively; The two character strings are encrypted respectively using the keys corresponding to the two character strings.

2. The quantum attack-resistant PSI method according to claim 1, characterized in that: The first mask is equal to the XOR result of c and b, where c represents the value of the second data corresponding to the first bit, and b represents an option, and the value of the option is 0 or 1.

3. A PSI method resistant to quantum attacks, characterized in that: Applied to a second communication device, comprising: receiving two encrypted character strings sent by the first communication device for the first bit; the two encrypted character strings are generated by the first communication device randomly generating two character strings for each bit of the first data to be compared by the first communication device, and then encrypting the two character strings corresponding to the first bit based on the first encryption key and the first mask sent by the second communication device and sending them to the second communication device; Based on a first decryption key, a value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, one encrypted string is selected from two encrypted strings sent by the first communication device for decryption; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on a QKD hardware device; After the first communication device encrypts two character strings corresponding to each bit of the first data and sends them to the second communication device, the character strings obtained by decrypting each bit are subjected to an XOR operation to obtain an XOR result of the first character string; Sending the first string XOR result to the first communication device, so that the first communication device compares the first string XOR result with the second string XOR result obtained by local operation of the first communication device, and determining whether the first data is the same as the second data according to the comparison result; The method of selecting an encrypted string from two encrypted strings sent by the first communication device for decryption based on the first decryption key, the value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, comprises: Selecting one encrypted string from two encrypted strings sent by the first communication device based on the value of the second data corresponding to the first bit, and determining a key for decrypting the selected encrypted string from the first decryption key based on the value of the second data corresponding to the first bit and the first mask; The selected encrypted string is decrypted using the determined key for decrypting the selected encrypted string.

4. The quantum attack-resistant PSI method according to claim 3, characterized in that: The first mask is equal to the XOR result of c and b, where c represents the value of the second data corresponding to the first bit, and b represents an option, and the value of the option is 0 or 1.

5. A PSI device resistant to quantum attacks, characterized in that: Applied to a first communication device, comprising: A generating module, configured to randomly generate two character strings for each bit of the first data to be compared by the first communication device; An encryption module is used for encrypting two strings corresponding to a first bit position based on a first encryption key and a first mask sent by a second communication device, and then sending the encrypted strings to the second communication device, so that the second communication device selects an encrypted string from the two encrypted strings sent by the first communication device for decryption based on a first decryption key, a value of the second data to be compared by the second communication device corresponding to the first bit position, and the first mask, and the strings obtained by decrypting each bit position are subjected to an XOR operation to obtain a first string XOR result; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on a QKD hardware device; A first receiving module, configured to encrypt two strings corresponding to each bit of the first data and send them to the second communication device, and then receive an XOR result of the first string sent by the second communication device; a comparison module, configured to compare the XOR result of the first character string with the XOR result of the second character string obtained by local operation of the first communication device, and determine whether the first data and the second data are the same according to the comparison result; The step of encrypting two character strings corresponding to the first bit positions based on the first encryption key and the first mask sent by the second communication device respectively includes: Based on the first mask, determining two keys from the first encryption key for encrypting the two character strings respectively; The two character strings are encrypted respectively using the keys corresponding to the two character strings.

6. A PSI device resistant to quantum attacks, characterized in that: Applied to a second communication device, comprising: A second receiving module is used to receive two encrypted character strings sent by the first communication device for the first bit; the two encrypted character strings are sent to the second communication device after the first communication device randomly generates two character strings for each bit of the first data to be compared by the first communication device, and the two character strings corresponding to the first bit are encrypted based on the first encryption key and the first mask sent by the second communication device respectively; a decryption module, configured to select an encrypted string from two encrypted strings sent by the first communication device for decryption based on a first decryption key, a value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask; wherein the first encryption key and the first decryption key are a pair of key pairs pre-prepared based on a QKD hardware device; a calculation module, configured to, after the first communication device encrypts two character strings corresponding to each bit of the first data and sends the two character strings to the second communication device, perform an XOR operation on the character strings obtained by decrypting each bit to obtain an XOR result of a first character string; a sending module, configured to send the first string XOR result to the first communication device, so that the first communication device compares the first string XOR result with a second string XOR result obtained by local operation of the first communication device, and determines whether the first data is the same as the second data according to the comparison result; The method of selecting an encrypted string from two encrypted strings sent by the first communication device for decryption based on the first decryption key, the value of the first bit corresponding to the second data to be compared by the second communication device, and the first mask, comprises: Selecting one encrypted string from two encrypted strings sent by the first communication device based on the value of the second data corresponding to the first bit, and determining a key for decrypting the selected encrypted string from the first decryption key based on the value of the second data corresponding to the first bit and the first mask; The selected encrypted string is decrypted using the determined key for decrypting the selected encrypted string.

7. A communication device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements the PSI method for resisting quantum attacks as described in any one of claims 1 to 2, or implements the PSI method for resisting quantum attacks as described in any one of claims 3 to 4.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the PSI method for resisting quantum attacks as described in any one of claims 1 to 2, or implements the PSI method for resisting quantum attacks as described in any one of claims 3 to 4.