Research Article

Privacy-Preserving KNN Classification Algorithm for Smart Grid

Algorithm 1

PPKC.
Suppose that there are smart meters and control centers. Each smart meter has , , where is the label and the attributes are . Each control center has a query data , . are public key and private key of the cloud server while are public key and private key of the control center .
Smart MeterUploading Encrypted Data:
(1) Generate a series of random numbers and calculate .
(2) Use public key and to encrypt and , respectively.
(3) Send these encrypted numbers, and , , to the cloud server.
Control CenterUploading Query Data:
(1) Download , , from the cloud server.
(2) Decrypt by using the private key and obtain these random numbers , .
(3) Calculate .
(4) Encrypt the above random numbers by using public key and get .
(5) Send these encrypted random numbers to the cloud server.
The Cloud Server Executing KNN on the Ciphertext:
(1) Compute , , and then use to decrypt these encrypted numbers.
(2) Calculate , , which is the Euclidean distance between the data of smart meters and the query data.
(3) Calculate the encrypted label of each Euclidean distance . In detail, . Thus, there are groups Euclidean distance and its corresponding encrypted label .
(4) Sort and select the smallest numbers in and their corresponding encrypted labels.
(5) Send these encrypted labels , , to the control center .
Control CenterDecrypting the Ciphertext:
(1) Decrypt these encrypted labels with and get .
(2) Calculate the frequency of each label.
(3) Set the label with the highest frequency as the final result.