Anda di halaman 1dari 6

Improving the DGK comparison protocol

Thijs Veugen # ∗1

#
Information Security and Privacy Lab, Delft University of Technology
Delft, The Netherlands


Technical Sciences, TNO
Delft, The Netherlands
1
thijs.veugen@tno.nl

Abstract—When processing signals in the encrypted domain, protocol requires roughly a factor 10 computational overhead
homomorphic encryption can be used to enable linear operations
on encrypted data. Comparison of encrypted data however
compared to DGK and a factor λ communication overhead,
requires an additional protocol between the parties and will be where λ is an error probability parameter which should be
relatively expensive. A well-known and frequently used com- around 86 to achieve a negligible probability of incorrectness
parison protocol is by Damgård, Geisler and Krøigaard. We [1]. Later, Blake and Kolesnikov [10], [11] described a proto-
present two ways of improving this comparison protocol. Firstly, col for comparing two numbers that are unknown to the par-
we reduce the computational effort of one party by roughly
50%. Secondly, we show how to achieve perfect security towards
ties requiring few communication but an exponentially large
the other party without additional costs, whereas the original plain text and therefore much worse computational complexity
version with encrypted inputs only achieved statistical security. than DGK. The protocol by Damgård, Geisler and Krøigaard
An additional advantage is that larger inputs are allowed. essentially combines the best of both worlds yielding small
computational and communication costs, requiring only one
I. I NTRODUCTION communication round.
In 2007, Damgård, Geisler and Krøigaard (DGK) invented In concurrent independent work, Garay, Schoenmakers and
their secure comparison protocol [1] together with a new Villegas [12] develop a similar solution where the comparison
homomorphic cryptosystem that together formed an interesting result is to remain secret. They save computation and com-
and efficient solution for the so-called millionaire’s problem. munication by allowing a number of communication rounds
Their protocol has been used frequently ever since as a sub- logarithmic in the number of input bits. Their constant round
protocol in applications for signal processing with encrypted solution however is less efficient than the DGK solution.
data. We mention a few. Similarly, Schoenmakers and Tuyls [13] in 2004 found a
In secure face recognition [2] a person is identified by com- very efficient comparison protocol in terms of computational
paring many face related values with a sample value. The same complexity at the cost of a number of communication rounds
with fingerprints [3]. In secure statistical analysis [4] many linear in the number of input bits.
sensitive statistical data have to be compared. In secure user As with many secure two-party solutions in the semi-honest
clustering [5] user profiles have to be compared with cluster model, also secure comparison offers a perfect playground
centroids. When generating private recommendations [6], user for garbled circuits as shown by Kolesnikov, Sadeghi and
similarity values have to be compared with a threshold. Finally, Schneider [14] in 2009. A disadvantage of garbled circuits
also in secure adaptive filtering [7] or secure bioinformatics based solutions is that they cannot achieve perfect security
services [8], the DGK comparison protocol is used. like DGK does for one party.
We finish Section 1 by describing related work followed by
relevant background information in the preliminaries. In the B. Preliminaries
second Section, the DGK comparison protocol is introduced
and analysed. Our main contribution is described in Section 3 The notation (x ≤ y) is used to denote the bit that will be
containing several ways of improving the DGK comparison one exactly when x ≤ y, and ⊕ denotes the exclusive or of
protocol. The paper is finalized by the conclusions. two bits. We use two different homomorphic cryptosystems in
this paper to encrypt signals represented by integers.
A. Related work The first one is the cryptosystem by Damgård, Geisler and
In 2001 Fischlin [9] presented his protocol using quadratic Krøigaard (DGK) [1], [15] that is dedicated to small plaintexts
residues to encrypt bits and securely computing a boolean and fits nicely within the secure comparison protocol. The
circuit presenting a comparison of two private numbers. His public key is (n, g, h, u) and the private key is (p, q, vp , vq )
such that the cipher text modulus n is the product of two large
primes p en q. In the protocols we use KDGK to denote the
WIFS‘2012, December, 2-5, 2012, Tenerife, Spain.
private key of the DGK crypto system. The plaintext space is
978-1-4673-2287-4/12/$ 31.00 2012
c IEEE. Zu where u is a small (16 or 32 bit) prime divisor of both

