Fully Homomorphic Encryption Scheme With Symmetric Keys
Fully Homomorphic Encryption Scheme With Symmetric Keys
A
Dissertation
submitted
in partial fulfillment
for the award of the Degree of
Master of Technology
in Department of Computer Science & Engineering
(with specialization in Computer Engineering)
Supervisor: Submitted by:
C. P. Gupta Iti Sharma
Asso. Prof & Head, CSE Enrollment No.: 11E2UCCSF4XP606
Department of Computer Science & Engineering
University College of Engineering,
Rajasthan Technical University, Kota
August 2013
ii
CANDIDATES DECLARATION
I hereby declare that the work, which is being presented in the Dissertation, entitled Fully
Homomorphic Encryption Scheme with Symmetric Keys in partial fulfillment for the
award of Degree of Master of Technology in Department of Computer Science and
Engineering with Specialization in Computer Engineering and submitted to the
Department of Computer Science and Engineering, University College of Engineering,
Rajasthan Technical University is a record of my own investigations carried under the
Guidance of C. P. Gupta, Asso Prof & Head, Department of Computer Science and
Engineering, UCE, Kota.
I have not submitted the matter presented in this Dissertation anywhere for the award of any
other Degree.
Iti Sharma
Computer Engineering
Enrollment No.: 11E2UCCSF4XP606
University College of Engineering, RTU, Kota.
Counter Signed By
..
C. P. Gupta,
Asso. Prof. and Head, CSE Dept
iii
CERTIFICATE
This is to certify that this dissertation entitled Fully Homomorphic Encryption with
Symmetric Keys has been successfully carried out by Iti Sharma (Enrollment
No:11E2UCCSF4XP606), under my supervision and guidance, in partial fulfillment of the
requirement for the award of Master of Technology Degree in Computer Engineering from
University College of Engineering, Rajasthan Technical University, Kota for the year
2011-2013.
Place: Kota Supervisor
Date: C. P. Gupta
Asso. Prof. & Head, CSE Dept
iv
Acknowledgment
It is my great privilege to express sincere gratitude & thanks to my supervisor C. P. Gupta,
Associate Professor & Head, Department of Computer Science & Engineering, UCE, RTU,
Kota for his valuable guidance during each and every phase of this work. The keen
observation and motivating style of critique and compliment kept me stimulated towards
perfection. I thank him for the interest and energy that was committed to the dissertation and
for allowing me a wide academic freedom.
I would also thank my family for their help, support and patience. Not in the least I would
thank Almighty for blessing me.
Iti Sharma
Computer Science Engineering
Enrollment No.: 11E2UCCSF4XP606
University College of Engineering,
RTU, Kota(Raj)
v
List of Symbols and Notations
q
Z finite field of integers of order q
( )
n q
M Z square matrix of dimension n with elements from
q
Z
|| concatenation of bit strings
| concatenation of matrices of equal number of rows, column-wise
$
a A randomly select an item a from set A
$,
1...
n
n
a A randomly select n items from set A
1
A
inverse of matrix A
A.B multiplication of two matrices A and B
Enc(x,k) Encryption of plaintext x under key k
Dec(c,k) Decryption of ciphertext c under key k
( ) O
.
Lemma 1: Given m and where (poly( )) m O = , it is possible to obtain 2m odd mutually
prime numbers of length 2 bits in polynomial time.
Proof: By Prime Number Theorem, there are approximately
ln
x
x
prime numbers p x .
Consider primes of length b bits, then there are
2
ln 2
b
b
primes of length maximum b bits.
Thus, total number of primes of length exactly b bits are
1
1
2 2
ln 2 ln 2
b b
b b
1
1 2 2
ln2 1
b b
b b
(
(
1
1 2
. .2
ln 2 ( 1)
b
b
b b
.
27
Thus, when we are finding 2m primes of length b bits, at any point there are at least
1
1 2
. .2 2
ln 2 ( 1)
b m
b
b b
primes left of length b bits. Since total numbers of exact length b bits is
1 1
2 2 2
b b b
= , the probability that a random number chosen is prime is
1
1
1 2
. .2 2
ln 2 ( 1)
2
b m
b
b
b b
=
1
1 2 2
.
ln 2 ( 1) 2
m
b
b
b b
.
For b= 2 , this gives
4
1 2 8
.
ln 2 ( 1)
2
m
.
If m is a polynomial in and
4
2 m
, where
i
p and
i
q are mutually prime odd numbers of length
2 bits, a random matrix
4
( )
N
K M Z is invertible with non-negligible probability.
Proof: As seen in Lemma 3, we need to choose a matrix
4
( )
N
K M Z such that. Since the
distribution of values of
of all matrices in
4
( )
N
M Z is not known, we cannot have a formal
proof for this Lemma. Hence we provide an analytical proof. We pick random 100 matrices
from the field and check for its invertibility. The experiment is repeated five times for a
particular value of N, and is performed for various values of N. Fig 4.1 shows the number of
invertible matrices varying with value of N. Fig 4.1(a) shows that for small values of N the
probability of a random matrix being invertible is not high, but as we increase N, this
probability shoots up. The 2m factors of N here are all prime numbers. Fig 4.1(b) shows
when all 2m factors are mutually prime numbers, the probability is as high as is Fig 4.1(a).
Hence we can deduce that probability of finding an invertible matrix is non-negligible for
large values of N.
29
Figure 4.1(a) Variation of Number of invertible matrices with value of N, all factors prime
Figure 4.1(b) Variation of Number of invertible matrices with value of N, all factors mutually prime
4.2 Design Concept
The basic concept is to translate operations on integers in a ring
N
Z to operations in
ring
4
( )
N
M Z . Thus, all operations are on square matrices of size 4, which are sufficiently
small to be used practically. In the context of making a homomorphic scheme to be useful
enough, we propose a scheme with following set of operations:
Cryptographic functions: Functions to generate the symmetric key, encrypting a
plaintext, and decrypting a Ciphertext.
Evaluation operations: To perform any arbitrary operation on data homomorphically,
we need to translate it into these basic evaluation operations and then evaluate.
30
Application specific functions: These functions provide facilities, like key translate
function, recryption etc, for the schemes adaptation to an application scenario.
The main idea is to construct a matrix with eigenvalue equal to the plaintext x. This can be
very simply achieved with matrices of size 2, in ring
2
( )
N
M Z where N=pq, p and q being two
large prime numbers, as follows:
1
0
( ) mod
0
x
E x N
r
| |
=
|
\
The major fallacy here is that x is eigenvalue of eigenvector
1,0
1
0
v
| |
=
|
\
. An adversary with a
ciphertext has to simply solve a linear equation system
1 1,0 1,0
( ). . E x v x v =
to obtain x. to
mitigate this problem we can apply a similarity transform to
0
0
x
r
| |
|
\
, governed by an
invertible matrix k, called the key. The scheme is now
1
2
0
( , ) mod
0
x
E x k k k N
r
| |
=
|
\
Though an adversary now cannot establish a linear equation system for transformed
eigenvectors, it can very well derive the characteristic equation
2
2
det( ( , )) 0 mod
( ) 0 mod
zl E x k N
z x r z xr N
+ +
Though it is infeasible to solve this equation without factorizing N, which is hard. Yet, a
chosen plaintext attack is possible by merely two chosen plaintext-ciphertext pairs.
To thwart the chosen plaintext attack, we need to associate x with two eigenvectors
1
v
and
2
v
.
All plaintexts should have same
1
v so that homomorphic operations are possible.
Different
2
v
=
Keygen
4
(m, )
1. Choose 2m odd numbers
i
p and
i
q , 1 i m , which are mutually prime and of size
2 bits.
2. Let
i i i
f p q =
and
1
m
i
i
N f
=
=
.
3. Pick an invertible matrix k of size 4,
4
( )
N
k M Z
4. Compute its inverse as k
-1
modulo
N
Z .
5. Output
1
, , ,
i
f N k k
as Ktuple.
33
4.3.3 Decryption
This is a single step process which involves applying inverse transformation on the
Ciphertext matrix and then extracting the plaintext as first element of the diagonal matrix
obtained.
The correctness of the decryption algorithm is proven below.
Lemma 5: Encryption scheme (KeyGen, Enc, Dec) is correct.
Proof: We know that k* k
-1
= k
-1
* k =I and for any matrix A, A*I=I*A=A.
It is easy to note that Dec(C, k) =
1
11
( * * ) k C k
=
1 1
1 2 3 11
( * * ( , , , )* * ) k k diag x x x x k k
=
1 2 3 11
( ( , , , )) diag x x x x
= x
This proves the lemma.
Example 4.1
We present here a toy example for illustration of the method by selecting lowest prime
numbers. Let m=2, let p={3,5} and q={7,11}. This gives f
1
= 21, f
2
= 55 and N= 1155.
For these parameters, suppose the Keygen function generates a key
333 1009 1093 394
566 870 285 192
305 642 456 407
326 1103 363 837
k
(
(
(
=
(
(
with inverse as
1
33 929 342 393
963 100 1113 161
202 88 1042 976
906 1051 944 441
k
(
(
(
=
(
(
To encrypt plaintext x=257, we construct diagonal matrix as follows:
Dec(C, Ktuple
2-4
)
Output the plaintext as
1
11
( ) x kCk
= .
34
Select random number r = 291. The matrix X is
291 257 291
291 291 257
X
(
=
(
This gives us the linear congruences as follows:
1
1
291mod 21
291mod55
x
x
,
2
2
257 mod 21
291mod55
x
x
,
3
3
291mod 21
257 mod55
x
x
The solution to congruences are 291, 236 and 312 respectively. Encryption proceeds as:
1
464 206 422 308
585 467 885 945
* (257, 291, 236, 312) *
957 752 1119 882
315 1136 270 201
C k diag k
(
(
(
= =
(
(
Decryption is done as
1
11
11
257 0 0 0
0 291 0 0
[ * * ] 257
0 0 236 0
0 0 0 312
x k C k
(
(
(
= = =
(
(
4.3.4 Evaluation
There is only one general evaluation function defined for computation f. It is expected that f
be translated into basic operations on integers. Actual implementation involves analogous
operations on matrices. Namely, to perform addition/subtraction/multiplication/division of
two numbers homomorphically, we add/subtract/multiply/divide their ciphertexts simply as
two matrices.
1 2
Eval( , , ... )
n
Y f C C C performs computation f on operands C
1
, C
2
...C
n
.
Our evaluation function doesnt require any evaluation key. Note that all operations on
matrices are also performed within the ring
4
( )
N
M Z . To illustrate homomorphic operation, we
present following example.
Example 4.2
Consider addition of two integers. Let m=2, let p={3,5} and q={7,11}. This gives f
1
=
21, f
2
= 55 and N= 1155. For these parameters, suppose the Keygen function generates the
key:
35
366 826 315 660
224 398 457 165
1063 849 492 597
401 1083 114 496
k
(
(
(
=
(
(
with inverse as
1
1083 213 1 1053
1093 792 84 342
307 784 877 471
300 375 874 613
k
(
(
(
=
(
(
To add two numbers, viz 5 and 12, we encrypt them using key k, and obtain following
ciphertexts.
1
286 618 534 180
954 662 651 765
Enc(5,k)=
122 1131 428 450
825 285 1020 196
C
(
(
(
=
(
(
,
2
877 813 768 1122
60 1149 1152 33
Enc(12,k)=
507 245 304 759
472 531 828 150
C
(
(
(
=
(
(
Now, we add the ciphertexts instead of adding plaintexts.
1 2
8 276 147 147
1014 656 648 798
629 229 732 54
142 816 693 346
C C C
(
(
(
+ = =
(
(
The resultant C is treated as a ciphertext and decrypted as usual.
1
1 2 11
11
17 0 0 0
0 408 0 0
( .( ) ) 17
0 0 1079 0
0 0 0 238
y k C C k
(
(
(
= + = =
(
(
As can be easily observed that the decryption (17) is actually the result of addition of the two
plaintexts (5 and 12). Thus illustrating that the scheme is additively homomorphic.
Now, we multiply the ciphertexts C1 and C2.
36
1 2
265 150 180 897
180 1005 450 933
*
185 775 500 609
82 816 933 360
C C C
(
(
(
= =
(
(
The resultant C is treated as a ciphertext and decrypted as usual.
1
1 2 11
11
60 0 0 0
0 440 0 0
( .( ) ) 60
0 0 673 0
0 0 0 957
y k C C k
(
(
(
= + = =
(
(
As can be easily observed that the decryption (60) is actually the result of multiplication of
the two plaintexts (5 and 12). Thus illustrating that the scheme is multiplicatively
homomorphic.
Thus, our scheme is fully homomorphic.
4.3.5 Selecting N
We assume a security parameter in context of making the scheme IND-CPA secure, that is
in order to withstand
number of plaintext attacks we choose m and such that
ln poly( ) m = , where poly( ) denotes a fixed polynomial in . N is computed as
product of 2m numbers. Xiao et al in [3] propose all these 2m numbers to be distinct and
prime. We modify or relax this requirement to have 2m mutually prime numbers. Moreover,
[3] allows N to be even (that is prime number 2 is allowed), which is dropped in our scheme.
Thus, N is product of 2m numbers which are odd, mutually prime.
Furthermore, the fact that these 2m numbers could now be composite implies that total
number of prime factors of N is more than 2m, thus making scheme more secure (now N
needs to be factorized into 2m composite factors). As we will discuss in a later section that
security of the scheme is derived from the hardness of the problem of factorizing a large
integer. The original scheme [3] has a vulnerability that capturing few ciphertexts may
disclose the approximate length of N in bits. In order to benefit from hardness of factorization
we increase value of m, implying that we increase the number of factors of N. But m is bound
by length of N, hence to increase the number of prime factors of N, we can make these 2m
37
factors composite. Thus, we will have benefit of increasing the number of prime factors of N
without increasing m.
4.4 Application-specific Primitives
The proposed scheme has primitives which would be useful when using this scheme for
delegation of computation. These primitives derive their functionality from properties of
matrices but are homomorphic in nature. They can be combined with homomorphic
encryption or other encryption techniques for certain practical applications.
4.4.1 Lock-Unlock Operations
In order to evaluate a function homomorphically we need all inputs to be encrypted using
same key. Moreover, decryption should also be performed using same key for retrieving
result. This leads to natural asking for a method to calculate homomorphically on ciphertexts
encrypted by altogether different keys, or atleast related keys but not same key. In this section
we introduce primitives which can be used to convert ciphertexts from one key to ciphertext
of other key. Also, how to generate a set of related keys so that operations can be performed
on ciphertexts encrypted by them can be used in computations in some order and final result
is decrypted easily using yet another key.
For any matrix A and an invertible matrix k, Lock operation is defined as
Thus, Lock outputs a randomization of the input matrix under k. It is same as the last step of
encryption algorithm. Analogously, Unlock inverts this similarity transformation as in
decryption algorithm.
The exact application is discussed in next chapter. The beauty of this scheme is its simplicity
and adaptability to a multikey scenario. Also, the operations are not to be performed
necessarily in the order of Lock and then Unlock. We can also have Unlock followed by
Lock (ie Unlock(B,k) to obtain A and then Lock(A,k) to get B.)
Unlock(B, Ktuple
2-4
)
Output the matrix as
1
* * A k C k
= .
Lock(A, Ktuple
2-4
)
Output the matrix as
1
* * B k C k
= .
38
4.4.2 Key Set Generation
For certain multi-user scenarios we need symmetric keys of different levels, in other words
we need individual and group keys separately. Yet we desire to have some interoperability
among these. Function KeySetGen generates the key matrices which can be used for
encryption and Lock-Unlock operations with the property that it produces a set of matching
keys.
A set ( , ', '', ''') k k k k is said to be a set of matching keys if '* ''* ''' k k k k = holds, where k is
generally referred to as a master key. This is a three level set. We may also use a two level set
in certain applications, that is ( , ', '') k k k where '* '' k k k =
This notion of matching keys is also useful when we want to link computations in some
order, and at every step of computation the input argument is encrypted using a different key.
4.5 A Multiparty Protocol for Privacy Preserving Data Processing
4.5.1 System Model
We consider a system model similar to [24] where cooperation of several entities makes the
arbitrary times of the homomorphic calculations more efficient. We drop the assumption of
non-colluding entities; rather we present a scheme which is collusion-resistant. We assume
the processing to be done on data as arithmetic operations within ring Z
N
.
KeySetGen
s
(l, m, )
1. Choose 2m odd numbers
i
p and
i
q , 1 i m , which are mutually prime and of size
2 bits.
2. Let
i i i
f p q =
and
1
m
i
i
N f
=
=
.
3. Pick l invertible matrices
(1) (2) ( )
( , ,..., )
l
k k k of size s,
( )
( )
i
s N
k M Z
4. Compute
( )
1
l
i
i
k k
=
=
5. Output
(1) (2) ( )
, , , ( , ,..., )
l
i
f N k k k k as Keyset.
39
Figure 4.2 Privacy Preserving Data Processing: System Model and Protocol
The role and functions of entities (refer Fig 4.2) involved in data processing are as follows:
1. Data owner- possesses raw data which is not disclosed to others. Data owner is
responsible for encrypting and masking data and has both encrypt and lock
functionality.
2. Processing center- has two divisions. The delegator division tells which data is
required for certain computation and how to mask it. It has keyset generation
functionality. The mapping division maps results from computation center to be
consumed by certain user. It has only Lock functionality and obtains key from
Delegator division.
3. Computation center- performs calculations which are requested by the data user. It
has access to masked data but not keys. It receives ciphertexts and formula. Sends
40
final result to mapping division of processing center. It has only evaluation
functionality.
4. Data user has intention of performing some computation on data currently owned by
data owner. Data user receives only the final result and cannot know any intermediate
result or raw data. It has functionality of decryption.
Our goal is computing f(P) where f is a function compose of addition and multiplication, and
P=(x
1
,x
2
,x
n
) is input data. We need to compute the result while keeping P secret. Also,
function f is divided into several additions and multiplications, and computation is executed
step by step (Note that this is same as Eval function).
Security of the scheme is intuitive as entity which can access encrypted data does not have
decryption key, and entity with decryption key are prohibited from accessing encrypted data.
In a public key cryptosystem this arrangement would be susceptible to a collusion attack if
two entities possessing decryption key and encrypted data decide to collude. But as we will
see here these keys are not same in this scheme and hence it is collusion-resistant.
4.5.2 Multiparty Protocol
The protocol (refer Fig 4.2) for evaluating a function f(x
1
,x
2
,x
n
) is:
1. Data owner has data encrypted by key k
(1)
, as
(1)
Enc( , )
i i
Y x k
2. Delegator prepares a list of data which is required for computation and sends it to data
owner. Actually it can send the required indices 1n. [Note that the sent indices have
been renumbered for comprehensibility as 1n and need not be actually continuous.]
3. Data owner masks the data as
(2)
Lock( , )
i i
Z Y k
4. Computation center performs f to produce result as
1 2
Eval( , , ... )
n
Z f Z Z Z and sends it
to Mapping division.
5. Mapping division converts Z as
(3)
' Lock( , ) Y Z k
6. Data user retrieves result as Dec( ', ) y Y k
Here, the keys k
(1)
, k
(2)
, k
(3)
and k are matching keys with k as master key, generated by
KeySetGen.
As can be observed no key is sent to the Computation Center. The keys of data user and
mapping division if combined cannot reveal k
(1)
, the actual encryption key. Thus, the protocol
is resistant to collusion.
41
4.6 Performance
4.6.1 Complexity of Algorithms
We need to choose 2m primes in the encryption scheme. The encryption algorithm requires
both two matrix multiplications and also an algorithm to solve the m linear congruences that
define the values a, b, and c. It takes time ( ) O m to construct the solution to these linear
congruences. Multiplication has time complexity ( log log log ) O m m m . So the overall
complexity for encryption is ( log log log ) O m m m . The decryption algorithm involves
only two matrix multiplications, thus having same time complexity.
Considering the complexity of the multiplication and addition algorithms, observe the size of
the integers in the ring
N
Z . The value N is the product of m numbers of length bits, so it is
approximately an m bit number. There exist efficient algorithms for multiplication of b bit
integers with complexity ( log loglog ) O b b b . For b m =
this
becomes ( log log log ) O m m m . Addition is linear and thus has complexity ( ) O m .
4.6.2 Computational Overhead
Homomorphic evaluation of a function is efficient if it has a low computation overhead. The
overhead is defined as the ratio of the time taken for a computation homomorphically over
ciphertext to the time taken to compute on plaintext. If a computation consists only of
addition, adding two integers homomorphically in our scheme implies adding two matrices.
This gives a constant overhead of 16, since we have to add two matrices of size 4, containing
16 numbers. If a computation consists only of multiplication, multiplying two integers
homomorphically implies multiplying two matrices, which means 64 additions and 64
multiplications. Since N is a b bit number, cost of multiplying two numbers is O(b
2
). Thus
giving computation overhead O(b) or ( ) O m .
Hence, we conclude that our scheme has a worst case computation overhead ( ) O m that is
varying linearly with the security parameter.
4.6.3 Plaintext Expansion
An integer is encrypted into a matrix of 16 numbers, resulting into a constant expansion
factor of 16. It does not vary with bit length of N, and is independent of other security
parameters.
42
Table 4.1 shows comparison between our proposed scheme and other popular FHE schemes
with respect to the performance characteristics.
TABLE 4.1
COMPARISON OF PROPOSED SCHEME WITH OTHER FHE SCEHMES
DGHV BGV Our Scheme
Key Size
10
( ) O
Equal to plaintext ( ) O m
Computation
Overhead
3.5
( )
2
( ) O
( ) O m
Plaintext Expansion (log ) O
3
( ) O
(1) O
actually 16
4.7 Security
We shall discuss security of our scheme in terms of key recovery, onewayness, semantic
security and indistinguishability. Then we proceed towards proving that the scheme is CPA
secure.
4.7.1 Security against Key Recovery
In plain words this means that the knowledge of the cipher text must not allow adversaries to
retrieve the key. Since for our scheme ciphertext does not reveal anything about key except
its length, security against key recovery amounts to security against brute force attack.
Key for our scheme is a l l matrix in ring Z
N
, which leads to
2
l
N possibilities of a key
matrix. The probability that a random generated matrix is a key is
2
1
l
N . Checking whether a
random matrix is the key or not, involves two matrix multiplications which implies (l
2
)
operations per multiplication. Given N is b bits long, the complexity of brute force attack is
2
2
( .2 )
bl
l . Table 4.2 gives the equivalent security level for different parameter values. It can
be easily observed that our scheme is secure against brute-force attack even with smallest
parameters.
43
TABLE 4.2
BRUTE-FORCE SECURITY OF PROPOSED SCHEME
Length of N (in bits) Equivalent security
10 2
172
16 2
268
18 2
300
4.7.2 One-way security
This implies that given a ciphertext an adversary should not be able to retrieve the
corresponding plaintext. Since ciphertext is a randomization of the plaintext, and not a direct
linear(or polynomial) function of the plaintext, in order to retrieve plaintext from ciphertext
an adversary has to invert the similarity transformation and then only can any other linear
algebraic methods can be useful to retrieve plaintext.
Let us assume that certain permutation of identity matrix K
I
can be used to invert the
transformation by following operation: C'= K
I
C K
I
-1
,where C is given ciphertext. To obtain
plaintext from C' the adversary must be able to factorize N, that is adversary can retrieve
plaintext only by solving congruences using Chinese Remainder Theorem, but for that it
needs factors of N. Thus, oneway security of our scheme can be reduced to hardness of
factorization N. As per Lemma 2, this cannot be done with a nonnegligible probability. Thus,
onewayness security reduces to hardness of Large Integer Factorization problem.
Formally we prove this security using following lemmas.
Lemma 6: For 1<i<N, there exists a unique element k
i
GL
4
(Z
N
) so that
0 1 0 0
1 0 0 0
mod , mod , mod ,
0 0 0 1
0 0 1 0
i i i i i j
k p k I q k I f j i
(
(
(
= = =
(
(
,
where I is the identity matrix in GL
4
(Z
N
). Additionally,
1
i i
k k
= .
44
Proof: The first claim follows directly from Chinese Remainder Theorem, as p
i
is a factor of
N, and f
j
=p
j
q
j
is also a factor of N. Further, we see
2
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
i
k
(
(
(
=
(
(
which implies
1
i i
k k
= .
Lemma7: Given plaintext x, key k and random element r, there exists y and random element
s such that E(x,k)= E(y, k
i
k).
Proof: Here we note that the diagonal matrix constructed during encryption of plaintext x is
like ( , , , ) X diag x a b c = and it satisfies the congruences ( , , , ) mod
i i i i
X diag x a b c f =
, so
1 1
. . mod . ( , , , ). mod ( , , , ) mod
i i i i i i i i i i i i i
k X k p k diag x a b c k p diag a x b c p
= =
Also,
1
. . mod . . mod mod
i i i i i
k X k q I X I q X q
= =
and similarly
1
. . mod mod ,
i i j j
k X k f X f j i
= .
Let the diagonal matrix constructed during encryption of plaintext y
be ( , ', ', ') Y diag y a b c = . Then the set of congruences ( , , , ) mod
i i i i
Y diag a x b c p = ,
mod
i
Y X q = , and mod
j
Y X f = has a unique solution by the Chinese Remainder
Theorem. This solution also satisfies
1 1
. . . .
i i i i
Y k X k k Y k X
= = .
This implies
1 1 1
( , ) . . . . ( , )
i i i
E x k k X k k k Y k k E y k k
= = = , which proves the Lemma.
By Lemma 7 we deduce that an adversary has no polynomial time method to differentiate
between the ciphertexts of two given plaintexts x and y if key is not known. Hence, the
onewayness property of our scheme is established.
4.7.3 Indistinguishability
Intuitively, a symmetric encryption scheme is said to exhibit Indistinguishability property if
given a ciphertext of one of the two messages selected by challenger, it should be hard for
the adversary to guess which of two messages corresponds to the ciphertext. The definition
45
involves a simple game where the adversary is tested for the ability to guess which message
is encrypted in a given ciphertext. The IND security game is defined as:
1. Attacker produces two messages m
0
and m
1
.
2. The challenger returns the challenge ciphertext c = Enc(m
b
,k), b is 0 or 1.
3. Attacker outputs b.
Attacker or adversary is a winner if it returns b=b with probability more than 0.5 in
polynomial time.
Since the plaintext space is uniform, that is all plaintext have equal bit length,
Indistinguishability implies semantic security. Hence, the proposed scheme is semantically
secure.
4.7.4 Security against Known Plaintext and Chosen Plaintext Attack
Plaintext attack security captures the notion of an adversary who has the ability to eavesdrop
on arbitrary messages between a sender and receiver before attempting to decrypt a message.
The difference between known-pliantext attack and chosen-plaintext attack is that latter is
adaptive one. The notion of security against the Known plaintext attacks is called
indistinguishability under Known ciphertext,IND-KPA, defined as:
1. Challenger runs KeyGen
2. (Query Phase I) Attacker is given access to Enc(.,k) oracle.
3. (Challenge Phase) Attacker produces two messages m
0
and m
1
. The challenger returns the
challenge ciphertext c = Enc(m
b
,k), b is 0 or 1.
4. (Query Phase II) Same as Query Phase I.
5. Attacker outputs b.
Attacker or adversary is a winner if it returns b=b with probability more than 0.5. This game
can be repeated polynomial number of times. For the adaptive case, the IND-CPA game is
the same, except that Attacker generates the next pair of message only after seeing the
previous ciphertext. If an encryption scheme is deterministic (the Enc algorithm is
deterministic) then there is a unique, consistent encryption for every message. A deterministic
encryption scheme cannot be IND-KPA or IND-CPA secure since we can simply ask for the
encryption of the two challenge messages during the oracle access step and compare the
46
oracle's response to the challenge ciphertext. Since the proposed scheme is not deterministic,
we can claim it to be IND-CPA secure. Next we prove this.
Lemma 8: Given a plaintext x, its encryption C with random number r and a key k, any
oracle Enc(.,k) will return C with a probability
1
*3
m
N
.
Proof: The fact to be noted is that the encryption depends on number r which is chosen at
random (in step 1 of encryption) by encryption oracle. Since
N
r Z
, the probability that
same r is chosen is
1
N
,under a uniform probability distribution for selecting random
number. Even when same r is chosen, the probability that same m rows of X will be selected
(in step 2 of Encryption) to construct linear congruences is
1
3
m
. Thus, probability of
producing same ciphertext for a given plaintext and a key is
1
*3
m
N
. Hence, the claim is
proved.
From Lemma 8 we can observe that even for the smallest possible values of N and m
(respectively 1155 and 2), the probability is 0.0000962. Thus, the scheme is IND-KPA
secure.
The proposed scheme is CPA secure if the number of chosen plaintext-ciphertext pairs is less
than the number of factors used in linear congruences during encryption. In other words,
for ' m m the scheme is CPA secure for ' m plaintext-ciphertext pairs. This is so because
more than m pairs chosen adaptively can help adversary to factorize N, hence break the
scheme.
4.8 Properties
As discussed in Section 3.2, the properties of a Homomorphic scheme decide the category of
applications it can be used in. Hence, it is important to discuss the properties of our proposed
scheme in the light of its deployment to practical use. They are:
1. Circuit/function privacy All intermediate and final results of any computation
are element of
4
( )
N
M Z . Hence, the vital information like number of parameters,
47
size of circuit, intermediate results or purpose of function cannot be deduced from
the result itself.
2. Multiple Users Our scheme can be deployed for multiple user computations. We
have shown in Section 4.4 a possible method to do so.
3. Parallel computation The cryptographic primitives as such do not have a scope
of parallelization. But, complexity of all algorithms are dependent on the matrix
operations performed therein. These can be optimized by parallelizing the
algorithms for addition and multiplication.
4. Unlinkability The output of encryption algorithm is a 4x4 matrix,
indistinguishable from the output of the evaluation algorithm, hence is the
unlinkability property of our scheme.
5. Multi-hop The output of algorithm Eval is a 4x4 matrix which can again be
input to Eval algorithm without any intermediate (extra) operation, thus making
possible multiple hops of evaluation to be performed in succession.
4.8 Implementation Results
We implement our algorithm using Java and evaluate its execution time. The computations
were performed on a 3.40 GHz Intel Core i3-2130 processor. Table 4.3 lists the execution
time for key generation, encryption and decryption for various lengths of N.
TABLE 4.3
EXECUTION TIME OF KEY GENERATION, ENCRYPTION AND DECRYPTION FOR VARIOUS
LENGTHS OF N
|N| (in bits) Key Generation Encryption Decryption
12 33 ms 31 ms 17 ms
18 356 ms 193 ms 124 ms
24 16.43 s 42.91 s 6.45 s
The data for homomorphic evaluations was gathered from running 10000 additions and 100
multiplications of randomly selected numbers of varying length. Table 4.4 lists the execution
time required for homomorphic addition and multiplication.
48
TABLE 4.4
EVALUATION TIME OF ADDITION AND MULTIPLICATION FOR DIFFERENT LENGTHS OF N
|N| (in bits) Time for Addition (10000) Time for Multiplication (100)
12 45 ns 8.98 ms
14 46 ns 187 ms
16 49 ns 337 ms
18 78 ns 1.9 s
20 113 ns 5.4 s
For the purpose of comparison, we pick the results published in [20], a very practical
implementation of BGV scheme. In [20], time taken to compute mean of 100 numbers of size
128-bits is 20 milliseconds, and for variance is 6 seconds. They leave division in both the
cases on the data user, and to allow mean computation it requires a 30-bit prime number as
secret, while for variance it is 58-bit long. In our implementation, computation of mean takes
1.38 milliseconds and of variance takes 6.83 seconds, including division operation.
4.9 Variants
We present here two variants of the scheme.
1. First variant involves larger key size, that is matrices of size 8. This increases
computational complexity of the algorithms, but the advantage gained is not much. It
obviously increases the ciphertext space thereby contributing to security. In this case
encryption algorithm will involve two random numbers. We present here only the
encryption algorithm; other algorithms are analogous and can be understood
accordingly.
49
Here, our aim is to give an idea how the proposed scheme can be generalized to have larger
key size, hence better security.
2. Instead of taking a large composite number N as base of ring
N
Z , it can be chosen as a
composite power of 2. Algorithms for all primitives remain exactly the same, except
the numbers p
i
and q
i
. They are now selected as powers of 2. All p
i
and q
i
are unique.
For example, for m=2 we can choose p={2, 32} and q={128,8}. Here, the security
parameter can be viewed as the maximum number of bits in a plaintext. This can
further be combined with packing bits of plaintext into blocks of bits each. But it
would require an evaluation function which can map binary operations on bits to
operations on matrices (or integers).
Enc
8
(x,k)
1. Choose random values r
1
and r
2
,
1 2 1 2
, , ,
N
r r Z r r x 2. Construct a matrix ( 7) X m such that
each row has only one element equal to x, three elements equal to r1 and other three equal to r2.
3. Using Chinese Remainder Theorem, set ,1 7
i
x i to be solution to the simultaneous
congruences mod ,1
j ij i
x X f i m = .
4. Ciphertext,
1
1 2 3 4 5 6 7
* ( , , , , , , , ) * C k diag x x x x x x x x k
=
50
Chapter 5
CONCLUSION AND FUTURE WORK
Scope and promises of homomorphic cryptography in cloud computing environments cannot
be ignored. Researchers all over the world are taking great interest in recent years to develop
homomorphisms that can be deployed practically. Much of the focus is on imparting
homomorphic capabilities to public key cryptosystems, while some applications can as well
be handled with a symmetric key scheme. Hence, our efforts have been to propose ideas as to
how symmetric keys and simple matrix-based operations could also lead to feasible schemes
for cloud computing, specifically for delegation of computation and private data processing
in clouds. communication costs involved in cloud computing are often large, to make up for
this we emphasize on having low time complexity for cryptographic primitives.
We have proposed a scheme with a very efficient decryption method hence making it
affordable for computationally weak devices, like a mobile device taking results from a
computation centre of the cloud and decrypting it. We have proposed application-specific
primitives making it easy to deploy to data processing applications. The evaluation functions
are efficient and simple making it easy to carry out any arbitrary computation on data. We
also suggest how to use symmetric encryption with multiple users, which is clearly key
efficient as compared to the popular asymmetric approaches for multiple user applications.
The scheme can be further optimized in matrix multiplication aspect. Decryption need not
carry out complete multiplication of three matrices, rather the aim is to derive only the first
element of the product matrix.
The scheme can be modified to operate on polynomials instead of working with matrices,
deriving idea from [21].
Application to Private information retrieval, searching index of an encrypted database and e-
voting can be useful enough. Designing protocols for the same could be a further
contribution.
The proposed scheme does not have any scope for targeted malleability or verifiability yet.
Improvement in the scheme or introduction of some new primitives for verifiable
computation can be appreciable effort.
51
References
[1] C. Gentry. A fully homomorphic encryption scheme. PhD thesis, Stanford University,
Sep 2009. Available at http://crypto.stanford.edu/craig.
[2] V. Vaikuntanathan, Computing blindfolded: new developments in homomorphic
encryption, Proceedings of the 2011 IEEE 52nd Annual Symposium on Foundations of
Computer Science, pp 5-16, 2011.
[3] L. Xiao, O. Bastani and I-L. Yen. An efficient homorphic encryption protocol for multi-
user systems, 2012. Available at http://eprint.iacr.org/2012/193.
[4] R. Rivest, L. Adleman, and M. Dertouzos. on data banks and privacy homomorphisms,
Foundations of Secure Computation, pp 169-180, 1978.
[5] R. Rivest, A. Shamir, and L. Adleman, A method for obtaining digital signatures and
public-key cryptosystems, Communications of the ACM 21 (2): 120126, 1978.
[6] P. Paillier, Public-key cryptosystems based on composite degree residuosity classes,
Proc of EUROCRYPT-99, Springer, pp 223238, 1999.
[7] N. P. Smart and F. Vercauteren. Fully homomorphic encryption with relatively small key
and ciphertext sizes, Public Key Cryptography PKC 2010, Berlin, Heidelberg, New York,
2010. [Lecture Notes in Computer Science, vol 6056, Springer Verlag pp 420443]
[8] C. Gentry and S. Halevi. Implementing Gentry's fully homomorphic encryption
scheme. EURO-CRYPT 2011, LNCS, Springer, K. Paterson (Ed.),2011.
[9] D. Stehle and R. Steinfeld. Faster fully homomorphic encryption. Cryptology ePrint
Archive Report 2010/299.
[10] N. P. Smart and F. Vercauteren, Fully homomorphic SIMD operations, IACR
Cryptology ePrint Archive, Report 2011/133.
[11] C. Gentry and S. Halevi, Fully homomorphic encryption without squashing using
depth-3 arithmetic circuits, Cryptology ePrint Archive, Report 2011/279
[12] C. Gentry, S.Halevi and N.P. Smart, Better bootstrapping in fully homomorphic
encryption., Cryptology ePrint Archive, Report 2011/680.
52
[13] M. van Dijk, C. Gentry, S. Halevi, and V. Vaikuntanathan. Fully homomorphic
encryption over the integers, Proceedings of Eurocrypt-10, Lecture Notes in Computer
Science, vol 6110,. Springer, pp 24-43, 2010.
[14] J.-S. Coron, A. Mandal, D. Naccache, and M. Tibouchi. Fully homomorphic encryption
over the integers with shorter public-keys, Advances in Cryptology - Proc. CRYPTO 2011,
vol. 6841 of Lecture Notes in Computer Science. Springer, 2011.
[15] G. Chunsheng. Attack on fully homomorphic encryption over the integers. Aavailable
at http://eprint.iacr.org/2012/157.
[16] J. Coron, T. Lepoint and M. Tibouchi. Batch fully homomorphic encryption over the
integers. 2012. Available at http://eprint.iacr.org/2013/36.
[17] J. Kim, M. S. Lee, A. Yun and J .H. Cheon. CRT-based fully homomorphic encryption
over the integers, 2012. Available at http://eprint.iacr.org/2013/57.
[18] Z. Brakerski and V. Vaikuntanathan, Efficient fully homomorphic encryption
from(standard) LWE, in Foundations of Computer Science, 2011. Also available at
Cryptology ePrint Archive, Report 2011/344.
[19] Z. Brakerski, C. Gentry, and V. Vaikuntanathan. Fully homomorphic encryption
without bootstrapping, Cryptology ePrint Archive, Report 2011/277.
[20] K.Lauter, M.Naehrig and V.Vaikunthnathan, Can homomorphic encryption be
practical?, Proc of 3rd ACM workshop on Cloud Computing Security Workshop , pp 113-
124, 2011.
[21] A Kipnis and E Hibshoosh. Efficient Methods for Practical Fully-Homomorphic
Symmetric key Encryption, Randomization and Verification. Available at
http://eprint.iacr.org/2012/637.
[22] S.Wang, D. Agrawal and A. El Abbadi, Is Homomorphic Encryption the Holy Grail for
Database Queries on Encrypted Data?, Technical report, Department of Computer Science,
University of California. Feb 2012.
[23] D. Boneh, G Segev and B. Waters, Targeted Malleability: Homomorphic Encryption
for Restricted Computations, IACR Cryptology ePrint Archive Report 2011/311.
53
[24] S. Tsujiiy, H. Doiz, R. Fujitay, M. Gotaishiy, Y. Tsunoo and T. Syoujix, Privacy
Preserving Data Processing with Collaboration of Homomorphic Cryptosystems, Workshop
on Applied Homomorphic Cryptography, Japan, 2013.