The application claims priority to Chinese patent application No. 2023117022331, filed on Dec. 12, 2023, the entire contents of which are incorporated herein by reference.
The present invention belongs to the field of private set intersection, and specifically, relates to a method for private set intersection in a smart city system, a device, and a storage medium.
In a smart city management system, scenarios of performing intersection between two parties are becoming more and more common. A private set intersection solution in the smart city management system may ensure the privacy of set elements in addition to an intersection set of the two parties. However, in the private set intersection solution, sizes of two sets are required to be uniform, but in real life, the sizes of the sets are skewed. In addition, since a set in current private set intersection is only a single set, problems in storage, efficiency, and other aspects easily occur during set intersection.
A purpose of the present invention is to provide a method for private set intersection in a smart city system, a device, and a storage medium.
The present invention adopts the following technical solutions:
A method for private set intersection in a smart city system, where the method includes the following steps:
Further, the step (1) specifically is that:
Further, the step (2) specifically is that:
Further, the three parties in the step (3) include the participant Pa, the participant Pb, and the third party Pc.
Further, the step (4) specifically is that:
Further, the step (5) specifically is that:
Further, the step (6) specifically is that:
The present invention further provides an electronic device, including a memory and a processor, where the memory is configured to store a computer program, and the processor runs the computer program, to enable the electronic device to execute the above method for private set intersection in a smart city system.
The present invention further provides a computer-readable storage medium, having a computer program stored thereon, where the computer program, when executed by a processor, implements the above method for private set intersection in a smart city system.
Beneficial effects of the present invention are as follows:
The present invention has relatively high practicability and expandability. The present invention is suitable for a scenario in which private set intersection needs to be performed in a smart city system. According to the present invention, a secret sharing technology is used to reduce requirements on a size of a private set and protect an intersection cardinality of the private set; and intersection of fine granularity of the set is implemented through multi-subset division. According to the present invention, an identity verification technology is used to determine identities of two parties, which can ensure correctness of the identities of the two parties, improve a protection degree of the private set, and further reduce computational overheads of intersection greatly.
The accompanying drawings show various embodiments by way of examples and not limitations, and are used in conjunction with the specification and the claims to describe the embodiments of the present invention. Appropriately, the same reference numerals used in all accompanying drawings denote the same or similar parts. Such embodiments are illustrative and are not intended as exhaustive or exclusive embodiments of the apparatus or method.
The FIGURE is a schematic flowchart of a method of the present invention.
It should be noted that the embodiments and features in the embodiments of the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and the embodiments.
{A1, A2, . . . , An}. As with the participant Pa, it is assumed that the participant Pb has m subsets B={B1, B2, . . . , Bm}.
sets among three parties after it is determined that the intersection operation may be performed.
In step 1): the security parameter needs to be used to generate two hash functions, and the two hash functions respectively are used to encrypt a set A and a set B.
In step 12): the elements are ranked according to the element sizes. Since same elements may not appear in each set, after elements of two sets are combined, the elements are ranked according to the element sizes, so that same elements in the two sets may be at adjacent positions.
In step 14): after the elements are ranked again according to a size of a token vector, elements with a token vector being 1 may be ranked at the rear of the set, and these elements are intersection set elements. A reason is that when the token vector is generated, a latter element needs to be compared with a previous element, and the latter element is the same as the previous element, the token vector is labeled as 1, which indicates that this element is an intersection set element of two sets. After ranking is performed again by using the token vector, this intersection set element is ranked backward with the size of the token vector, which means that elements with the token vector being 1 may be extracted, to obtain the intersection set elements.
In step 16): the token vector is recovered through the Reveal algorithm, and a
Reveal recovery algorithm is an algorithm in a secret sharing technology, which means that a secret message is recovered and revealed, and when any two sub-token vectors are known, a linear secret sharing solution may recover and reveal this token vector.
In step 18): the intersection element is recovered through the Reveal algorithm, and as with the above, a Reveal recovery algorithm is an algorithm in a secret sharing technology, which means that a secret message is recovered and revealed. After two participants find an intersection set subelement in respective subsecrets through the token vector, the two participants send the intersection set subelements to each other, and the Reveal recovery algorithm in the linear secret sharing solution may recover and reveal this intersection set element.
First, in an initialization phase, as a credible third party Pc, a blockchain uses a security parameter 21, 2 to generate hash functions H1 and H2; and in a key generation phase, there are two participants, which respectively are Pa and Pb. The participant Pa selects a random value a as a private key ska of the participant Pa, and uses the private key to calculate a public key pka. Similarly, the participant Pb selects a random value b as a private key skb of the participant Pb, and uses the private key to calculate a public key pkb. Then, a set is encrypted, and during set encryption, it is assumed that the participant Pa has n subsets A={A1, A2, . . . , An}. As with the participant Pa, it is assumed that the participant Pb has m subsets B={B1, B2, . . . , Bm}. During encryption, the participant Pa performs hash on element subsets, to generate a ciphertext U1, and sends the ciphertext U1 to the blockchain; and the participant Pb uses the public key of the participant Pb to execute a same operation, to generate a ciphertext U2, and sends the ciphertext U2 to the blockchain.
Then, the blockchain is used to verify identities of two parties before private intersection is performed. First, the two parties of the participants exchange an EOA address; and then, the participant Pb uses the public key of the participant Pa to encrypt the public key and the ciphertext of the participant Pb, to generate CIb=PKa (PKb∥U2), and packs the ciphertext CIb into a transaction to be sent to the blockchain. When private set intersection needs to be performed, the Pa inquires a recent transaction, extracts a ciphertext in the recent transaction, and then decrypts the ciphertext by using the private key of the Pa. The public key PKb of the participant Pb is decrypted, a hash operation is performed on the public key, and last 20 characters of an operation result is intercepted as R1. The R1 is matched with an address Addr that sends the transaction, and if the R1 is the same as the address, it indicates that the participant Pb authorizes the other party and desires to perform a private set intersection operation. As with an operation of the Pa, the Pb inquires a recent transaction in the blockchain, and uses the EOA address to check whether the EOA address is an address of the Pa, and if the EOA address is the address of the Pa, it indicates that the Pa desires to perform a set intersection operation.
The participant Pa and the participant Pb share subsets of respective private sets among three parties after it is determined that the intersection operation may be performed. The participant Pa obtains subvectors and
; and similarly, the participant Pb obtains subvectors
and
and the Pc obtains subsecrets
and
. Then, a set of subsecrets held by the participant Pa is combined and is represented as a vector
and a set of subsecrets held by the participant Pb is represented as a vector
. The participant Pa and the participant Pb rank held subsecret combination vectors
and
according to element sizes, to generate vectors
and
.
Then, three participants jointly calculate a secret sharing vector =(
,
, . . . ,
) of one token vector
, and the participants rank (a1, a2) according to a value of
to obtain a subsecret combination vector (a′1, a′2) ranked according to
.
The participant Pa sends a subsecret vector (, a′1) thereof to the participant Pb, and similarly, the participant Pb sends a subsecret combination vector (
, a′2) thereof to the Pa; and the participant Pa and the participant Pb respectively invoke a Reveal algorithm according to held subsecret vectors
and
to recover a token vector
and finally, a number of elements with
=1 is a number N of intersection set elements. The participant Pa extracts last N elements in a′1 and sends the elements to the Pb. Similarly, the participant Pb extracts last N elements in a′2 and sends the elements to the Pa; and the participant Pa and the participant Pb recover, by invoking the Reveal algorithm, last N subsecret vectors that are received, to obtain an intersection set R.
Therefore, the secret sharing technology used in the present invention is that two participants may obtain an intersection set of sets on condition that sizes of private sets are different, and during execution, a size of an intersection set cardinality is not revealed. In addition, the set is divided into multiple subsets, which not only can implement a fine granularity operation, but also is helpful for extensive application in real life. In conclusion, the private set intersection solution may be applied to the smart city system more widely and securely through technologies such as blockchain verification, multi-subset division, secret sharing, and the like.
The foregoing descriptions are merely preferred specific implementations of the present invention, but are not intended to limit the protection scope of the present invention. Any equivalent replacement or variation made by a person skilled in the art according to the technical solutions of the present invention and the inventive concept thereof within the technical scope disclosed in the present invention shall fall within the protection scope of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
2023117022331 | Dec 2023 | CN | national |