A security comparison method and system

Through the exchangeable encryption algorithm, the key exchange between the first and second parties is solved, and the problem of secure comparison without leaking data privacy is achieved, and the comparison results are obtained securely and data confidentiality and integrity are ensured.

CN114266063BActive Publication Date: 2025-08-19SASI DIGITAL TECHNOLOGY (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111634662.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-08-19
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In secure multi-party computing, how to obtain the comparison results of private data of each party without revealing the private data of each party is a key issue in security comparison.

Method used

The exchangeable encryption algorithm is adopted to ensure that the comparison results are obtained without leaking data privacy through the key encryption and decryption process between the first and second parties, including encrypting the first plaintext information using the first key, encrypting the first ciphertext information with the second key, generating the second level ciphertext information, and using the nature of the exchangeable encryption algorithm to realize the exchange of decryption permissions.

Benefits of technology

It realizes that without leaking the data privacy of both parties, safely obtaining comparison results, ensuring the confidentiality and integrity of the data, and preventing data leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114266063B_ABST
    Figure CN114266063B_ABST
Patent Text Reader

Abstract

The embodiments of this specification disclose a secure comparison method and system. A first party encrypts first plaintext information associated with a first comparison object using a first key according to an exchangeable encryption algorithm, and sends the obtained first ciphertext information to a second party. The second party encrypts the first ciphertext information using a second key according to an exchangeable encryption algorithm to obtain secondary ciphertext information. The second party obtains an encrypted data set, which includes an encrypted comparison result between the second comparison object and each of a plurality of candidate comparison objects, where the first comparison object is one of the plurality of candidate comparison objects. The second party returns the secondary ciphertext information and the encrypted data set to the first party. The first party decrypts the secondary ciphertext information using the first key to obtain decryption authority for the encrypted comparison result between the second comparison object and the first comparison object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information technology, and in particular to a security comparison method and system. Background Art

[0002] In secure multi-party computation (SMPC / MPC), secure comparison is a classic computational problem with widespread application. The key to secure comparison is how to compare the private data of all parties without leaking their private data. Summary of the Invention

[0003] One of the embodiments of this specification provides a secure comparison method. The method is executed by a first party, and includes: encrypting a first plaintext information associated with a first comparison object with a first key according to an exchangeable encryption algorithm to obtain a first ciphertext information; sending the first ciphertext information to a second party; receiving an encrypted data set and secondary ciphertext information returned by the second party, wherein the encrypted data set includes an encrypted comparison result between the second comparison object and each of a plurality of candidate comparison objects, the first comparison object being one of the plurality of candidate comparison objects, and for each candidate comparison object, the encrypted comparison result is obtained by encrypting the comparison result between the second comparison object and the candidate comparison object with an encryption key associated with the candidate comparison object, and a decryption key matching the encryption key can be used based on the encryption key. The method comprises the following steps: decrypting the second ciphertext information associated with the candidate comparison object, the second ciphertext information being the result of encrypting the plaintext information associated with the candidate comparison object with the second key according to the exchangeable encryption algorithm, and the second ciphertext information being the result of encrypting the first ciphertext information with the second key according to the exchangeable encryption algorithm; decrypting the second ciphertext information with a decryption key matching the first key to obtain the second ciphertext information associated with the first comparison object; obtaining the decryption key associated with the first comparison object based on the second ciphertext information associated with the first comparison object; and decrypting the encrypted comparison result in the encrypted data set with the decryption key associated with the first comparison object to obtain a comparison result between the second comparison object and the first comparison object.

[0004] One of the embodiments of this specification provides a security comparison system. The system is implemented on the first party and includes: a first encryption module for encrypting the first plaintext information associated with the first comparison object with the first key according to the exchangeable encryption algorithm to obtain the first ciphertext information; a first sending module for sending the first ciphertext information to the second party; a first receiving module for receiving the encrypted data set and the secondary ciphertext information returned by the second party, wherein the encrypted data set includes the encrypted comparison result of the second comparison object and each of the multiple candidate comparison objects, the first comparison object is one of the multiple candidate comparison objects, for each candidate comparison object, the encrypted comparison result is obtained by encrypting the comparison result of the second comparison object with the candidate comparison object with the encryption key associated with the candidate comparison object, and the decryption key matching the encryption key can be based on the encrypted comparison result of the second comparison object and the candidate comparison object. The second ciphertext information associated with the candidate comparison object is obtained, where the second ciphertext information is the result of encrypting the plaintext information associated with the candidate comparison object with the second key according to the exchangeable encryption algorithm, and the secondary ciphertext information is the result of encrypting the first ciphertext information with the second key according to the exchangeable encryption algorithm; a first decryption module is used to decrypt the secondary ciphertext information with a decryption key that matches the first key to obtain the second ciphertext information associated with the first comparison object; a decryption key acquisition module is used to obtain the decryption key associated with the first comparison object based on the second ciphertext information associated with the first comparison object; a comparison result acquisition module is used to decrypt the encrypted comparison result in the encrypted data set with the decryption key associated with the first comparison object to obtain the comparison result between the second comparison object and the first comparison object.

[0005] One embodiment of this specification provides a security comparison apparatus, comprising a processor and a storage device. The storage device is configured to store instructions. When the processor executes the instructions, the security comparison method performed by a first party as described in any embodiment of this specification is implemented.

[0006] One of the embodiments of this specification provides a security comparison method. The method is performed by a second party and includes: receiving first ciphertext information from a first party, the first ciphertext information being a result of encrypting first plaintext information associated with a first comparison object using a first key according to a commutative encryption algorithm; encrypting the first ciphertext information using a second key according to the commutative encryption algorithm to obtain secondary ciphertext information; obtaining an encrypted data set, the encrypted data set including an encrypted comparison result between a second comparison object and each of a plurality of candidate comparison objects, the first comparison object being one of the plurality of candidate comparison objects, wherein, for each candidate comparison object, the encrypted data set obtaining module is configured to encrypt the plaintext information associated with the candidate comparison object using the second key according to the commutative encryption algorithm to obtain second ciphertext information associated with the candidate comparison object; obtaining an encryption key associated with the candidate comparison object based on the second ciphertext information, so that a decryption key matching the encryption key can be obtained based on the second ciphertext information; encrypting a comparison result between the second comparison object and the candidate comparison object using the encryption key to obtain an encrypted comparison result between the second comparison object and the candidate comparison object; and returning the secondary ciphertext information and the encrypted data set to the first party, so that the first party can obtain the comparison result between the second comparison object and the first comparison object.

[0007] One of the embodiments of this specification provides a security comparison system. The system is implemented on a second party and includes: a second receiving module for receiving first ciphertext information from a first party, the first ciphertext information being the result of encrypting first plaintext information associated with a first comparison object using a first key according to an exchangeable encryption algorithm; a second encryption module for encrypting the first ciphertext information using a second key according to an exchangeable encryption algorithm to obtain secondary ciphertext information; an encrypted data set obtaining module for obtaining an encrypted data set, the encrypted data set including the encrypted comparison result between the second comparison object and each of a plurality of candidate comparison objects, the first comparison object being one of the plurality of candidate comparison objects, wherein for each candidate comparison object: The exchange encryption algorithm encrypts the plaintext information associated with the candidate comparison object with a second key to obtain second ciphertext information associated with the candidate comparison object, obtains an encryption key associated with the candidate comparison object based on the second ciphertext information, enables a decryption key matching the encryption key to be obtained based on the second ciphertext information, encrypts the comparison result between the second comparison object and the candidate comparison object with the encryption key, and obtains an encrypted comparison result between the second comparison object and the candidate comparison object; a second sending module is used to return the secondary ciphertext information and the encrypted data set to the first party, so that the first party can obtain the comparison result between the second comparison object and the first comparison object.

[0008] One embodiment of this specification provides a security comparison apparatus, comprising a processor and a storage device. The storage device is configured to store instructions. When the processor executes the instructions, the security comparison method performed by a second party as described in any embodiment of this specification is implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] This specification will be further described in the form of exemplary embodiments, which will be described in detail with reference to the accompanying drawings. These embodiments are not limiting, and in these embodiments, like numbers represent like structures, wherein:

