Semi-homomorphic encryption method based on Paillier and related product

CN119449261APending Publication Date: 2025-02-14UNICLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411369477.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The existing semi-homomorphic encryption process is cumbersome, and the data receiver needs to decrypt multiple fragmented data, resulting in a complex decryption process.

Method used

Using the semi-homomorphic encryption method based on the Paillier algorithm, by generating the public key and the private key, the data provider uses the public key to encrypt the data, and the receiver uses the private key to decrypt it, which supports addition operations on the ciphertext to realize the multi-data provider Joint computing.

Benefits of technology

The semi-homomorphic encryption process is simplified, the decryption complexity of the data receiver is reduced, the data security is ensured, and the joint computing of multiple data providers is supported, with good adaptability and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449261A_ABST
    Figure CN119449261A_ABST
Patent Text Reader

Abstract

The invention provides a Paillier-based semi-homomorphic encryption method and related products, and the method comprises the steps: generating a public key and a private key for encryption based on a Paillier algorithm, and the public key and the private key have a corresponding relation. And respectively sending the public key to a first data provider, a second data provider and a third data provider. And receiving semi-homomorphic encrypted data sent by a first data provider, wherein the semi-homomorphic encrypted data is generated by the first data provider based on the first encrypted data, second encrypted data sent by a second data provider and third encrypted data sent by a third data provider. And decrypting the semi-homomorphic encrypted data by using the private key to obtain first data, second data and third data. According to the method provided by the invention, the first data, the second data and the third data can be safely obtained through decryption by simple steps.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data security technology, and in particular to a Paillier-based semi-homomorphic encryption method and related products. Background Art

[0002] With the continuous development of science and technology, people are paying more and more attention to data security. For this reason, modern data encryption technology has made great progress. There are many different ways to encrypt data in related technologies, such as homomorphic encryption, semi-homomorphic encryption, partial homomorphic encryption and full homomorphic encryption. Homomorphic encryption is an encryption scheme that allows operations to be performed on ciphertext. After the data is encrypted, operations can be performed to obtain the ciphertext result. Only the key holder can decrypt and view the result. It is a common tool for encryption calculations. Semi-homomorphic encryption (Partially Homomorphic Encryption, PHE) only supports one of the operations of addition or multiplication. Among them, the one that only supports addition is also called additive homomorphic encryption (Additive Homomorphic Encryption, AHE). Partial homomorphic encryption (Somewhat Homomorphic Encryption, SWHE) can support both addition and multiplication operations, but the number of supported calculations is limited. Fully Homomorphic Encryption (Fully Homomorphic Encryption, FHE) supports any number of addition and multiplication operations. When the related technology uses semi-homomorphic encryption, it is usually encrypted by different data providers and then sent to the data recipient. The data recipient also needs to decrypt the data provided by different data providers. The related technology is very cumbersome when using semi-homomorphic encryption. For this reason, how to make the existing semi-homomorphic encryption process simpler has become a technical problem that technicians in this field urgently need to solve. Summary of the invention

[0003] Based on the above problems, the present application provides a Paillier-based semi-homomorphic encryption method and related products to achieve semi-homomorphic encryption in a simpler way.

[0004] The present application provides a semi-homomorphic encryption method based on Paillier, the method comprising the following steps:

[0005] Generate a public key and a private key for encryption based on the Paillier algorithm, wherein the public key and the private key have a corresponding relationship;

[0006] Sending the public key to the first data provider, the second data provider and the third data provider respectively;

[0007] Receive semi-homomorphic encrypted data sent by a first data provider, where the semi-homomorphic encrypted data is generated by the first data provider based on the first encrypted data, second encrypted data sent by a second data provider, and third encrypted data sent by a third data provider, where the first encrypted data is obtained by the first data provider encrypting the first data based on the public key, the second encrypted data is obtained by the second data provider encrypting the second data based on the public key, and the third encrypted data is obtained by the third data provider encrypting the third data based on the public key;

[0008] The semi-homomorphic encrypted data is decrypted using the private key to obtain first data, second data and third data.

[0009] In a possible implementation, the first encrypted data is generated in the following manner:

[0010] The first data provider obtains a random number for encrypting the first data based on a random number generation algorithm;

[0011] The first data provider combines the random number with the first data to obtain first intermediate data;

[0012] The first data provider encrypts the first intermediate data using the public key to obtain the first encrypted data.

[0013] In a possible implementation, it is characterized in that the semi-homomorphic encrypted data is calculated by the following formula:

[0014] Enc(a+b+c)=Enc(a)+Enc(b)+Enc(c)