978-1-4673-2287-4/12/$31.00 ©2012 IEEE 49 WIFS 2012


p − 1 and q − 1. The additional parameters vp and vq are t- More precisely,
bit prime divisors of p − 1 and q − 1 respectively, where a
X
ℓ−1
reasonable value for parameter t is 160. The numbers g and c i = s + x i − yi + 3 (xi ⊕ yi )
h are elements of Z∗n of order uvp vq and vp vq respectively. j=i+1
The reasoning behind the values of all these parameters is
explained in [15]. Clearly, the sum of exclusive ors will be zero exactly when
We denote a DGK encryption of plaintext m ∈ Zu by xj = yj for each j, i < j < ℓ. The variable s, introduced
[m] which is computed as [m] = g m hr mod n, where r is later in [2], can be set to either −1 or 1 depending on the
a fresh random integer of 2t bits. A table can be used for comparison that is performed. For example when s = −1, ci
decrypting [m] [15] but in the comparison protocol we only will only be zero when xi = 1 and yi = 0 (and xj = yj
want to determine whether m = 0 which can be done quite for each j, i < j < ℓ) and thus x > y. To avoid one of the
fast through the check [m]vp vq mod n = 1. Since u < p it parties learning the comparison result, one party will set the
is even sufficient to check [m]vp vq mod p = 1 which will on parameter s and the other party will learn whether ci = 0 or
average cost 32 (t + t)/4 = 43 t multiplications modulo n. not.
The second cryptosystem is Paillier [16] with cipher text The basic DGK comparison protocol is depicted in Proto-
modulus N 2 , N being a product of two large primes. The col 1. In [1] more variants are described like shared inputs
Paillier encryption of plaintext m ∈ ZN is denoted by [[m]] or achieving security against active adversaries. For a formal
and computed as [[m]] = g m rN mod N 2 , where r is a fresh security proof we also refer to this paper.
random integer of size N and the order of g ∈ Z∗N 2 is a
multiple of N . We choose g = N + 1 because it reduces g m Protocol 1 DGK comparison with private inputs
to 1 + N · m modulo N 2 and saves an exponentiation. The Party A B
private key is denoted by KP aillier in our protocols. More Input x y and KDGK
details can be found in the paper [16]. Output δA ∈ {0, 1} δB ∈ {0, 1}
Both cryptosystems are additively homomorphic so [[x]] · Constraints δA ⊕ δB = (x ≤ y)
[[y]] = [[x+y]] mod N 2 and [x]·[y] = [x+y] mod n, a property 0 ≤ x, y < 2ℓ
thas we will use frequently. 1) B sends the encrypted bits [yi ], 0 ≤ i < ℓ to A.
We assume the semi-honest model where both parties A and 2) For each i, 0 ≤ i < ℓ, A computes [xi ⊕ yi ] as follows:
B follow the rules of the protocol, but collect as much infor- if xi = 0 then [xi ⊕ yi ] ← [yi ]
mation as possible to deduce private information. However, else [xi ⊕ yi ] ← [1] · [yi ]−1 mod n.
the DGK comparison can be extended to the malicious model 3) A chooses a uniformly random bit δA and computes
with active adversaries [1]. s = 1 − 2 · δA .
The multiplicative inverse of x modulo n is denoted by x−1 4) For eachQi, 0 ≤ i < ℓ, A computes [ci ] = [s] · [xi ] ·
and equals the integer y, 0 ≤ y < n, such that x·y = 1 mod n. ℓ−1
[yi ]−1 · ( j=i+1 [xj ⊕ yj ])3 mod n.
The multiplicative inverse is efficiently computed by using 5) A blinds the numbers ci by raising them to a random
the Euclidean algorithm [17], and can also be used to negate exponent ri of 2t bits: [ci ] ← [ci ]ri mod n, and sends
an encrypted integer: [−x] ← [x]−1 mod n. To estimate the them in random order to B.
computational complexity of the different protocols, we use 6) B checks whether one of the numbers ci is decrypted to
the fact that an involution modulo n with an exponent of e zero. If he finds one, δB ← 1, else δB ← 0.
bits will on average take 32 e multiplications modulo n.
Finally, let σ be the statistical security parameter, which
To show that in Protocol 1 indeed δA ⊕ δB = (x ≤ y), we
value is usually chosen around 80. Integer division is denoted
distinguigh two cases:
by ÷. And we assume all random variables, excluding the
inputs of the secure multi-party computation protocol, are • If δA = 0 then s = 1 so s + xi − yi is only zero when

