Communications and Network
Vol.11 No.01(2019), Article ID:90143,10 pages
10.4236/cn.2019.111001

Acceleration of Homomorphic Arithmetic Processing Based on the ElGamal Cryptosystem

Takuma Jogan1, Tomofumi Matsuzawa2, Masayuki Takeda2

1Department of Information Sciences, Graduate School of Tokyo University of Science, Tokyo, Japan

2Department of Information Sciences, Tokyo University of Science, Tokyo, Japan

Copyright © 2019 by author(s) and Scientific Research Publishing Inc.

This work is licensed under the Creative Commons Attribution International License (CC BY 4.0).

http://creativecommons.org/licenses/by/4.0/

Received: December 21, 2018; Accepted: January 21, 2019; Published: January 24, 2019

ABSTRACT

In recent years, opportunities for using cloud services as computing resources have increased and there is a concern that private information may be leaked when processes data. The data processing while maintaining confidentiality is called secret computation. Cryptosystems can add and multiply plaintext through the manipulation of ciphertexts of homomorphic cryptosystems, but most of them have restrictions on the number of multiplications that can be performed. Among the different types of cryptosystems, fully homomorphic encryption can perform arbitrary homomorphic addition and multiplication, but it takes a long time to eliminate the limitation on the number of homomorphic operations and to carry out homomorphic multiplication. Therefore, in this paper, we propose an arithmetic processing method that can perform an arbitrary number of homomorphic addition and multiplication operations based on ElGamal cryptosystem. The results of experiments comparing with the proposed method with HElib in which the BGV scheme of fully homomorphic encryption is implemented showed that, although the processing time for homomorphic addition per ciphertext increased by about 35%, the processing time for homomorphic multiplication was reduced to about 1.8%, and the processing time to calculate the statistic (variance) had approximately a 15% reduction.

Keywords:

ElGamal Cryptosystem, Homomorphic Cryptosystem, Delegating Computation

1. Introduction

With the recent development of cloud services, there has been a growing trend of outsourcing computational tasks. This gives rise to the important security issue of protecting privacy, since personal information is being transferred. To solve the problem, homomorphic cryptosystems capable of computing plaintext by the manipulation of ciphertexts have attracted attention.

Homomorphic cryptosystems include additive homomorphic encryption that can perform only homomorphic additions such as Paillier encryption and lifted-ElGamal encryption, and multiplicative homomorphic encryption that can perform only homomorphic multiplications such as RSA encryption and ElGamal encryption [1] [2] [3] . In addition, homomorphic cryptosystems that can perform both homomorphic addition and homomorphic multiplication are called fully homomorphic encryption (FHE) [4] . FHE has high convenience, but there is a problem that its processing speed is very slow.

Therefore, in this paper, we propose a system capable of both homomorphic addition and homomorphic multiplication based on the ElGamal cryptosystem by unifying the random number part normally included in ElGamal ciphertext with all ciphertexts. However, this situation raises concerns about a decline in security compared to the ordinary ElGamal cryptosystem. Hence, in the state other than homomorphic computation, it is in the form of ordinary ElGamal ciphertext. To accomplish this, we replace the value of r included in ElGamal ciphertext into constants or random numbers.

The rest of the paper is organized as follows. Homomorphic Cryptosystem is introduced in Section 2. In Section 3, ElGamal Cryptosystem is introduced. In Section 4, Fully Homomorphic Encryption is introduced. We propose an arithmetic processing method that can perform an arbitrary number of homomorphic addition and multiplication operations based on ElGamal cryptosystem in Section 5. Section 6 shows results of two experiments. Sections 7 - 9 draw discussion, future work, and conclusions.

2. Homomorphic Cryptosystem

A homomorphic cryptosystem can perform the addition and multiplication of plaintext by the manipulation of ciphertexts. When ciphertext E n c ( m 1 ) , E n c ( m 2 ) for plaintext m 1 , m 2 are given, E n c ( m 1 m 2 ) can be obtained without plaintext or a secret key, where is a binary operator such as addition or multiplication.

3. ElGamal Cryptosystem

The ElGamal cryptosystem is a public key cryptosystem based on the premise that a discrete logarithm problem of a group with a large order is difficult. ElGamal cryptosystem consists of three components: the key generator, the encryption algorithm, and the decryption algorithm.

Key generation