[0015] Among them, Enc(a+b+c) represents semi-homomorphic encrypted data, Enc(a) represents first encrypted data, Enc(b) represents second encrypted data, and Enc(c) represents third encrypted data.

[0016] In a possible implementation, the semi-homomorphic encrypted data is sent by the first data provider through a secure transmission protocol.

[0017] The present application also provides a Paillier-based semi-homomorphic encryption device, which includes the following modules:

[0018] A key module, used to generate a public key and a private key for encryption based on the Paillier algorithm, wherein the public key and the private key have a corresponding relationship;

[0019] A sending module, used to send the public key to the first data provider, the second data provider and the third data provider respectively;

[0020] A receiving module, used for receiving semi-homomorphic encrypted data sent by a first data provider, wherein the semi-homomorphic encrypted data is generated by the first data provider based on the first encrypted data, second encrypted data sent by a second data provider, and third encrypted data sent by a third data provider, wherein the first encrypted data is obtained by the first data provider encrypting the first data based on the public key, the second encrypted data is obtained by the second data provider encrypting the second data based on the public key, and the third encrypted data is obtained by the third data provider encrypting the third data based on the public key;

[0021] A decryption module is used to decrypt the semi-homomorphic encrypted data using the private key to obtain first data, second data and third data.

[0022] In a possible implementation, the first encrypted data is generated by the following module:

[0023] A random number module, used by the first data provider to obtain a random number for encrypting the first data based on a random number generation algorithm;

[0024] A combining module, the first data provider is used to combine the random number with the first data to obtain first intermediate data;

[0025] The encryption module is used by the first data provider to encrypt the first intermediate data using the public key to obtain the first encrypted data.

[0026] In a possible implementation, the semi-homomorphic encrypted data is sent by the first data provider through a secure transmission module.

[0027] The present application also provides an electronic device, the electronic device comprising a processor and a memory:

[0028] The memory is used to store a computer program and transmit the computer program to the processor;

[0029] The processor is used to execute the steps of the above-mentioned Paillier-based semi-homomorphic encryption method according to the instructions in the computer program.

[0030] The present application also provides a computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program, and when the computer program is executed by an electronic device, the steps of the above-mentioned Paillier-based semi-homomorphic encryption method are implemented.

[0031] Compared with the prior art, this application has the following beneficial effects:

[0032] The semi-homomorphic encryption method based on the Paillier algorithm proposed in this application utilizes the semi-homomorphic characteristics of the Paillier algorithm to perform addition operations on ciphertext, which allows multiple data providers to jointly calculate without decrypting the data. When generating semi-homomorphic encrypted data, the first data provider does not need to decrypt the second encrypted data and the third encrypted data, thereby ensuring the security of the data. The semi-homomorphic encryption method of this application supports joint calculations of multiple data providers and has good adaptability and scalability. This flexibility enables the method to be widely used in various scenarios where data privacy needs to be protected. The semi-homomorphic encryption method based on the Paillier algorithm of this application has significant advantages in data privacy protection, computational efficiency, security, boundary and adaptability, and can effectively meet the urgent needs of modern society for data security and privacy protection. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0034] Figure 1 A flow chart of a Paillier-based semi-homomorphic encryption method provided for this application;

[0035] Figure 2 A schematic diagram of the structure of a Paillier-based semi-homomorphic encryption device provided in this application. DETAILED DESCRIPTION

[0036] As described above, when using semi-homomorphic encryption, the relevant technology usually encrypts the data separately by different data providers and then sends it to the data recipient. The data recipient also needs to decrypt the data provided by different data providers. The relevant technology is very cumbersome when using semi-homomorphic encryption. Therefore, how to make the existing semi-homomorphic encryption process simpler has become a technical problem that technicians in this field need to solve urgently.

[0037] After research, it was found that a data recipient may need to receive data sent by multiple data providers. This requires the data recipient to receive relatively fragmented data, which causes many inconveniences when decrypting. The data recipient needs to decrypt a large amount of fragmented data when decrypting the data, and the decryption process is very cumbersome. To this end, the present application provides a semi-homomorphic encryption method that makes the existing semi-homomorphic encryption process simpler.

[0038] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0039] It is understandable that the method provided in the present application can be applied to a processing device, which is a processing device that can perform encryption and decryption, such as a terminal device or server that can perform encryption and decryption. The method provided in the present application can be executed independently by a terminal device or a server, or can be applied to a network scenario in which a terminal device and a server communicate, and is executed by the cooperation of a terminal device and a server. Among them, the terminal device can be a computer, a mobile phone and other devices. The server can be understood as an application server or a Web server. In actual deployment, the server can be a stand-alone server or a cluster server.