[0010] Figure 1 is a schematic diagram of an application scenario of security comparison according to some embodiments of this specification;

[0011] Figure 2 is an exemplary interactive flow chart of a security comparison method according to some embodiments of this specification;

[0012] Figure 3 is an exemplary flow chart of generating each encryption comparison result in an encrypted data set according to some embodiments of the present specification;

[0013] Figure 4 is a schematic diagram of comparison results of multiple candidate comparison objects according to some embodiments of this specification;

[0014] Figure 5 is an exemplary module diagram of a security comparison system implemented by a first party according to some embodiments of this specification;

[0015] Figure 6 is an exemplary module diagram of a security comparison system implemented by a second party according to some embodiments of this specification. DETAILED DESCRIPTION

[0016] To more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly describes the drawings required for describing the embodiments. Obviously, the drawings described below are merely examples or embodiments of this specification. Those skilled in the art can apply this specification to other similar scenarios based on these drawings without inventive effort. Unless otherwise apparent from the context or otherwise noted, the same reference numerals in the figures represent the same structure or operation.

[0017] It should be understood that the terms "system," "device," "unit," and / or "module" used herein are a method for distinguishing different components, elements, parts, portions, or assemblies at different levels. However, if other terms can achieve the same purpose, the terms may be replaced by other expressions.

[0018] As used in this specification, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" are not intended to refer to the singular but may include the plural. Generally speaking, the terms "comprise" and "include" only indicate the inclusion of the steps and elements specifically identified, and these steps and elements do not constitute an exclusive list. A method or apparatus may also include other steps or elements.

[0019] Flowcharts are used throughout this specification to illustrate the operations performed by systems according to embodiments of this specification. It should be understood that preceding or following operations do not necessarily need to be performed in exact order. Instead, the steps may be processed in reverse order or simultaneously. Furthermore, other operations may be added to these processes, or one or more operations may be removed from these processes.

[0020] Figure 1 It is a schematic diagram of an application scenario of security comparison according to some embodiments of this specification.

[0021] like Figure 1 As shown, the participants in the secure comparison include the first party and the second party. The first party holds a private first comparison object X1, and the second party holds a private second comparison object X2. In some scenarios, one of the parties hopes to obtain a comparison result Y between the first comparison object X1 and the second comparison object X2 through a secure comparison. The security here may mean that the first comparison object X1 of the first party will not be leaked, and the second comparison object X2 of the second party will not be leaked. The comparison here can be for relative relationships such as size (such as numerical size), high and low (such as level), and sequence (such as time sequence). For the sake of convenience of description, it is recommended to take the first party as the party that obtains the comparison result Y.

[0022] As an example only, the first party may be an e-commerce platform, which holds the order amount of the product. The second party may be a fund management platform, which manages the user's account balance. During the transaction process, the e-commerce platform may compare the size relationship between the user's order amount and his account balance in advance to determine whether to further deduct money from the user's account through the fund management platform to pay for his order fee. For example, if the order amount is less than or equal to the user's account balance, the order fee is paid through the fund management platform. However, the e-commerce platform does not want to disclose the user's order information (such as the order amount of the product), and the fund management platform does not want to disclose the user's account balance. Therefore, it is necessary to provide a secure comparison solution so that the e-commerce platform can obtain the comparison results of the order amount and account balance without disclosing the data privacy of both parties.

[0023] Figure 2 FIG. 1 is an exemplary interactive flow chart of a security comparison method according to some embodiments of this specification. Figure 2 As shown, the method may include the following steps.

[0024] In step 110 , the first party encrypts the first plaintext information associated with the first comparison object using the first key according to the commutative encryption algorithm to obtain the first ciphertext information. In some embodiments, step 110 may be implemented by the first encryption module 510 .

[0025] In step 120 , the first party sends the first ciphertext information to the second party. In some embodiments, step 120 may be implemented by the first sending module 520 .

[0026] It can be understood that after the first party encrypts the first plaintext information with the first key, the outside world, such as the second party, cannot obtain the first comparison object from the first ciphertext information without decryption permission, thereby preventing the first comparison object from being leaked to the outside.

[0027] The first key may be an encryption key that the first party already possesses and complies with the exchangeable encryption algorithm, or the first party may temporarily generate the first key according to the exchangeable encryption algorithm.

[0028] By means of the commutative encryption algorithm, the first party can obtain decryption authority for the comparison result between the second comparison object and the first comparison object. The properties of the commutative encryption algorithm can be found in the relevant description of step 140.

[0029] In some scenarios, the second comparison object can be associated with a target ID, and the first party can send the target ID to the second party so that the second party can determine the second comparison object based on the target ID. For example, the e-commerce platform (first party) needs to compare the order amount (first comparison object) and the account balance (second comparison object) of a certain user. The e-commerce platform can send the user's ID (target ID) to the fund management platform so that the fund management platform can determine the user's account balance based on the ID. In some other embodiments, the first comparison object and the second comparison object involved in the comparison are determined for both parties, and the target ID is not required. For example, the first party has only one first comparison object, and the second party also has only one available second comparison object. For example, the first party has a first comparison object data column, and the second party has a second comparison object data column that is aligned with it row by row. Both parties only need to take out the corresponding comparison objects in order for comparison.

[0030] In step 210 , the second party receives the first ciphertext information from the first party. In some embodiments, step 210 may be implemented by the second receiving module 610 .

[0031] Referring to step 110 , the first ciphertext information is a result of encrypting the first plaintext information associated with the first comparison object using a first key according to a commutative encryption algorithm.

[0032] With reference to the foregoing, in some scenarios, the second comparison object may be associated with the target ID. The second party may also receive the target ID from the first party and determine the second comparison object based on the target ID.

[0033] In step 220 , the second party encrypts the first ciphertext information using the second key according to the exchangeable encryption algorithm to obtain the secondary ciphertext information. In some embodiments, step 220 may be implemented by the second encryption module 620 .

[0034] The second key may be an encryption key that the second party already possesses and complies with the exchangeable encryption algorithm, or the second party may temporarily generate the second key according to the exchangeable encryption algorithm.

[0035] It should be understood that the exchangeable encryption algorithm mentioned herein can be an asymmetric encryption algorithm or a symmetric encryption algorithm. In other words, the first key / second key can be a symmetric key or an asymmetric key. For an asymmetric key, the first key (such as a public key) and the decryption key (such as a private key) that matches it are different, and the second key (such as a public key) and the decryption key (such as a private key) that matches it are different. For a symmetric key, the first key and the decryption key that matches it are the same, and the second key and the decryption key that matches it are the same. By way of example only, the exchangeable encryption algorithms mentioned herein include but are not limited to elliptic curve cryptography (ECC), RSA algorithm, and SRA algorithm.