uniformly chosen. xi = 0 and yi = 1. Thus when B finds ci = 0 (in which


case δB = 1), we have x < y, and otherwise x ≥ y.
II. A NALYSIS OF DGK COMPARISON • If δA = 1 then s = −1 so s + xi − yi is only zero when

When comparing two integers x and y bitwise, the obvious xi = 1 and yi = 0. Thus when B finds ci = 0, we have
approach is to scan both bit rows from left (the most significant x > y, and otherwise x ≤ y.
part) to right searching for the first differing bit. The outcome In both cases, δA ⊕δB = (x ≤ y). An extra measure described
of the comparison of these differing bits will determine the in Subsection II-A is needed to provide correctness in case
comparison result of both integers. A similar approach is x = y.
followed by the DGK protocol. Assume both integers contains The value of B’s input y is hidden from A by the DGK
ℓ bits denoted by xi and yi respectively, so x = xℓ−1 . . . x1 x0 , encryption system. On the other hand, A’s input x is perfectly
xℓ−1 being the most significant bit of x. Then the numbers hidden from B (given some extra measures for the case x = y
ci , 0 ≤ i < ℓ are computed which will only be zero when as described in subsection II-A) because δA was uniformly
xj = yj for each j, i < j < ℓ and at the same time xi 6= yi . chosen and party B only learns δB . Therefore, Protocol 1

50
realizes computational security towards A and perfect security and not zero otherwise.
towards B. X
ℓ−1
The main computational effort for A is in the multiplicative c−1 = δA + x i ⊕ yi
blinding of the numbers ci which requires on average ℓ · 3t i=0
multiplications modulo n. The main computational effort for Party B will set δB ← 1 only when one of the variables ci = 0,
B is the decryption (checks) of the same numbers ci which −1 ≤ i < ℓ, and δB ← 0 otherwise. This also assures that
requires on average ℓ · 34 t multiplications modulo n. δA ⊕ δB = (x ≤ y) even in the case of equality.
The DGK protocol with private inputs is easily extended With this extra measure in Protocol 1, perfect security
to encrypted inputs [18] as depicted in Protocol 2. The is achieved towards B. The variable δB will be uniformly
correctness and security of Protocol 2 is shown in the same distributed independent of the random distributions of x and
paper [18]. y.