[0040] Figure 1 A flow chart of a Paillier-based semi-homomorphic encryption method provided in this application, the method comprising the following steps:

[0041] S101: Generate a public key and a private key for encryption based on the Paillier algorithm.

[0042] The processing device generates a public key and a private key for encryption based on the Paillier algorithm, and the public key and the private key have a corresponding relationship. The algorithm that uses the public key and the private key for encryption is also called an asymmetric encryption algorithm. The encryption and decryption passwords of this algorithm are different, one is the public key and the other is the private key. The public key and the private key appear in pairs. The public key is called the public key, and the key that only you know is called the private key. Data encrypted with a public key can only be decrypted by the corresponding private key. Data encrypted with a private key can only be decrypted by the corresponding public key. If the public key can be decrypted, it must be encrypted by the corresponding private key. If the private key can be decrypted, it must be encrypted by the corresponding public key. The public key and the private key are relative, and there is no stipulation between the two that one must be the public key or the private key.

[0043] S102: Send the public key to the first data provider, the second data provider, and the third data provider respectively.

[0044] The processing device sends the public key to the first data provider, the second data provider, and the third data provider respectively, so that the first data provider, the second data provider, and the third data provider can encrypt data by using the public key.

[0045] S103: Receive semi-homomorphic encrypted data sent by the first data provider.

[0046] The processing device receives semi-homomorphic encrypted data sent by a first data provider.

[0047] The semi-homomorphic encrypted data is generated by the first data provider based on the first encrypted data, the second encrypted data sent by the second data provider, and the third encrypted data sent by the third data provider.

[0048] The first encrypted data is obtained by the first data provider encrypting the first data based on the public key, the second encrypted data is obtained by the second data provider encrypting the second data based on the public key, and the third encrypted data is obtained by the third data provider encrypting the third data based on the public key.

[0049] In a possible implementation, the first encrypted data may be generated in the following manner:

[0050] The first data provider obtains a random number for encrypting the first data based on a random number generation algorithm. The first data provider combines the random number with the first data to obtain first intermediate data. The first data provider encrypts the first intermediate data using a public key to obtain the first encrypted data.

[0051] The production process of the second encrypted data and the third encrypted data is similar and will not be described in detail here.

[0052] Semi-homomorphic encrypted data can be calculated using the following formula:

[0053] Enc(a+b+c)=Enc(a)+Enc(b)+Enc(c)

[0054] Among them, Enc(a+b+c) represents semi-homomorphic encrypted data, Enc(a) represents first encrypted data, Enc(b) represents second encrypted data, and Enc(c) represents third encrypted data.

[0055] S104: Decrypt the semi-homomorphic encrypted data using a private key to obtain first data, second data, and third data.

[0056] The processing device decrypts the semi-homomorphic encrypted data using the private key to obtain the first data, the second data, and the third data.

[0057] The semi-homomorphic encryption method based on the Paillier algorithm proposed in this application utilizes the semi-homomorphic characteristics of the Paillier algorithm to perform addition operations on ciphertext, which allows multiple data providers to jointly calculate without decrypting the data. When generating semi-homomorphic encrypted data, the first data provider does not need to decrypt the second encrypted data and the third encrypted data, thereby ensuring the security of the data. The semi-homomorphic encryption method of this application supports joint calculations of multiple data providers and has good adaptability and scalability. This flexibility enables the method to be widely used in various scenarios where data privacy needs to be protected. The semi-homomorphic encryption method based on the Paillier algorithm of this application has significant advantages in data privacy protection, computational efficiency, security, boundary and adaptability, and can effectively meet the urgent needs of modern society for data security and privacy protection.

[0058] The present application also provides a Figure 2 The structure diagram of the Paillier-based semi-homomorphic encryption device shown in FIG. 200 includes the following modules:

[0059] A key module 201, used to generate a public key and a private key for encryption based on a Paillier algorithm, wherein the public key and the private key have a corresponding relationship;

[0060] A sending module 202, used to send the public key to the first data provider, the second data provider and the third data provider respectively;

[0061] A receiving module 203 is used to receive semi-homomorphic encrypted data sent by a first data provider, wherein the semi-homomorphic encrypted data is generated by the first data provider based on the first encrypted data, second encrypted data sent by a second data provider, and third encrypted data sent by a third data provider, wherein the first encrypted data is obtained by the first data provider encrypting the first data based on the public key, the second encrypted data is obtained by the second data provider encrypting the second data based on the public key, and the third encrypted data is obtained by the third data provider encrypting the third data based on the public key;

[0062] The decryption module 204 is used to decrypt the semi-homomorphic encrypted data using the private key to obtain the first data, the second data and the third data.