[0036] In step 230 , the second party obtains the encrypted data set. In some embodiments, step 230 may be implemented by the encrypted data set obtaining module 630 .

[0037] The encrypted data set may include encrypted comparison results between the second comparison object and each of a plurality of candidate comparison objects, where the first comparison object is one of the plurality of candidate comparison objects. Without knowing the first comparison object, the second party may prepare comparison results between the second comparison object and each of the plurality of candidate comparison objects. In this way, the first party may obtain the comparison results between the second comparison object and the first comparison object from the encrypted data set.

[0038] In some embodiments, the multiple candidate comparison objects can be determined by the second party, and the first party can know the multiple candidate comparison objects or reach a consensus with the second party on the method of generating multiple candidate comparison objects, so that the first party can select one that is the same as or closest to the actual object from the multiple candidate comparison objects as the first comparison object. For example, if the second comparison object is a numerical value (such as an amount), the multiple candidate comparison objects can be an arithmetic progression consisting of multiple numerical values. For example, assuming that the second comparison object is an account balance and the account balance is 100, the multiple candidate comparison objects can be an arithmetic progression with a first term of 10 and a common difference of 20, and the total number of elements in the sequence is 10, that is, the multiple candidate comparison objects can be 10, 30, 50, ..., 190. The second party can compare the second comparison object with each candidate comparison object in advance. When the account balance is greater than or equal to the candidate amount, the comparison result of the account balance and the candidate amount is recorded as "1", otherwise the comparison result of the account balance and the candidate amount is recorded as "0".

[0039] Transmitting the comparison results of the second comparison object with each candidate comparison object to the first party in encrypted form can prevent the second comparison object from being leaked. Continuing with the previous example, let's assume the second comparison object is 100. Once the comparison result of the account balance with 90 is "1" and the comparison result of the account amount with 120 is "0," it can be inferred that the account balance is between 90 and 120. Although in some scenarios, there is a large gap (i.e., tolerance) between multiple candidate comparison objects, several consecutive candidate comparison objects with different comparison results can still reflect an approximate value of the second comparison object, which can also be considered a leak of the second comparison object. However, in other scenarios, the candidate comparison objects may have a smaller gap (e.g., a tolerance of 1 or even smaller), which can lead to a greater degree of leakage of the second comparison object. For example, if the account balance is 100.21 and the candidate amount is an integer, if the comparison result of the account balance with 100 is "1" and the comparison result of the account amount with 101 is "0," then the account balance is approximately equal to 100.

[0040] In some embodiments, for each candidate comparison object, the encrypted comparison result between the second comparison object and the candidate comparison object can be generated according to the following process: encrypt the plaintext information associated with the candidate comparison object with the second key according to the exchangeable encryption algorithm to obtain the second ciphertext information associated with the candidate comparison object; obtain the encryption key associated with the candidate comparison object based on the second ciphertext information, so that the decryption key matching the encryption key (i.e., the decryption key associated with the candidate comparison object) can be obtained based on the second ciphertext information; encrypt the comparison result between the second comparison object and the candidate comparison object with the encryption key to obtain the encrypted comparison result between the second comparison object and the candidate comparison object. For more information about generating encrypted comparison results, please refer to the Figure 3 Related instructions.

[0041] The decryption key associated with the candidate comparison object is used to decrypt the encrypted comparison result between the second comparison object and the candidate comparison object to obtain the comparison result between the second comparison object and the candidate comparison object. For each candidate comparison object, the decryption key associated with the candidate comparison object can be obtained based on the second ciphertext information associated with the candidate comparison object, which means that obtaining the second ciphertext information associated with the candidate comparison object and knowing the method for generating the decryption key is equivalent to obtaining the decryption authority for the encrypted comparison result between the second comparison object and the candidate comparison object. For example, the first party knows the method for generating the decryption key. After obtaining the second ciphertext associated with the first comparison object, the first party can obtain the decryption authority for the encrypted comparison result between the second comparison object and the first comparison object, and thus obtain the comparison result between the two.

[0042] In some embodiments, a symmetric key can be used as the encryption key and decryption key for the comparison result, i.e., the encryption key and decryption key are the same. Symmetric encryption has the advantage of high encryption and decryption efficiency and is suitable for online comparison. In some embodiments, the encryption key and decryption key for the comparison result can be different. For example, the comparison result can be encrypted using asymmetric encryption.

[0043] In step 240 , the second party returns the secondary ciphertext information and the encrypted data set to the first party, so that the first party can obtain the comparison result between the second comparison object and the first comparison object. In some embodiments, step 240 can be implemented by the second sending module 640 .

[0044] For a detailed process of the first party obtaining the comparison result between the second comparison object and the first comparison object, reference may be made to steps 140 to 160 and related descriptions.

[0045] In step 130 , the first party receives the encrypted data set and the secondary ciphertext information returned by the second party. In some embodiments, step 130 may be implemented by the first receiving module 530 .

[0046] For more details about the encrypted data set and the secondary ciphertext information, please refer to step 220, step 230 and their related descriptions.

[0047] In step 140 , the first party decrypts the secondary ciphertext information using a decryption key that matches the first key to obtain second ciphertext information associated with the first comparison object. In some embodiments, step 140 may be implemented by the first decryption module 540 .

[0048] According to the foregoing, the secondary ciphertext information is the result of encrypting the first ciphertext information using the second key according to the commutative encryption algorithm, wherein the first ciphertext information is the result of encrypting the first plaintext information using the first key according to the commutative encryption algorithm. The second ciphertext information associated with the first comparison object is the result of encrypting the first plaintext information using the second key according to the commutative encryption algorithm.

[0049] Commutative encryption algorithms satisfy the following requirement: when multiple keys are used to iteratively encrypt the same plaintext, the resulting ciphertext is independent of the order in which the encryption is performed. Using multiple keys for iterative encryption means that each encryption uses a different key, and each time the ciphertext is encrypted again, the ciphertext is used as input until the final ciphertext is obtained. To intuitively understand the properties of a commutative algorithm, the following mathematical expression is given using two encryptions as an example: E key2 (E key1 (M))=E key1 (E key2 (M)). Where key1 and key2 represent the keys used for the two encryptions, E() represents the exchangeable encryption algorithm, and M represents the plaintext. It can be seen that no matter whether key1 or key2 is used for encryption first, the secondary (level) ciphertext obtained remains unchanged. Based on this, using the decryption key that matches any encryption key to decrypt the secondary ciphertext can obtain the primary ciphertext obtained by encrypting the plaintext with the other encryption key. For example, using the decryption key that matches key1 to decrypt the secondary ciphertext E key2 (E key1 (M)) is equivalent to using the decryption key that matches key1 to decrypt the secondary ciphertext E key1 (E key2 (M)) is decrypted, and the decryption result is equal to the first-level ciphertext E obtained by encrypting the plaintext M using key2 key2 (M).

