As briefly mentioned in the previous article on the broad overview of secure multiparty computation, homomorphic encryption is one way to achieve secure Multiparty Computation (MPC). It is widely used to implement various MPC algorithms.
Homomorphic Encryption Definition
Let
where is a function to be computed and are the inputs.
is a homomorphic encryption function if:
In other words, homomorphic encryption functions allow one to perform computations on encrypted data. However, computation on the encrypted data gives you encrypted outputs, which are not useful unless they can be decrypted to produce sensible values. Therefore, homomorphic encryption functions need to come with a corresponding decryption function that can be used to recover the final encrypted results.
Let's denote the decryption function as , we should have the following relation:
Finding a pair of encryption and decryption functions () that would work perfectly regardless of what function is can be challenging. However, it is possible to create homomorphic encryption functions when restrictions are added to the form of function .
For example, suppose function can only consist of multiplications. The following set of homomorphic encryption-decryption functions might just work:
Where , and are some carefully chosen numbers so that for any given . For the curious readers, please refer to this WikiPedia page to learn about how these numbers are generated to satisfy the above equation.
To illustrate how this works, let's consider a simple function that only consists of multiplications. It is clear that:
This fulfills the requirement that .
For the decryption process:
We can indeed recover the correct result of multiplication from the output of computing function on the encrypted inputs.
The homomorphic system above, called unpadded RSA (since it leverages the RSA cryptosystem), is one example of the so-called partially homomorphic crypto systems. As the name suggests, they are "partial" because they don't work on any arbitrary function . There are many other partially homomorphic crypto systems which you can find here.
Homomorphic Encryption and Secure Multiparty Computation
Now you might wonder: how does homomorphic encryption help us achieve secure multiparty computation? The answer to this question requires some creativity as you would have to utilize homomorphic encryption in different ways under different circumstances. Let's illustrate with an example based on the unpadded RSA homomorphic crypto system.
Consider three people Alice, Bob and Charlie each holding on to some number , , that they wish to keep secret. They want to collectively compute the product of their numbers without revealing their individual numbers to each other. Their objective could be reached with the kind help of two other people Sarah and Nancy.
They proceed as follows:
- Sarah generates the unpadded RSA pair, and sends the function to Alice, Bob and Charlie.
- Alice, Bob and Charlie compute , , $c' = enc(c)` respectively and send them to Nancy.
- Nancy multiplies the numbers she received from Alice, Bob and Charlie to obtain