Protocol 2 DGK comparison with encrypted inputs and sta- III. I MPROVEMENTS
tistical security We present two different ways to improve the DGK com-
Party A B parison algorithm. The first improvement significantly reduces
the computational complexity of Protocol 1, and the second
Input [[x]] and [[y]] KP aillier and KDGK
improvement provides perfect security towards B for Proto-
Output [[(x ≤ y)]]
col 2 without substantially reducing the performance.
Constraints 0 ≤ x, y < 2ℓ and ℓ + σ < log2 N
1) A chooses a random number r of ℓ + 1 + σ bits, and A. Computational complexity
−1
computes [[z]] ← [[x − y + 2ℓ + r]] = [[x]] · [[y]] · [[2ℓ + The computational complexity of Protocol 1 can be reduced
r]] mod N 2 . A sends [[z]] to B. in two ways. The first, major improvement is achieved by
2) B decrypts [[z]], and computes β = z mod 2ℓ . carefully considering the cases where ci = 0 leading to a re-
3) A computes α = r mod 2ℓ . duction in step 5 that requires the highest computational effort
4) A and B run a DGK comparison protocol with private within Protocol 1. The observation that ci > 0 when xi 6= δA
inputs α and β resulting in outputs δA and δB such that independent of the value y leads to the definition of the set
δA ⊕ δB = (α ≤ β). L = {i | 0 ≤ i < ℓ and xi = δA }. Since ci > 0 whenever
5) B computes z ÷ 2ℓ and sends [[z ÷ 2ℓ ]] and [[δB ]] to A. i∈ / L, these elements [ci ] can be replaced by random non-zero
6) A computes [[(β < α)]] as follows: elements and don’t need to be multiplicatively blinded in step
if δA = 1 then [[(β < α)]] ← [[δB ]] 5. This is depicted in Protocol 3.
−1
else [[(β < α)]] ← [[1]] · [[δB ]] mod N 2 . The set L will on average contain ℓ/2 elements leading to
7) A computes [[(x ≤ y)]] ← [[z ÷ 2ℓ ]] · ([[r ÷ 2ℓ ]] · [[(β < reduction of the computational complexity in step 5 of 50%.
α)]])−1 mod N 2 . And since this step determines the complexity of party A,
Protocol 3 reduces the average computational complexity of
In Protocol 2 the comparison (x ≤ y) is reduced to the party A in Protocol 1 by 50% (see Subsection III-C).
private comparison (α ≤ β) [18]. As in Protocol 1, it realizes The second, minor improvement is achieved by removing
computational security towards A. Since the value x − y is the exponent three in step 4 saving 2ℓ muliplications modulo
statistically hidden in z, the probability Pr(x − y|z) is not n in total. This is depicted in step 4 of Protocol 3. Because the
uniform and depends on z and therefore Protocol 2 provides first part of ci is either zero or one, the second part containing
only statistical security towards B. For example when z = the sum no longer requires a factor three.
rmin − 1, B will know that x = 0 and y = 2ℓ − 1. 1) Timing attacks: The computational optimizations de-
scribed above introduce a practical weakness in the protocol.
This is due to the fact that the computational effort depends
A. Equality of inputs
on the value x so by measuring the time or the power
When x 6= y, none or one of the values ci will be consumption party B could learn information about private
zero depending on the (uniform) choice of δA , so δB will input x.
be uniformly distributed and independent from the random One way to overcome this vulnerability is to use additional
distributions of inputs x and y. However, when x = y there timers or dummy execution steps such that the execution
will never occur a zero in the ci , irrespective of δA , because time will be constant. This however invalidates the introduced
the part s+xi −yi will never equal zero. So some information benefits of reduced processing time.
is leaked towards B in case of equality of inputs. This is due Another solution is to add a buffer of precomputations to
to the introduction of the variable s in [2], but they did not be executed. Whenever the situation permits, precomputations
mention the problem of information leakage. can be done and stored for later usage. Precomputations could
As personally communicated by Tomas Toft, an easy way for example consist of random factors that are needed while
to overcome this information leakage is to introduce an extra encrypting values. By using ’idle’ time for precomputing
variable c−1 that will be zero when x = y with probability 12 random values, the overall computational complexity and