[0050] Let the commutative encryption algorithm be recorded as E(), the first key as key1, the second key as key2, and the first plaintext as M. Correspondingly, the first ciphertext can be recorded as E key1 (M), the secondary ciphertext information can be recorded as E key2 (E key1 (M)). In this way, the first party decrypts the secondary ciphertext information E using the decryption key that matches the first key key1. key2 (E key1 (M)), which is equivalent to using the decryption key that matches the first key key1 to decrypt the secondary ciphertext information E key1 (E key2 The decryption result is equal to the second ciphertext information E obtained by encrypting the first plaintext information M with the second key key2. key2 (M). Since the second ciphertext information Ekey2 (M) is the result of encrypting the first plaintext information M associated with the first comparison object using the second key key2, and the second ciphertext information E key2 (M) is the second ciphertext information associated with the first comparison object.

[0051] In step 150 , the first party obtains a decryption key associated with the first comparison object based on the second ciphertext information associated with the first comparison object. In some embodiments, step 150 may be implemented by the decryption key obtaining module 550 .

[0052] It can be understood that the decryption key associated with the first comparison object matches the encryption key associated with the first comparison object. As mentioned above, the decryption key associated with the candidate comparison object can be obtained based on the second ciphertext information associated with the candidate comparison object. When the first comparison object is one of the multiple candidate comparison objects, the decryption key associated with the first comparison object can be obtained based on the second ciphertext information associated with the first comparison object. For details on how to obtain the decryption key, please refer to Figure 3 Related instructions.

[0053] In step 160 , the first party decrypts the encrypted comparison result in the encrypted data set using a decryption key associated with the first comparison object to obtain a comparison result between the second comparison object and the first comparison object. In some embodiments, step 160 may be implemented by the comparison result obtaining module 560 .

[0054] In some embodiments, the decryption keys corresponding to the encrypted comparison results in the encrypted data set may be different. It is understood that in order to ensure that the decryption keys corresponding to the encrypted comparison results in the encrypted data set are different, the encryption keys corresponding to the encrypted comparison results in the encrypted data set may be different. For example, for each candidate comparison object, the encryption key and decryption key associated with the candidate comparison object can be obtained based on the second ciphertext information associated with the candidate comparison object. When the plaintext information associated with each candidate comparison object is different, the decryption keys corresponding to each encrypted comparison result in the encrypted data set are also different. Thus, when the first comparison object is one of the multiple candidate comparison objects, it can be ensured that the first party can only decrypt the comparison result of the second comparison object and the first comparison object, thereby preventing the second comparison object from being leaked. In addition, since the decryption keys corresponding to the encrypted comparison results are different, the first party can traverse the encrypted comparison results in the encrypted data set until the decryption is successfully performed using the decryption key associated with the first comparison object. The decryption result is the comparison result of the second comparison object and the first comparison object.

[0055] The following combination Figure 3 Describe the process of generating each encryption comparison result in the encrypted data set. Figure 3As shown, for each candidate comparison object, an encrypted comparison result between the second comparison object and the candidate comparison object may be generated according to process 300 . Process 300 may be executed by the second party and includes the following steps.

[0056] Step 310: Encrypt the plaintext information associated with the candidate comparison object using a second key according to a commutative encryption algorithm to obtain second ciphertext information associated with the candidate comparison object.

[0057] In some embodiments, each candidate comparison object may have an index, and the plaintext information associated with the candidate comparison object includes the index of the candidate comparison object. The first comparison object is one of the multiple candidate comparison objects. Naturally, the first plaintext information associated with the first comparison object includes the index of the first comparison object. It is understood that the indexes of the multiple candidate comparison objects may be public information to both parties.

[0058] In some embodiments, the index may be one-dimensional. For example, a plurality of candidate comparison objects may form a sequence or array, and the index may be the sequence number or subscript of the candidate comparison object in the sequence or array.

[0059] In some embodiments, for each candidate comparison object, the index of the candidate comparison object may be multi-dimensional, for example, the index may include first-dimensional data and second-dimensional data, or include more dimensional data. Each dimension (assuming it is the i-th dimension) of the index of the candidate comparison object may include the i-th dimension label and the i-th dimension value of the candidate comparison object. The i-th dimension value is the i-th dimension coordinate of the candidate comparison object when multiple candidate comparison objects are arranged into an N-dimensional tensor. Taking a two-dimensional index as an example, for each candidate comparison object, the first-dimensional data of the index of the candidate comparison object may include the first-dimensional label and the first-dimensional value of the candidate comparison object, and the second-dimensional data of the index of the candidate comparison object may include the second-dimensional label and the second-dimensional value of the candidate comparison object, wherein the first-dimensional value is the row coordinate of the candidate comparison object when multiple candidate comparison objects are arranged into a two-dimensional matrix, and the second-dimensional value is the column coordinate of the candidate comparison object. Just as an example, assuming there are 10 candidate comparison objects (0 to 9), you can press Figure 4 The two-dimensional table in the array is arranged from 0 to 9, and the index of each candidate comparison object can include the first dimension data corresponding to its row coordinates and the second dimension data corresponding to its column coordinates. Among them, the first dimension label and the second dimension label can use any symbols as long as they are different from each other. The first dimension value and the second dimension value can be the row coordinate (or row number) and the column coordinate (or column number) respectively. Figure 4Based on this, the indexes 0 to 9 can be (0||0,1||0), (0||0,1||1), (0||0,1||2), (0||0,1||3), (0||1,1||0), (0||1,1||1), (0||1,1||2), (0||1,1||3), (0||2,1||0), (0||2,1||1). The symbol || can represent concatenation. The symbol || is preceded by a mark: the first dimension mark can be 0, and the second dimension mark can be 1. The symbol || is followed by a specific value, indicating the row or column number.

[0060] In some embodiments, the index of the candidate comparison object can be encrypted using a second key according to a commutative encryption algorithm to obtain second ciphertext information associated with the candidate comparison object. For a multi-dimensional index, the first dimension data, the second dimension data, etc. of the index can be encrypted using the second key to obtain the first dimension ciphertext, the second dimension ciphertext, etc. in the second ciphertext information.

[0061] Through the above examples, it is not difficult to find that the multidimensional index of the multiple candidate comparison objects is repetitive in a single dimension (such as the first dimension data). This allows: by appropriately increasing the index dimension, the number of encryptions performed by the second party to obtain the second ciphertext information associated with each candidate comparison object can be reduced, thereby improving the efficiency of obtaining the encrypted data set. For example, assume there are 100 candidate comparison objects. For a one-dimensional index, the indexes of these 100 candidate comparison objects are represented by 100 instances (such as numerical values). Accordingly, 100 encryptions are required to obtain 100 pieces of ciphertext information (such as second ciphertext information) associated with each of the 100 candidate comparison objects. For a two-dimensional index, each dimension of the indexes of these 100 candidate comparison objects can be represented by 10 instances. Accordingly, only 2*10=20 encryptions are required to obtain 100 pieces of ciphertext information associated with each of the 100 candidate comparison objects. It can be seen that a two-dimensional index can significantly reduce the number of encryptions compared to a one-dimensional index.

[0062] With reference to the foregoing, in some scenarios, the second comparison object may be associated with a target ID. Accordingly, for each candidate comparison object, each dimension of the index of the candidate comparison object may also include the target ID. Taking a two-dimensional index as an example, for each candidate comparison object, the first dimension of the index of the candidate comparison object may also include the target ID, and the second dimension may also include the target ID. Figure 4, the indexes from 0 to 9 can be (ID||0||0,ID||1||0), (ID||0||0,ID||1||1), (ID||0||0,ID||1||2), (ID||0||0,ID||1||3), (ID||0||1,ID||1||0), (ID||0||1,ID||1||1), (ID||0||1,ID||1||2), (ID||0||1,ID||1||3), (ID||0||2,ID||1||0), (ID||0||2,ID||1||1). Where ID identifies the specific value of the target ID.

[0063] When the plaintext information associated with a candidate comparison object includes a multidimensional index, the first comparison object, as one of the multiple candidate comparison objects, may include 1st-dimensional ciphertext Y_1 through Nth-dimensional ciphertext Y_N. The i-th-dimensional ciphertext Y_i is the result of encrypting the i-dimensional data X_i of the first comparison object's index using a first key (denoted as key1), i.e., Y_i = E(key1, X_i). Taking a two-dimensional index as an example, when the index includes first-dimensional data X_1 and second-dimensional data X_2, the first ciphertext information may include first-dimensional ciphertext Y_1 and second-dimensional ciphertext Y_2. The first-dimensional ciphertext Y_1 is the result of encrypting the first-dimensional data X_1 of the first comparison object's index using a first key (denoted as key1), i.e., Y_1 = E(key1, X_1); the second-dimensional ciphertext Y_2 is the result of encrypting the second-dimensional data X_2 of the first comparison object's index using the first key (denoted as key1), i.e., Y_2 = E(key1, X_2).

[0064] The secondary ciphertext information may include the 1st- to Nth-dimensional secondary ciphertexts, namely, Z_1 to Z_N. The i-th-dimensional secondary ciphertext Z_i is the result of encrypting the i-th-dimensional ciphertext Y_i in the first ciphertext information using the second key key2, i.e., Z_i = E(key2, Y_i). That is, the second party can encrypt the i-th-dimensional ciphertext Y_i in the first ciphertext information using the second key key2 to obtain the i-th-dimensional secondary ciphertext Z_i in the secondary ciphertext information. Correspondingly, the first party can decrypt the i-th-dimensional secondary ciphertext Z_i in the secondary ciphertext information using a decryption key that matches the first key key1 to obtain the i-th-dimensional ciphertext Y_i in the second ciphertext information associated with the first comparison object. Taking a two-dimensional index as an example, when the index includes first-dimensional data X_1 and second-dimensional data X_2, the secondary ciphertext information may include the first-dimensional secondary ciphertext Z_1 and the second-dimensional secondary ciphertext Z_2. Among them, the first-dimensional second-level ciphertext Z_1 is the first-dimensional ciphertext Y_1 in the first ciphertext information encrypted with the second key key2, and the first-dimensional second-level ciphertext Z_1 in the second-level ciphertext information is obtained; the second-dimensional second-level ciphertext Z_2 is the second-dimensional second-level ciphertext Y_2 in the first ciphertext information is encrypted with the second key key2, and the second-dimensional second-level ciphertext Z_2 in the second-level ciphertext information is obtained.

[0065] Step 320: Obtain an encryption key associated with the candidate comparison object based on the second ciphertext information associated with the candidate comparison object, so that a decryption key matching the encryption key can be obtained based on the second ciphertext information.

[0066] According to the foregoing, for a one-dimensional index, the second ciphertext information may include a one-dimensional ciphertext. The hash value of the one-dimensional ciphertext may be calculated to obtain the encryption key. According to the foregoing, for a multidimensional index, the second ciphertext information may include a multidimensional ciphertext. In some scenarios, in order to obtain a one-dimensional encryption key to encrypt the comparison result, for each candidate comparison object, the second party may merge the ciphertexts of each dimension (for example, for an N-dimensional index, the 1st dimension ciphertext to the Nth dimension ciphertext) in the second ciphertext information associated with the candidate comparison object, and obtain the encryption key associated with the candidate comparison object based on the merge result. Furthermore, the hash value of the merge result may be used as the encryption key.

[0067] Correspondingly, the first comparison object is one of the multiple candidate comparison objects. The first party can obtain the hash value of the one-dimensional ciphertext in the second ciphertext information associated with the first comparison object or the hash value of the combined result of the multi-dimensional ciphertext, and obtain the decryption key associated with the first comparison object based on the hash value (this is a symmetric encryption scenario).

[0068] Taking a two-dimensional index as an example, for each candidate comparison object, the second party can merge the first-dimensional ciphertext and the second-dimensional ciphertext in the second ciphertext information associated with the candidate comparison object, and use the hash value of the merged result as the encryption key associated with the candidate comparison object. In some embodiments, the merge can refer to a sum or an XOR operation, that is, the merged result can be a sum value or an XOR result. Accordingly, the first party can obtain the hash value of the merged result of the first-dimensional ciphertext and the second-dimensional ciphertext in the second ciphertext information associated with the first comparison object, and obtain the decryption key associated with the first comparison object based on the hash value.

[0069] Step 330: Use the encryption key to encrypt the comparison result between the second comparison object and the candidate comparison object to obtain an encrypted comparison result between the second comparison object and the candidate comparison object.

[0070] The comparison result (relative relationship) can be expressed by setting rules. For example, "1" can be used to indicate that the second comparison object is greater than or equal to the candidate comparison object, and "0" can be used to indicate that the second comparison object is less than the candidate comparison object. Of course, "0" can also be used to indicate that the second comparison object is less than the candidate comparison object, and "1" can be used to indicate that the second comparison object is greater than or equal to the candidate comparison object. For another example, other preset values besides 0 / 1 can be used to indicate the comparison result.

[0071] It can be understood that it is not appropriate to separately represent sensitive comparison results such as "equal" (or "same"), because this will lead to the leakage of the second comparison object. For example, if "0" is used to indicate that the second comparison object is smaller than the candidate comparison object, "1" is used to indicate that the second comparison object is equal to the candidate comparison object, and "2" is used to indicate that the second comparison object is larger than the candidate comparison object. Then, when the first comparison object is just equal to the second comparison object, the first party can determine the value of the first comparison object as the value of the second comparison object based on the comparison result of the second comparison object and the first comparison object being "1". It is not difficult to see that, with reference to the above example, the comparison results can be divided into several categories (such as two categories), and "equal" can be divided into any one of the comparison results.

[0072] As an example only, when the second comparison object is 3, the comparison results of the 10 candidate comparison objects (0 to 9) can be as follows: Figure 4 As shown. In the figure, the left side of the symbol || is the candidate comparison object, and the right side is the comparison result between the second comparison object and the candidate comparison object. It can be seen that when the candidate comparison object is less than or equal to the second comparison object (3), the comparison result between the second comparison object and the candidate comparison object is recorded as "1"; when the candidate comparison object is greater than the second comparison object (3), the comparison result between the second comparison object and the candidate comparison object is recorded as "0".

[0073] It should be noted that, in some embodiments, the encrypted comparison results in the encrypted data set sent by the second party to the first party may be arranged in index order of the candidate comparison objects. Because the candidate comparison objects and their indexing methods can be disclosed to both parties, the first party can quickly determine the encrypted comparison results of the second comparison object and the first comparison object from the encrypted data set based on the first comparison object's index, and then use the decryption key to quickly and accurately obtain the comparison results of the second comparison object and the first comparison object.

[0074] It should be noted that the above description of the relevant processes is for illustration and purpose only and does not limit the scope of application of this specification. For those skilled in the art, various modifications and changes can be made to the processes under the guidance of this specification. However, such modifications and changes are still within the scope of this specification.

[0075] Figure 5 is an exemplary module diagram of a security comparison system implemented by a first party according to some embodiments of this specification.

[0076] like Figure 5 As shown, the system 500 may include a first encryption module 510 , a first sending module 520 , a first receiving module 530 , a first decryption module 540 , a decryption key obtaining module 550 and a comparison result obtaining module 560 .

[0077] The first encryption module 510 may be configured to encrypt first plaintext information associated with a first comparison object using a first key according to a commutative encryption algorithm to obtain first ciphertext information.

[0078] The first sending module 520 may be configured to send the first ciphertext information to the second party;

[0079] The first receiving module 530 can be used to receive the encrypted data set and secondary ciphertext information returned by the second party. The encrypted data set includes the encrypted comparison results between the second comparison object and each of the multiple candidate comparison objects, and the first comparison object is one of the multiple candidate comparison objects. For each candidate comparison object, the encrypted comparison result is obtained by encrypting the comparison result between the second comparison object and the candidate comparison object using the encryption key associated with the candidate comparison object. The decryption key matching the encryption key can be obtained based on the second ciphertext information associated with the candidate comparison object. The second ciphertext information is the result of encrypting the plaintext information associated with the candidate comparison object using the second key according to the exchangeable encryption algorithm. The secondary ciphertext information is the result of encrypting the first ciphertext information using the second key according to the exchangeable encryption algorithm.

[0080] The first decryption module 540 may be configured to decrypt the secondary ciphertext information using a decryption key that matches the first key to obtain second ciphertext information associated with the first comparison object.

[0081] The decryption key obtaining module 550 may be configured to obtain a decryption key associated with the first comparison object based on the second ciphertext information associated with the first comparison object.

[0082] The comparison result obtaining module 560 may be configured to decrypt the encrypted comparison result in the encrypted data set using a decryption key associated with the first comparison object to obtain a comparison result between the second comparison object and the first comparison object.

[0083] Figure 6 is an exemplary module diagram of a security comparison system implemented by a second party according to some embodiments of this specification.

[0084] like Figure 6 As shown, the system 600 may include a second receiving module 610 , a second encryption module 620 , an encrypted data set obtaining module 630 and a second sending module 640 .

[0085] The second receiving module 610 may be configured to receive first ciphertext information from a first party, where the first ciphertext information is a result of encrypting first plaintext information associated with a first comparison object using a first key according to a commutative encryption algorithm.

[0086] The second encryption module 620 may be configured to encrypt the first ciphertext information using the second key according to a commutative encryption algorithm to obtain secondary ciphertext information.

[0087] The encrypted data set acquisition module 630 can be used to obtain an encrypted data set. The encrypted data set includes an encrypted comparison result between the second comparison object and each of a plurality of candidate comparison objects, wherein the first comparison object is one of the plurality of candidate comparison objects. For each candidate comparison object, the encrypted data set acquisition module 630 can be used to: encrypt the plaintext information associated with the candidate comparison object using a second key according to a commutative encryption algorithm to obtain second ciphertext information associated with the candidate comparison object; obtain an encryption key associated with the candidate comparison object based on the second ciphertext information, so that a decryption key matching the encryption key can be obtained based on the second ciphertext information; and encrypt the comparison result between the second comparison object and the candidate comparison object using the encryption key to obtain an encrypted comparison result between the second comparison object and the candidate comparison object.

[0088] The second sending module 640 may be configured to return the secondary ciphertext information and the encrypted data set to the first party, so that the first party can obtain a comparison result between the second comparison object and the first comparison object.

[0089] For more details about system 500, system 600 and their modules, please refer to Figure 2 and its related descriptions.

[0090] It should be understood that Figure 5 and Figure 6 The system and its modules shown can be implemented in various ways. For example, in some embodiments, the system and its modules can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated hardware. Those skilled in the art will understand that the above-mentioned methods and systems can be implemented using computer-executable instructions and / or contained in processor control code, for example, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the system and its modules of this specification. Not only can the hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc. be implemented, they can also be implemented using software executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software (for example, firmware).

[0091] It should be noted that the above description of the system and its modules is for convenience of description only and does not limit this specification to the scope of the embodiments cited. It is understandable that for those skilled in the art, after understanding the principles of the system, it is possible to arbitrarily combine the various modules or form a subsystem to connect with other modules without deviating from this principle. For example, in some embodiments, the first encryption module 510 and the first sending module 520 can be different modules in a system, or a single module can implement the functions of these two modules. For example, in some embodiments, the second receiving module 610 and the second encryption module 620 can be two separate modules, or they can be combined into one module. Variations such as these are all within the scope of protection of this specification.

[0092] The beneficial effects that may be brought about by the embodiments of this specification include, but are not limited to: (1) providing a secure comparison method that can protect the data privacy of both parties; (2) with only one round of interaction and low communication volume, online comparison that meets low latency and high concurrency requirements can be achieved; (3) with the help of multidimensional indexing, the number of encryption times can be significantly reduced, thereby greatly improving comparison efficiency. It should be noted that different embodiments may produce different beneficial effects. In different embodiments, the beneficial effects that may be produced may be any one or a combination of the above, or any other possible beneficial effects.

[0093] While the basic concepts have been described above, it will be apparent to those skilled in the art that the detailed disclosure is merely illustrative and does not limit the embodiments of this specification. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements, and revisions to the embodiments of this specification. Such modifications, improvements, and revisions are suggested in the embodiments of this specification and remain within the spirit and scope of the exemplary embodiments of this specification.

[0094] This specification also uses specific terms to describe the embodiments of this specification. For example, "one embodiment," "an embodiment," and / or "some embodiments" refer to a feature, structure, or characteristic associated with at least one embodiment of this specification. Therefore, it should be emphasized and noted that references to "one embodiment," "an embodiment," or "an alternative embodiment" two or more times in different locations in this specification do not necessarily refer to the same embodiment. Furthermore, certain features, structures, or characteristics of one or more embodiments of this specification may be appropriately combined.

[0095] In addition, it will be understood by those skilled in the art that the various aspects of the embodiments of this specification may be illustrated and described by a number of patentable categories or situations, including any new and useful process, machine, product or combination of substances, or any new and useful improvements thereto. Accordingly, the various aspects of the embodiments of this specification may be performed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software may all be referred to as "data blocks," "modules," "engines," "units," "components," or "systems." In addition, the various aspects of the embodiments of this specification may be represented as a computer product located in one or more computer-readable media, the product including computer-readable program code.

[0096] A computer storage medium may include a propagated data signal embodying the computer program code, for example, in baseband or as part of a carrier wave. The propagated signal may be in a variety of forms, including electromagnetic, optical, or any suitable combination thereof. A computer storage medium may be any computer-readable medium other than a computer-readable storage medium that can be connected to an instruction execution system, apparatus, or device to communicate, propagate, or transfer the program for use. The program code on the computer storage medium may be transmitted via any suitable medium, including radio, cable, fiber optic cable, RF, or similar media, or any combination of these.

[0097] The computer program coding required for the operation of each part of the embodiment of this specification can be written in any one or more programming languages, including object-oriented programming languages such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB.NET, Python, etc., conventional procedural programming languages such as C language, VisualBasic, Fortran2003, Perl, COBOL2002, PHP, ABAP, dynamic programming languages such as Python, Ruby and Groovy, or other programming languages, etc. The program coding can be run completely on the user's computer, or run on the user's computer as an independent software package, or partly run on the user's computer and partly run on a remote computer, or run completely on a remote computer or processing equipment. In the latter case, the remote computer can be connected to the user's computer by any network form, such as a local area network (LAN) or a wide area network (WAN), or be connected to an external computer (such as by the Internet), or in a cloud computing environment, or used as a service such as software as a service (SaaS).

[0098] In addition, unless expressly stated in the claims, the order of the processing elements and sequences, the use of alphanumeric characters, or the use of other names described in the embodiments of this specification are not intended to limit the order of the processes and methods of the embodiments of this specification. Although the above disclosure discusses some of the invention embodiments that are currently considered useful through various examples, it should be understood that such details are for illustrative purposes only, and the appended claims are not limited to the disclosed embodiments. On the contrary, the claims are intended to cover all modifications and equivalent combinations that are consistent with the essence and scope of the embodiments of this specification. For example, although the system components described above can be implemented by hardware devices, they can also be implemented only by software solutions, such as installing the described system on an existing processing device or mobile device.

[0099] Similarly, it should be noted that, in order to simplify the presentation of the embodiments disclosed in this specification and thereby facilitate understanding of one or more invention embodiments, the foregoing descriptions of the embodiments of this specification sometimes combine multiple features into a single embodiment, figure, or description thereof. However, this disclosure method does not mean that the embodiments of this specification require more features than those recited in the claims. In fact, an embodiment may have fewer features than all of the features of a single disclosed embodiment.

[0100] Each patent, patent application, patent application publication, and other materials, such as articles, books, specifications, publications, and documents, cited in this specification is hereby incorporated by reference in its entirety. This includes any application history documents that are inconsistent with or conflict with the content of this specification, as well as any documents (currently or subsequently attached to this application) that limit the broadest scope of the claims of this application. It should be noted that if the descriptions, definitions, and / or terminology used in the accompanying materials are inconsistent or conflicting with the content of this specification, the descriptions, definitions, and / or terminology used in this specification will control.

[0101] Finally, it should be understood that the embodiments described in this specification are intended only to illustrate the principles of the embodiments of this specification. Other variations may also fall within the scope of the embodiments of this specification. Therefore, by way of example and not limitation, alternative configurations of the embodiments of this specification may be considered consistent with the teachings of this specification. Accordingly, the embodiments of this specification are not limited to the embodiments explicitly described and illustrated in this specification.

Claims

1. A security comparison method, wherein: The method is performed by a first party and includes: Encrypting first plaintext information associated with the first comparison object using a first key according to a commutative encryption algorithm to obtain first ciphertext information; wherein the commutative encryption algorithm satisfies the following conditions: when the same plaintext is iteratively encrypted using multiple keys, the ciphertext ultimately obtained is independent of the encryption order; Sending the first ciphertext information to the second party; Receive the encrypted data set and secondary ciphertext information returned by the second party; wherein the encrypted data set includes an encrypted comparison result between the second comparison object and each of a plurality of candidate comparison objects, the first comparison object being one of the plurality of candidate comparison objects, and for each candidate comparison object, the encrypted comparison result is obtained by encrypting the comparison result between the second comparison object and the candidate comparison object using an encryption key associated with the candidate comparison object, a decryption key matching the encryption key being obtainable based on second ciphertext information associated with the candidate comparison object, the second ciphertext information being a result of encrypting plaintext information associated with the candidate comparison object using a second key according to an exchangeable encryption algorithm; and the secondary ciphertext information being a result of encrypting the first ciphertext information using the second key according to the exchangeable encryption algorithm; decrypting the secondary ciphertext information using a decryption key that matches the first key to obtain second ciphertext information associated with the first comparison object; Obtaining a decryption key associated with the first comparison object based on the second ciphertext information associated with the first comparison object; The encrypted comparison result in the encrypted data set is decrypted using a decryption key associated with the first comparison object to obtain a comparison result between the second comparison object and the first comparison object.

2. The method according to claim 1, wherein Each candidate comparison object has an index, and the plaintext information associated with the candidate comparison object includes the index of the candidate comparison object; the first plaintext information associated with the first comparison object includes the index of the first comparison object.

3. The method according to claim 2, wherein: Decrypting the encrypted comparison result in the encrypted data set using a decryption key associated with the first comparison object includes: determining, from the encrypted data set, an encrypted comparison result of the second comparison object and the first comparison object according to the index of the first comparison object; The encrypted comparison result between the second comparison object and the first comparison object is decrypted using a decryption key associated with the first comparison object to obtain a comparison result between the second comparison object and the first comparison object.

4. The method according to claim 2, wherein: The index includes first dimension data and second dimension data; The second ciphertext information associated with the candidate comparison object includes a first-dimensional ciphertext obtained by encrypting the first-dimensional data indexed by the candidate comparison object using the second key and a second-dimensional ciphertext obtained by encrypting the second-dimensional data indexed by the candidate comparison object using the second key; The first ciphertext information includes a first-dimensional ciphertext obtained by encrypting first-dimensional data of the index of the first comparison object using the first key and a second-dimensional ciphertext obtained by encrypting second-dimensional data of the index of the first comparison object using the first key; The secondary ciphertext information includes a first-dimensional secondary ciphertext obtained by encrypting the first-dimensional ciphertext in the first ciphertext information with the second key and a second-dimensional secondary ciphertext obtained by encrypting the second-dimensional ciphertext in the first ciphertext information with the second key; Decrypting the secondary ciphertext information with a decryption key matching the first key to obtain the second ciphertext information associated with the first comparison object includes: decrypting the first-dimensional secondary ciphertext in the secondary ciphertext information with the decryption key matching the first key to obtain the first-dimensional ciphertext in the second ciphertext information associated with the first comparison object; The second-dimensional secondary ciphertext in the secondary ciphertext information is decrypted using a decryption key that matches the first key to obtain the second-dimensional ciphertext in the second ciphertext information associated with the first comparison object.

5. The method according to claim 4, wherein: For each candidate comparison object, the first dimension data of the index of the candidate comparison object includes a first dimension label and a first dimension value of the candidate comparison object, and the second dimension data includes a second dimension label and a second dimension value of the candidate comparison object; wherein the first dimension value is the row coordinate of the candidate comparison object when multiple candidate comparison objects are arranged into a matrix, and the second dimension value is the column coordinate of the candidate comparison object.

6. The method according to claim 5, wherein: The second comparison object is associated with the target ID; For each candidate comparison object, the first dimension data of the index of the candidate comparison object further includes the target ID, and the second dimension data further includes the target ID.

7. The method of claim 4, wherein: For each candidate comparison object, the encryption key associated with the candidate comparison object is a hash value of a combination of the first-dimension ciphertext and the second-dimension ciphertext in the second ciphertext information associated with the candidate comparison object; Obtaining a decryption key associated with the first comparison object based on second ciphertext information associated with the first comparison object includes: A hash value of a combination result of the first-dimension ciphertext and the second-dimension ciphertext in the second ciphertext information associated with the first comparison object is obtained, and a decryption key associated with the first comparison object is obtained based on the hash value.

8. The method of claim 7, wherein: The merging result is an exclusive OR result.

9. The method of claim 1, wherein: For each candidate comparison object, the encryption key and the decryption key of the comparison result between the second comparison object and the candidate comparison object are the same.

10. The method of claim 1, wherein: The decryption keys corresponding to the encryption comparison results in the encrypted data set are different from each other.

11. The method of claim 1, wherein: The second comparison object is associated with the target ID; the method further includes: sending the target ID to the second party so that the second party can determine the second comparison object according to the target ID.

12. A security comparison system, wherein: The system is implemented at a first party and includes: a first encryption module configured to encrypt first plaintext information associated with a first comparison object using a first key according to a commutative encryption algorithm to obtain first ciphertext information; wherein the commutative encryption algorithm satisfies the following conditions: when the same plaintext is iteratively encrypted using multiple keys, the ciphertext ultimately obtained is independent of the encryption order; A first sending module, configured to send the first ciphertext information to the second party; A first receiving module is configured to receive an encrypted data set and secondary ciphertext information returned by the second party; wherein the encrypted data set includes an encrypted comparison result between the second comparison object and each of a plurality of candidate comparison objects, the first comparison object being one of the plurality of candidate comparison objects, and for each candidate comparison object, the encrypted comparison result is obtained by encrypting the comparison result between the second comparison object and the candidate comparison object using an encryption key associated with the candidate comparison object, wherein a decryption key matching the encryption key can be obtained based on second ciphertext information associated with the candidate comparison object, the second ciphertext information being a result of encrypting plaintext information associated with the candidate comparison object using a second key according to an exchangeable encryption algorithm; and the secondary ciphertext information being a result of encrypting the first ciphertext information using the second key according to the exchangeable encryption algorithm; a first decryption module, configured to decrypt the secondary ciphertext information using a decryption key matching the first key to obtain second ciphertext information associated with the first comparison object; a decryption key obtaining module, configured to obtain a decryption key associated with the first comparison object based on the second ciphertext information associated with the first comparison object; The comparison result obtaining module is used to decrypt the encrypted comparison result in the encrypted data set using a decryption key associated with the first comparison object to obtain a comparison result between the second comparison object and the first comparison object.

13. A security comparison apparatus comprising a processor and a storage device, wherein the storage device is used to store instructions, wherein: When the processor executes the instructions, the method according to any one of claims 1 to 11 is implemented.

14. A security comparison method, wherein: The method is performed by a second party and includes: receiving first ciphertext information from the first party, the first ciphertext information being a result of encrypting first plaintext information associated with the first comparison object using a first key according to a commutative encryption algorithm; wherein the commutative encryption algorithm satisfies the requirement that when the same plaintext is iteratively encrypted using multiple keys, a ciphertext ultimately obtained is independent of the encryption order; Encrypting the first ciphertext information with the second key according to the exchangeable encryption algorithm to obtain secondary ciphertext information; Obtaining an encrypted data set; the encrypted data set includes an encrypted comparison result between a second comparison object and each of a plurality of candidate comparison objects, where the first comparison object is one of the plurality of candidate comparison objects, wherein for each candidate comparison object: encrypting plaintext information associated with the candidate comparison object using a second key according to a commutative encryption algorithm to obtain second ciphertext information associated with the candidate comparison object; obtaining an encryption key associated with the candidate comparison object based on the second ciphertext information, such that a decryption key matching the encryption key can be obtained based on the second ciphertext information; encrypting a comparison result between the second comparison object and the candidate comparison object using the encryption key to obtain an encrypted comparison result between the second comparison object and the candidate comparison object; The secondary ciphertext information and the encrypted data set are returned to the first party, so that the first party can obtain a comparison result between the second comparison object and the first comparison object.

15. The method of claim 14, wherein: Each candidate comparison object has an index, and the plaintext information associated with the candidate comparison object includes the index of the candidate comparison object; the first plaintext information associated with the first comparison object includes the index of the first comparison object.

16. The method of claim 15, wherein: The index includes first dimension data and second dimension data; For each candidate comparison object, encrypting the plaintext information associated with the candidate comparison object with the second key to obtain the second ciphertext information associated with the candidate comparison object includes: encrypting the first dimension data of the index of the candidate comparison object with the second key to obtain the first dimension ciphertext in the second ciphertext information associated with the candidate comparison object; encrypting the second dimension data of the index of the candidate comparison object with the second key to obtain the second dimension ciphertext in the second ciphertext information associated with the candidate comparison object; The first ciphertext information includes a first-dimensional ciphertext obtained by encrypting first-dimensional data of the index of the first comparison object using the first key and a second-dimensional ciphertext obtained by encrypting second-dimensional data of the index of the first comparison object using the first key; The step of encrypting the first ciphertext information with the second key to obtain the secondary ciphertext information includes: Encrypting the first dimension ciphertext in the first ciphertext information using the second key to obtain the first dimension second-level ciphertext in the second-level ciphertext information; The second dimension ciphertext in the first ciphertext information is encrypted with the second key to obtain the second dimension secondary ciphertext in the secondary ciphertext information.

17. The method of claim 16, wherein: For each candidate comparison object, the first dimension data of the index of the candidate comparison object includes a first dimension label and a first dimension value of the candidate comparison object, and the second dimension data includes a second dimension label and a second dimension value of the candidate comparison object; wherein the first dimension value is the row coordinate of the candidate comparison object when multiple candidate comparison objects are arranged into a matrix, and the second dimension value is the column coordinate of the candidate comparison object.

18. The method of claim 17, wherein: The second comparison object is associated with the target ID; For each candidate comparison object, the first dimension data of the index of the candidate comparison object further includes the target ID, and the second dimension data further includes the target ID.

19. The method of claim 16, wherein: The obtaining, based on the second ciphertext information, an encryption key associated with the candidate comparison object includes: A hash value of a combination result of the first-dimension ciphertext and the second-dimension ciphertext in the second ciphertext information is obtained, and an encryption key associated with the candidate comparison object is obtained based on the hash value.

20. The method of claim 19, wherein: The merging result is an exclusive OR result.

21. The method of claim 14, wherein: For each candidate comparison object, the encryption key and the decryption key of the comparison result between the second comparison object and the candidate comparison object are the same.

22. The method of claim 14, wherein: The encryption keys corresponding to the encryption comparison results in the encrypted data set are different from each other, so that the decryption keys corresponding to the encryption comparison results in the encrypted data set are different from each other.

23. The method of claim 14, wherein: The second comparison object is associated with the target ID; the method further includes: receiving the target ID from the first party, and determining the second comparison object according to the target ID.

24. A security comparison system, wherein: The system is implemented by a second party and includes: a second receiving module configured to receive first ciphertext information from the first party, the first ciphertext information being a result of encrypting first plaintext information associated with the first comparison object using a first key according to a commutative encryption algorithm; wherein the commutative encryption algorithm satisfies the requirement that when the same plaintext is iteratively encrypted using multiple keys, a ciphertext ultimately obtained is independent of the encryption order; a second encryption module, configured to encrypt the first ciphertext information using a second key according to a commutative encryption algorithm to obtain secondary ciphertext information; an encrypted data set obtaining module, configured to obtain an encrypted data set; the encrypted data set includes an encrypted comparison result between a second comparison object and each of a plurality of candidate comparison objects, the first comparison object being one of the plurality of candidate comparison objects, wherein, for each candidate comparison object, the encrypted data set obtaining module is configured to: encrypt plaintext information associated with the candidate comparison object using a second key according to a commutative encryption algorithm to obtain second ciphertext information associated with the candidate comparison object; obtain an encryption key associated with the candidate comparison object based on the second ciphertext information, so that a decryption key matching the encryption key can be obtained based on the second ciphertext information; and encrypt a comparison result between the second comparison object and the candidate comparison object using the encryption key to obtain an encrypted comparison result between the second comparison object and the candidate comparison object; The second sending module is used to return the secondary ciphertext information and the encrypted data set to the first party, so that the first party can obtain the comparison result between the second comparison object and the first comparison object.

25. A security comparison apparatus comprising a processor and a storage device, wherein the storage device is used to store instructions, wherein: When the processor executes the instructions, the method according to any one of claims 14 to 23 is implemented.

Citation Information

Patent Citations

  • Anonymous broadcast method, key exchange method, anonymous broadcast system, key exchange system, communication device, and program

    CN111052673A

  • User identification method, device and equipment under privacy protection

    CN112000940A