[0063] The semi-homomorphic encryption method based on the Paillier algorithm proposed in this application utilizes the semi-homomorphic characteristics of the Paillier algorithm to perform addition operations on ciphertext, which allows multiple data providers to jointly calculate without decrypting the data. When generating semi-homomorphic encrypted data, the first data provider does not need to decrypt the second encrypted data and the third encrypted data, thereby ensuring the security of the data. The semi-homomorphic encryption method of this application supports joint calculations of multiple data providers and has good adaptability and scalability. This flexibility enables the method to be widely used in various scenarios where data privacy needs to be protected. The semi-homomorphic encryption method based on the Paillier algorithm of this application has significant advantages in data privacy protection, computational efficiency, security, boundary and adaptability, and can effectively meet the urgent needs of modern society for data security and privacy protection.

[0064] An embodiment of the present application also provides a Paillier-based semi-homomorphic encryption device, wherein the device includes a memory and a processor, the memory is used to store instructions or codes, and the processor is used to execute the instructions or codes, so that the device performs the steps of the Paillier-based semi-homomorphic encryption method described in any embodiment of the present application.

[0065] In practical applications, the computer-readable storage medium may be any combination of one or more computer-readable media, which may be a computer-readable signal medium or a computer-readable storage medium.

[0066] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device, or device.

[0067] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0068] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0069] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0070] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0071] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A semi-homomorphic encryption method based on Paillier, characterized in that: include: Generate a public key and a private key for encryption based on the Paillier algorithm, wherein the public key and the private key have a corresponding relationship; Sending the public key to the first data provider, the second data provider and the third data provider respectively; Receive semi-homomorphic encrypted data sent by a first data provider, where the semi-homomorphic encrypted data is generated by the first data provider based on the first encrypted data, second encrypted data sent by a second data provider, and third encrypted data sent by a third data provider, where the first encrypted data is obtained by the first data provider encrypting the first data based on the public key, the second encrypted data is obtained by the second data provider encrypting the second data based on the public key, and the third encrypted data is obtained by the third data provider encrypting the third data based on the public key; The semi-homomorphic encrypted data is decrypted using the private key to obtain first data, second data and third data.

2. The method according to claim 1, characterized in that The first encrypted data is generated in the following manner: The first data provider obtains a random number for encrypting the first data based on a random number generation algorithm; The first data provider combines the random number with the first data to obtain first intermediate data; The first data provider encrypts the first intermediate data using the public key to obtain the first encrypted data.

3. The method according to claim 1, characterized in that The semi-homomorphic encrypted data is calculated by the following formula: Enc(a+b+c)=Enc(a)+Enc(b)+Enc(c) Among them, Enc(a+b+c) represents semi-homomorphic encrypted data, Enc(a) represents first encrypted data, Enc(b) represents second encrypted data, and Enc(c) represents third encrypted data.

4. The method according to claim 1, characterized in that: The semi-homomorphic encrypted data is sent by the first data provider through a secure transmission protocol.

5. A semi-homomorphic encryption device based on Paillier, characterized in that: include: A key module, used to generate a public key and a private key for encryption based on the Paillier algorithm, wherein the public key and the private key have a corresponding relationship; A sending module, used to send the public key to the first data provider, the second data provider and the third data provider respectively; A receiving module, used for receiving semi-homomorphic encrypted data sent by a first data provider, wherein the semi-homomorphic encrypted data is generated by the first data provider based on the first encrypted data, second encrypted data sent by a second data provider, and third encrypted data sent by a third data provider, wherein the first encrypted data is obtained by the first data provider encrypting the first data based on the public key, the second encrypted data is obtained by the second data provider encrypting the second data based on the public key, and the third encrypted data is obtained by the third data provider encrypting the third data based on the public key; A decryption module is used to decrypt the semi-homomorphic encrypted data using the private key to obtain first data, second data and third data.

6. The device according to claim 5, characterized in that The first encrypted data is generated by the following modules: A random number module, used by the first data provider to obtain a random number for encrypting the first data based on a random number generation algorithm; A combining module, the first data provider is used to combine the random number with the first data to obtain first intermediate data; The encryption module is used by the first data provider to encrypt the first intermediate data using the public key to obtain the first encrypted data.

7. The device according to claim 5, characterized in that The semi-homomorphic encrypted data is sent by the first data provider through a secure transmission module.

8. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store the computer program; The processor is used to execute the computer program to implement the Paillier-based semi-homomorphic encryption method as described in any one of claims 1-4.

9. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the Paillier-based semi-homomorphic encryption method as described in any one of claims 1 to 4 is implemented.