51
Protocol 3 Optimized DGK comparison with private inputs αi 0 1 0 1 0 1 0 1
βi 0 0 1 1 0 0 1 1
Party A B d 0 0 0 0 1 1 1 1
Input x y and KDGK αi ⊕ β i 0 1 1 0 0 1 1 0
Output δA ∈ {0, 1} δB ∈ {0, 1} wi 0 1 1 0 -1 0 0 -1
α̃i ⊕ βi 1 0 0 1
Constraints δA ⊕ δB = (x ≤ y)
0 ≤ x, y < 2ℓ TABLE I
T HE VALUE wi WHEN αi 6= α̃i
1) B sends the encrypted bits [yi ], 0 ≤ i < ℓ to A.
2) For each i, 0 ≤ i < ℓ, A computes [xi ⊕ yi ] as follows:
if xi = 0 then [xi ⊕ yi ] ← [yi ]
else [xi ⊕ yi ] ← [1] · [yi ]−1 mod n. B. Security properties
3) A chooses a uniformly random bit δA . Let L be the set
{i | 0 ≤ i < ℓ and xi = δA }. In Protocol 2, no carry-over modulo n is allowed in the
4) For each i ∈ L: Q addition of x − y + 2ℓ and r leading to only statistical security
ℓ−1
A computes [ci ] = j=i+1 [xj ⊕ yj ] mod n. towards B. If r could be chosen from the full range 0 ≤ r <
If δA = 0 then [ci ] ← [1] · [yi ]−1 · [ci ] mod n N , the value z would perfectly mask the secret value x − y,
else [ci ] ← [yi ] · [ci ] mod n. and perfect security could be achieved towards B.
5) For each i ∈ L, A blinds the numbers ci by raising them Protocol 4 shows how to adjust the DGK comparison proto-
to a random exponent ri of 2t bits: [ci ] ← [ci ]ri mod n. col with encrypted inputs such that perfect security is achieved
For the remaining i ∈ / L a random non-zero [ci ] ← [ri ] towards B requiring only a small increase in computational and
is generated en encrypted. communication complexity. The difference with Protocol 2 is
A sends all [ci ] in random order to B. the modified subprotocol with private inputs.
6) B checks whether one of the numbers ci is decrypted to The idea is that B sends an encrypted bit [d] to A ’inform-
zero. If he finds one, δB ← 1, else δB ← 0. ing’ A whether a carry-over has occurred in the addition of
x − y + 2ℓ and r. A can use this additional encrypted bit
to compute numbers ci , 0 ≤ i < ℓ, similar to the original
Protocol 1. An additional advantage of allowing carry-overs
in Protocol 4 is that the inputs x and y are allowed to be
larger than in Protocol 2.
execution time of the protocol will reduce. To show that
To ensure that bit d = 1 exactly when a carry-over has
even the worst-case execution time of our protocol can be
occurred, we require ℓ + 2 < log2 N such that 0 ≤ x − y +
reduced by such precomputations, consider the randomization
2ℓ < (N − 1)/2. This means that we pay the price of not
step [ci ] ← [ci ]ri mod n that has to be performed before A can
allowing input values consisting of log2 N − 2 or log2 N − 1
send the value ci to party B. The same (and from a security
bits to ensure that z − r will also be in the first half of the
perspective probably preferable) effect is achieved by random-
interval [0, N ), i.e. 0 ≤ z − r < (N − 1)/2. When 0 ≤
izing ci through [ci ] ← [ci ]si · hri mod n, where ri is the
r < (N − 1)/2, party A will be assured that no carry-over
same random value of 2t bits, but si is a considerably smaller
has occurred. Otherwise, when r is in the second half of the
random value of size u [1]. The random factors hri mod n
interval [0, N ), the comparison z < (N − 1)/2 (which can be
can be easily precomputed in which case the randomization
performed by B) will inform party A about the carry-over.
effort of ci is reduced by a factor 2t/ log2 u = 10 when u
Depending on the value of d a different comparison should
consists of 32 bits.
be executed (see Equation 1). When d = 0, z = x − y + 2ℓ + r
However, formally there is no security problem as all our and the original comparison α ≤ β should be computed, but in
protocols are provably secure in the semi-honest model [1], case a carry-over occurred (d = 1 and z = x−y +2ℓ +r −N ),
[18]. This is argued by considering the detailed proof in section the comparison α̃ ≤ β should be performed where the non-
4.2 of the original paper [1]. Since the main difference is in negative integer α̃ = (r − N ) mod 2ℓ .
the computation of the [ci ], we especially have to simulate The most important part of the modified subprotocol is
these messages from A to B. Each encrypted nonzero ci is in the computation of the encrypted values wi that should
easily simulated by an encrypted random nonzero element approximate αi ⊕βi in case no carry-over occurred, and α̃i ⊕βi
of Z∗u . Since we use the same randomizations (as described when a carry-over actually did occur. When αi = α̃i this is
above) as the original protocol, the simulated messages will be obviously true. The most interesting case is αi 6= α̃i when
statistically indistinguishable from the real protocol messages wi = (αi ⊕ βi ) − d.
by the same arguments. As can be deduced from Table I, wi will be zero in exactly
the right cases. That is, wi = 0 when αi ⊕ βi = 0 and d = 0,
Many cryptographic protocols suffer from potential timing but also when α̃i ⊕ βi = 0 and d = 1. Furthermore, wi ∈
attacks. Also, the comparison protocol is always used as a {−1, 1} in all other cases.
subprotocol within an application, and it’s not always possible By multiplying each wi with a factor 2i in step
Pℓ−1 4(f) of the
to time the execution of a particular comparison protocol. protocol, we can assure that in step 4(h) the sum j=i+1 wj =