Generate a cyclic group G of order q which is a large prime number. Select a generator g of G and a random integer x from { 0, , q 1 } . Compute h as follows.

h g x ( mod q )

The public key is ( G , q , g , h ) and the secret key is x.

Encryption

To encrypt a message m G , we randomly select r { 0, , q 1 } and compute c 1 , c 2 G 2 as follows.

c 1 g r ( mod q )

c 2 m g x r ( mod q )

The ciphertext is ( c 1 , c 2 ) .

Decryption

To decrypt a ciphertext ( c 1 , c 2 ) G 2 , we compute m G as follows.

c 2 c 1 x = m g x r g x r = m ( mod q )

The plaintext is m.

4. Previous Rsearch

Fully Homomorphic Encryption

FHE is capable of arbitrary operations such as the addition and multiplication of plaintext by the manipulation of ciphertexts. When plaintext is encrypted, it adds constant noise according to security parameters. This noise increases with each homomorphic operation, and if the noise becomes too large, it becomes impossible to decrypt the ciphertext into the original plaintext. In particular, when homomorphic multiplication is performed, noise increases greatly. Therefore, developers created somewhat homomorphic encryption (SHE), which restricts the number of homomorphic multiplications. Then, in 2009, Gentry proposed Bootstrap as a method to reduce ciphertext noise in SHE. This makes it possible to take restrictions on SHE and implement FHE. However, Bootstrap is not practical from the viewpoint of processing speed because it greatly increases the number of calculations.

Since then, studies such as a method called packing for encrypting plural plaintexts into one ciphertext and a scheme for reducing noise of ciphertext without using Bootstrap are progressing [5] [6] . These have greatly improved the performance, but there is still a problem with processing speed.

Bootstrap

Bootstrap reduces noise accumulated in ciphertext by homomorphic operation. FHE makes the decipherability difficult to realize by adding noise to the ciphertext as the basis for security. This noise increases with each iteration of homomorphic operation, and if it exceeds a certain threshold value it can not decode correctly.

Bootstrap encrypts ciphertexts in which noise is stored again and performs decryption processing using the encrypted secret key. As a result of this decoding, a new ciphertext is accumulated in which only the noise required for decoding is stored. With this approach, Gentry realized the configuration of FHE.

5. Proposed Method

5.1. Overview

In this paper, we propose a method capable of both homomorphic addition and homomorphic multiplication based on the ElGamal cryptosystem. In the proposed method, the random number part normally included in ElGamal ciphertext is unified with all ciphertexts. This allows for both homomorphic addition and homomorphic multiplication. However, since this situation raises concerns about a decline in security compared to the ordinary ElGamal cryptosystem, in the state other than homomorphic computation, it is in the form of ordinary ElGamal ciphertext. Hereafter, the form of the ciphertext at the time of homomorphic operation is called “an arithmetic form”, and the form of the ciphertext in other case is called “a stored form”.

5.2. System Configuration

We propose a delegating computation model in which encrypted data are transmitted from the user to the cloud, and the cloud performs arithmetic processing on those encrypted data.

It is assumed that the cloud includes a calculation server and a transformation server. The calculation server performs arithmetic operations such as statistical processing in the encrypted state, and the transformation server replaces the value of r included in ElGamal ciphertext into constants or random numbers (Figure 1). Also, it is assumed that the user and the transformation server can safely share the secret key.

Figure 1 shows the system’s processing flow. First, the user transmits ElGamal ciphertexts that are stored form, to the calculation server, and the calculation server stores the data. Upon receiving the calculation request from the user, the calculation server exchanges data with the transformation server to convert the stored form of the ElGamal ciphertexts into the arithmetic form of the ElGamal ciphertexts. Then, the calculation server performs processing according to the calculation request by homomorphic operations, and obtains the calculation results of the encrypted state. Then, the calculation server exchanges data with the transformation server to converts the arithmetic form of the ElGamal ciphertexts into the stored form of the Elgamal ciphertexts. Finally, the stored form of the encrypted operation result is transmitted to the user, and the user decrypts it using a secret key to obtain the calculation result. If multiple processing contents are included in the calculation request, the same procedure is repeated (Figure 2).

We assume the roles of the user, the calculation server, the transformation server, the constraints imposed, and the functions as follows.

User

・ Know the plaintext

Figure 1. System configuration.

Figure 2. Process flow of the calculation request.

・ Encrypt the plaintext and send the encrypted data to the calculation server