52
Pℓ−1
Protocol 4 DGK with encrypted inputs and perfect security step 4(h) is bounded by two, the factor three in 3 j=i+1 wj
Party A B avoids interference with this value, so ci will eventually be
Input [[x]] and [[y]] KP aillier and KDGK zero only when both parts are zero.
Output [[(x ≤ y)]] We conclude that
Constraints 0 ≤ x, y < 2ℓ and ℓ + 2 < log2 N
δA ⊕ δB = (α ≤ β) , if d = 0 (1)
1) A chooses a random number r, 0 ≤ r < N , and
−1
computes [[z]] ← [[x − y + 2ℓ + r]] = [[x]] · [[y]] · [[2ℓ + (α̃ ≤ β) , if d = 1
2
r]] mod N . A sends [[z]] to B.
1) Optimizations: We describe three ways of optimizing
2) B decrypts [[z]], and computes β = z mod 2ℓ .
the computational complexity of Protocol 4, and in particular
3) A computes α = r mod 2ℓ .
its subprotocol of step 4.
4) A and B run a modified DGK comparison protocol with Pℓ−1
private inputs α and β resulting in outputs δA and δB : First, the exponentiations in step 4(f) require i=0 i =
1
2 (ℓ − 1)ℓ multiplications modulo n which is quite a lot. This
a) B sends the encrypted bit [d] where d = (z <
can be reduced by carefully analyzing the construction of the
(N − 1)/2) is the bit informing A whether a carry-
wi . The factor 2i is needed to avoid interference between the
over has occured.
different values when they are added in step 4(h). When d = 0
b) B sends the encrypted bits [βi ], 0 ≤ i < ℓ to A.
all wi = (αi ⊕ βi ) will be either zero or one so then any
c) A corrects [d] by setting [d] ← [0] whenever 0 ≤
positive factor can be used to avoid interference. When d = 1,
r < (N − 1)/2.
wi ∈ {−1, 0, 1}, and more precisely wi = (αi ⊕ βi ) ∈ {0, 1}
d) For each i, 0 ≤ i < ℓ, A computes [αi ⊕ βi ] as
when additionally αi = α̃i , and wi = P(αi ⊕ βi ) − 1 ∈ {−1, 0}
follows: ℓ−1
otherwise. So when d = 1, the sum j=i+1 wj can be split
if αi = 0 then [αi ⊕ βi ] ← [βi ] Pℓ−1
else [αi ⊕ βi ] ← [1] · [βi ]−1 mod n. into a non-negative part j=i+1,αj =α̃j wj and a non-positive
Pℓ−1
e) A computes α̃ = (r − N ) mod 2ℓ , the corrected part j=i+1,αj 6=α̃j wj . Therefore, a factor ℓ for the wj in the
value of α in case a carry-over actually did occur second part will suffice ensuring that the total sum can only
and adjusts [αi ⊕ βi ] for each i: be zero when all individual elements are zero.
If αi = α̃i then [wi ] ← [αi ⊕ βi ] This leads to the following optimization in step 4(f):
else [wi ] ← [αi ⊕ βi ] · [d]−1 mod n
f) For each i, 0 ≤ i < ℓ, A computes [wi ] ← [wi ] ← [wi ]ℓ mod n only when αi 6= α̃i
i
[wi ]2 mod n such that these values will not in- Maximally ℓ 23 log2 ℓ multiplications modulo n are required
terfere each other when added. for this optimized step 4(f) which is less than the computa-
g) A chooses a uniformly random bit δA and com- tional bottleneck of the protocol in step 4(i).
putes s = 1 − 2 · δA .
Another reason to introduce this optimization is that DGK
h) For each i, 0 ≤ i <Qℓ, A computes [ci ] = [s] · [αi ] ·
ℓ−1 encryption requires the plain texts to remain small (16 or 32
[d]α̃i −αi · [βi ]−1 · ( j=i+1 [wj ])3 mod n. bits) [1]. Our modification reduces the absolute value of the
i) A blinds the numbers ci by raising them to a numbers ci in step 4(h) from roughly 2ℓ to ℓ2 .
random exponent ri of 2t bits: [ci ] ← [ci ]ri mod n,
The second optimization is similar to the one described in
and sends them in random order to B.
Subsection III-A. The set L can be defined as {0 ≤ i < ℓ |
j) B checks whether one of the numbers ci is de-
(αi = δA ) or (α̃i = δA )}. When i ∈ / L, neither αi nor α̃i
crypted to zero. If he finds one, δB ← 1, else
will equal δA , so ci will never be zero independent of the
δB ← 0.
fact whether a carry-over occurred. On average 25% of the ℓ
5) B computes z ÷ 2ℓ and sends [[z ÷ 2ℓ ]] and [[δB ]] to A. elements will lie outside L, so the computational complexity
6) A computes [[(β < α)]] as follows: of Party A in Protocol 4 (in particular of step 4(i)) will be
if δA = 1 then [[(β < α)]] ← [[δB ]] roughly reduced by a factor 25% (see Subsection III-C).
−1
else [[(β < α)]] ← [[1]] · [[δB ]] mod N 2 . By considering step 4(c), a final optimization can be de-
7) A computes [[(x < y)]] ← [[z ÷ 2ℓ ]] · ([[r ÷ 2ℓ ]] · [[(β < duced. Namely, when party A is certain that no carry-over has
α)]])−1 mod N 2 . occurred, there is no need for executing the steps 4(c) upto
4(i) to compute the values ci . Instead, the computationally
less intensive steps 2) upto 5) from Protocol 3 could be
0 exactly when all individual wj = 0. performed. From B’s point of view, there is no difference
The final difference with Protocol 2 is that we use [αi ] · between Protocol 3 and the modified version, it only affects
[d]α̃i −αi instead of [αi ] in step 4(h). In effect, when d = 0 it the way that party A computes the numbers ci . In particular,
will equal [αi ] and when d = 1 it will be [α̃i ]. So the right steps 4(c) upto 4(i) could be optimized as follows:
value is used depending on whether a carry-over occurred or If r + 2ℓ+1 < N then A executes steps 2) upto 5) from
not. Protocol 3 (with private inputs α and β instead of x and y),
Because the absolute value of s + αi + d · (α̃i − αi ) − βi in and otherwise A performs steps 4(c) upto 4(i) from Protocol 4.