・ Have a secret key

Calculation Server

・ Can not get the plaintext

・ When encrypted data are transmitted to the transformation server, they are multiplied by a random number

・ Do not collaborate with the transformation server

・ Do not have a secret key

Transformation Server

・ Can not get the plaintext

・ When plaintext are transmitted to the calculation server, it is multiplied by a random number

・ Do not collaborate with the calculation server

・ Have a secret key

5.3. Homomorphism

In the arithmetic form of ciphertext, we unify the value of r included in ElGamal ciphertext by all ciphertexts. As a result, the arithmetic form of the ciphertext satisfies both additive homomorphism and multiplicative homomorphism.

Given ciphertexts c 1 = ( c 11 , c 12 ) = ( g r , m 1 g x r ) ,
c 2 =( c 21 , c 22 )=( g r , m 2 g xr ) where m 1 , m 2 G .

Additive Homomorphism

Compute ciphertext for m 1 + m 2 as follows.

c 12 + c 22 = m 1 g x r + m 2 g x r = ( m 1 + m 2 ) g x r

Then, using c 11 = c 21 = g r , output ( g r , ( m 1 + m 2 ) g x r ) .

Multiplicative Homomorphism

Compute ciphertext for m 1 m 2 as follows.

c 12 c 22 = m 1 g x r m 2 g x r = ( m 1 m 2 ) g 2 x r

Then, compute c 11 c 21 = g 2 r and output ( g 2 r , ( m 1 m 2 ) g 2 x r ) .

5.4. Conversion Processing of Ciphertext

We show the method of mutual conversion between the arithmetic and the stored forms of ciphertext.

Conversion from Stored to Arithmetic Form

Given ( c i 1 , c i 2 ) = ( g r i , m i g x r i ) where i q , m i G , r i is a random number:

1) The calculation server generates a random number α i G and sends ( c i 1 , α i c i 2 ) to the transformation server.

2) The transformation server decrypts the received ciphertexts:

α i c i 2 c i 1 x = α i m i g x r i g x r i = α i m i

3) The transformation server generates ciphertexts from α i m i and random number r G and send them to the calculation server. r is generated while encrypting α 1 m 1 , and the same r is used for encryption of α i m i ( i = 2 , 3 , ) . Also, when multiple processing contents are included in the calculation request, a different r is used for each processing content:

( c i 1 , c i 2 ) = ( g r , α i m i g x r )

4) The calculation server removes the random number α i from the received ciphertexts and computes ( g r , m i g x r ) .

Conversion from Arithmetic to Stored Form

Given ( c i 1 , c i 2 ) = ( g r , m i g x r ) where i q , m i G , r is a constant number:

1) The calculation server generates a random number β i G and sends ( c i 1 , β i c i 2 ) to the transformation server.

2) The transformation server decrypts the received ciphertexts:

β i c i 2 c i 1 x = β i m i g x r g x r = β i m i

3) The transformation server generates ciphertexts from β i m i and random number r i G and sends them to the calculation server:

( c i 1 , c i 2 ) = ( g r i , β i m i g x r i )

4) The calculation server removes the random number β i from the received ciphertexts and computes ( g r i , m i g x r i ) .

6. Experiment

6.1. Overview

In this experiment, as the performance evaluation of the proposed method, statistical processing using homomorphic computation is performed and its processing time is measured. As a comparison target, HElib on which the BGV scheme of FHE is implemented was used. HElib is an open source library published by IBM and available in C ++. Also, implementation of the proposed method was done in C.

Experiment 1

We measure the processing time of homomorphic addition and homomorphic multiplication. We also measured the processing time of mutual conversion of the ciphertext between stored and arithmetic forms.

Experiment 2

We computed the variance of 1000 - 10,000 data items and measured the processing time. We converted the stored form to arithmetic form, performed statistical processing, and converted the arithmetic form to a stored form. Then, we measured the time taken for this series of flows.

6.2. Experiment Environment

The experimental environment was as follows.

・ OS: Ubuntu 18.04.1 LTS

・ CPU: Intel(R) Core(TM) i7-4790 CPU @ 3.60 GHz

・ Memory: 4 GB

・ Compiler: gcc 7.3.0, g++ 7.3.0

・ Library: NTL-11.0.0, GMP-5.0.4

・ Security: 1024 bit

6.3. Dataset

As an experimental data set, we used the “Adult” labeled dataset provided by UCI. This data set contains 32,561 data items divided by 14 attributes such as age, gender, race, etc. In the experiment, we used the age attribute.

6.4. Results

Experiment 1

We measured the processing time for homomorphic addition and homomorphic multiplication (see Table 1). In homomorphic addition and homomorphic multiplication of HElib, it is not the processing time required for homomorphic operation between packed ciphertexts. It is the processing time of homomorphic operation per ciphertext calculated by dividing the processing time by the number of slots.

Experiment 2

We measured the processing time taken to calculate the variance by homomorphic operations. Table 2 and Figure 3 show the transition of the processing time when the number of data items changes from 1000 to 10,000 in increments of 1000.

7. Discussion

Experiment 1

Table 1. Processing time (homomorphic addition, homomorphic multiplication, and conversion).

Table 2. Processing time (variance).

Figure 3. Transition of the processing time (variance).

We measured the processing time for homomorphic addition and homomorphic multiplication and conversion. In the processing time of homomorphic addition, the proposed method required about 135% processing time compared with HElib, but the homomorphic multiplication reduced the processing time to about 1.8%.

Experiment 2

We measured variance was obtained using 1000 - 10,000 data items and we measured the processing time. In Figure 2, the respective approximate straight lines are obtained, where the value of the vertical axis is y and the value of the horizontal axis is x, HElib is represented by y = 0.176 x + 5.455 , and the proposed method is represented by y = 0.107 x + 0.002 .

8. Future Work

We need to improve the security of the proposed method in which we convert from a stored form to an arithmetic form before the homomorphic operation. In arithmetic form, the value of r included in the ElGamal ciphertext ( g r , m g x r ) is unified in all ciphertexts. Therefore, when ElGamal ciphertexts c 1 = ( c 11 , c 12 ) = ( g r , m 1 g x r ) , c 2 = ( c 21 , c 22 ) = ( g r , m 2 g x r ) where m 1 , m 2 G , are given, they satisfy the following.

c 22 c 12 = m 2 m 1

Since the ratio of the plaintext can be obtained from the ratio of the ciphertexts, if any plaintext is deprived in any way, all the plaintexts will leak out. However, when converting to a stored form again and converting it to an arithmetic form from it, the value of r is unified in all ciphertexts, but it can be changed to a value different from the value of r before conversion.

9. Conclusion

In this paper, we propose the acceleration of homomorphic arithmetic processing based on the ElGamal cryptosystem and present experiments, evaluation, and discussion. The results of experiments comparing the proposed method with HElib showed that, although the processing time for homomorphic addition per ciphertext increased by about 35%, the processing time for homomorphic multiplication was reduced to about 1.8%, and the processing time to calculate the statistic (variance) had approximately a 15% reduction.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

Cite this paper

Jogan, T., Matsuzawa, T. and Takeda, M. (2019) Acceleration of Homomorphic Arithmetic Processing Based on the ElGamal Cryptosystem. Communications and Network, 11, 1-10. https://doi.org/10.4236/cn.2019.111001

References

  1. 1. Paillier, P. (1999) Public-Key Cryptosystems Based on Composite Degree Residuosity Classes. Proceedings of the EUROCRYPTO’99, Lecture Notes in Computer Science, 1592, 223-238. https://doi.org/10.1007/3-540-48910-X_16

  2. 2. Rivest, R.L., Shamir, A. and Adleman, L. (1978) A Method for Obtaining Digital Signatures and Public-Key Cryptosystems. Communications of the ACM, 21, 120-126. https://doi.org/10.1145/359340.359342

  3. 3. Elgamal, T. (1985) A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms. IEEE Transactions on Information Theory, 31, 469-472. https://doi.org/10.1109/TIT.1985.1057074

  4. 4. Gentry, C. (2009) A Fully Homomorphic Encryption Scheme. Doctoral Dissertation, Stanford University, Stanford.

  5. 5. Smart, N.P. and Vercauteren, F. (2010) Fully Homomorphic Encryption with Relatively Small Key and Ciphertext Sizes. PKC, 420-443. https://doi.org/10.1007/978-3-642-13013-7_25

  6. 6. Brakerski, Z., Gentry, C. and Vaikuntanathan, V. (2011) Fully Homomorphic Encryption without Bootstrapping. IACR Cryptology ePrint Archive, Report 2011/277.