53
Since our optimization with set L improves A’s compu- which is particularly interesting when packing [6] is used
tational complexity by a factor 50% in Protocol 3 and by which allows additional computational and communication
25% in Protocol 4, the modification above leads to an average advantages.
ℓ+1 ℓ+1
improvement by a factor N −2 N · 50% + 2 N · 25% which is
R EFERENCES
very close to 50% for most values of ℓ. A disadvantage of the
modification above is that it might lead to additional timing [1] I. Damgård, M. Geisler, and M. Krøigaard, “Homomorphic encryption
and secure comparison,” Journal of applied cryptology, vol. 1, no. 1,
attacks with respect to r as described in Subsection III-A1. pp. 22–31, 2008.
[2] Z. Erkin, M. Franz, J. Guajardo, S. Katzenbeisser, R. L. Lagendijk, and
C. Comparison of performance T. Toft, “Privacy-preserving face recognition,” in Proceedings of the
Privacy Enhancing Technologies Symposium, Seattle, USA, 2009, pp.
To determine the value of our improvements the average 235–253.
total number of multiplications modulo n is computed and [3] M. Barni, T. Bianchi, D. Catalano, M. D. Raimondo, R. D. Labati, and
compared to the original Protocol 1. Since the main com- P. Failla, “Privacy-preserving fingercode authentication,” in Workshop
on Multimedia and Security, 2010.
putational difference between Protocol 1 and Protocol 2 is [4] J. Guajardo, B. Mennink, and B. Schoenmakers, “Modulo reduction
B’s decryption of z, the computational effort for party A for Paillier encryptions and application to secure statistical analysis,”
will be comparable for both protocols. We assume that all in SPEED’09, Lausanne, Switzerland, sep 2009.
[5] Z. Erkin, T. Veugen, T. Toft, and R. L. Lagendijk, “Privacy-preserving
random factors are precomputed and only depict the effort for user clustering in a social network,” in IEEE International Workshop on
party A, because our optimizations only affect party A. Also Information Forensics and Security, 2009.
depicted is the performance of Protocol 4 including the first [6] ——, “Generating private recommendations efficiently using homomor-
phic encryption and data packing,” IEEE Transactions on Information
two optimizations from Subsection III-B1 but excluding the Forensics and Security, vol. 7, no. 3, pp. 1053–1066, 2012.
third one. [7] J. Troncoso-Pastoriza and F. Perez-Gonzalez, “Secure adaptive filtering,”
IEEE Transactions on Information Forensics and Security, vol. 6, no. 2,
x 10
4 pp. 469 – 485, 2011.
10
Protocol 1 and 2
[8] M. Franz, B. Deiseroth, K. Hamacher, S. Jha, S. Katzenbeisser, and
9 Protocol 3 H. Schröeder, “Towards secure bioinformatics services,” in Financial
Protocol 4
8
Cryptography and Data Security, ser. Lecture Notes in Computer
Number of multiplications modulo n

Science, vol. 7035, 2012, pp. 276–283.


7 [9] M. Fischlin, “A cost-effective pay-per-multiplication comparison method
6 for millionaires,” in CT-RSA 2001: Proceedings of the 2001 Conference
5
on Topics in Cryptology. London, UK: Springer-Verlag, 2001, pp.
457–472.
4
[10] I. Blake and V. Kolesnikov, “Strong conditional oblivious transfer and
3 computing on intervals,” in ASIACRYPT, vol. 3329. Advances in
2
Cryptology, 2004, pp. 515–529.
[11] ——, “Conditional encrypted mapping and comparing encrypted num-
1
bers,” in Financial Crypto, vol. 4107. LNCS, 2006.
0 [12] B. S. Juan Garay and J. Villegas, “Practical and secure solutions for
0 50 100 150 200
Number of input bits integer comparison,” in Public Key Cryptography - PKC’07, vol. 4450.
Springer-Verlag, 2007, pp. 330–342.
[13] B. Schoenmakers and P. Tuyls, “Practical two-party computation based
Fig. 1. Average computational complexity for party A on the conditional gate,” in ASIACRYPT’04, ser. Lecture Notes in
Computer Science, no. 3329, Advances in Cryptology. Springer, 2004,
pp. 119–136.
The results depicted in Figure 1 confirm our expectations [14] V. Kolesnikov, A.-R. Sadeghi, and T. Schneider, “Improved garbled
that Protocol 3 and Protocol 4 reduce the average computa- circuit building blocks and applications to auctions and computing
tional complexity of party A in Protocols 1 and 2 by 50% and minima,” in CANS, ser. Lecture Notes in Computer Science, vol. 5888.
Springer-Verlag, 2009, pp. 1–20.
25% respectively. Because in Protocol 1 the computational [15] I. Damgård, M. Geisler, and M. Krøigaard, “A correction to efficient and
effort of party B is roughly 25% of A’s effort, the average secure comparison for on-line auctions,” Journal of applied cryptology,
computational complexity of the entire protocol will be re- vol. 1, no. 4, pp. 323–324, 2009.
[16] P. Paillier, “Public-key cryptosystems based on composite degree resid-
duced by 40% and 20% respectively. If the third optimization uosity classes,” in Proceedings of Eurocrypt 1999, ser. Lecture Notes
from Subsection III-B1 had been included, the performance in Computer Science, vol. 1592. Springer-Verlag, 1999, pp. 223–238.
of Protocols 3 and 4 would have been identical at the cost of [Online]. Available: citeseer.ist.psu.edu/article/paillier99publickey.html
[17] A. J. Menezes, P. C. van Oorschot, and S. A. Vanstone, Handbook of
introducing extra timing vulnerabilities. Applied cryptography. CRC Press, 1996.
[18] T. Veugen, “Encrypted integer division,” in IEEE Workshop on Infor-
IV. C ONCLUSIONS mation Forensics and Security, Dec 2010.
We carefully analyzed the widely used secure comparison
protocol by Damgård, Geisler and Krøigaard [1], [15] and
presented two improvements. Firstly, we were able to reduce
the computational effort of party A by roughly 50%. Secondly,
we showed how to achieve perfect security towards party B
without additional costs in the variation with encrypted inputs,
whereas the original version only achieved statistical security.
An additional advantage is that larger inputs are allowed

54

Anda mungkin juga menyukai