Lecture 2
Lecture 2
1 Topic Covered
• Authentication
• MACs
• Secret Sharing
2 Authentication
Consider two individuals Alice and Bob who wish to communicate a message m over an
open channel. However on this channel there is an active adversary Eve who is capable of
changing messages that travel across the wire, but not block them entirely. This presents a
problem, even if the messages are encrypted. Consider the One Time Pad (OTP) example
from last class.
M = K = C = {0, 1}∗
Enck (m) = k ⊕ m
Deck (m) = k ⊕ c
Consider the case where the message is only a single bit. Eve intercepts Alice’s message
and XORs the message with a 1.
c=m⊕k
c0 = c ⊕ 1
Decryption proceeds without Bob knowing the ciphertext has been altered.
m0 = c0 ⊕ k
m0 = m ⊕ k ⊕ 1 ⊕ k
m0 = m ⊕ 1
Lecture 2, Page 1
Recalling the truth table for the XOR operation, Eve has succeeded in flipping whatever
bit that Alice originally intended to send. If, on the other hand, Eve XORed c with zero,
Bob would end up receiving a random value. Clearly this is a problem, and we wish Bob
to be able to tell that Eve has modified any of Alice’s cipher texts! Formally we wish to
prevent the cipher texts from being malleable by providing authentication - or the ability
to detect if Eve has altered the message.
Note when we consider the property of authentication, we are considering it indepen-
dently of confidentiality provided by encryption. In fact, we will show later how to combine
the two primitives.
MACs provide authentication against statistical adversaries - which is to say that there
is no limit placed on the adversary computational ability. Alice has a message to send to
Bob and would like to prevent Eve from altering it en-route. She thus computes a ‘tag’ that
she sends along with the message that allows Bob to check if the message has been altered.
More formally, a MAC scheme can be viewed as the following tuple:
M Message Space
K Key Space
T Tag Space
MAC: K × M → T MAC Function
Alice and Bob use the MAC in the following way. Alice computes t = MAC(k, m) and
sends (m, t) to Bob. Bob receives (m’, t’) and thus checks if t0 = MAC(k, m0 ). If it does
not, he knows that Eve has altered the message. We have now defined the usage of MACs,
but what does it mean for a MAC to be secure? As with encryption security we use a
game-based definition to define MAC security.
Definition 1 [1-Time Statistically Secure MAC]
Define MAC: K×M → T be a message authentication code and let Eve be an adversary.
We define the following security game:
Lecture 2, Page 2
Game (Eve):
$
• k is chosen uniformly at random from K, k ←
−K
• Eve chooses (m0 , t0 ) such that m 6= m0 , Eve wins if she able to generate a MAC for
m’ without previously seeing a tag for it, i.e. t0 = MAC(k, m0 )
M Zp
K Zp × Zp
T Zp
MAC(k, m) = xm + y k = (x, y)
Note that all operations are occurring in the field Zp which means the addition and
multiplication are done in modulo p. (For more notes on fields, see the appendix at the
end of the notes.) We now wish to show that this MAC construction meets our definition
of 1-Time Statistical Security. We can do this by examining the probability that the MAC
produces a fixed value. Formally:
Proof: Let X and Y be uniform random variables representing the choice of x and y in
the key. Thus K = (X, Y ) is also a uniform random variable. Thus for all messages m, and
all tags t, we have:
Lecture 2, Page 3
This follows from the fact that the equation t − Xm = Y has a unique solution for X
6 m0 and for any t, t0 :
for every choice of Y . Now consider the probability for any m =
Pr[MAC(K, m) = t0 , MAC(Kim) = t]
= Pr[Xm0 + Y = t0 , Xm + Y = t]
= Pr[X = x, Y = y] = 1/p2
0
t−t
Where x = m−m 0 and y = t − xm. Thus from the probability we just calculated and
the properties of conditional probabilities that we went over last class, we can show:
While this MAC construction is shown to be secure, it is not practical. In order to sign
any values, the key must be twice the size of the message, and one key can only be used to
sign one message. If the same key is used to sign two different messages, Eve can simply
solve the system of equations and recover the key used. This begs the question, can we
create a MAC with a smaller key size? Yes we can!
M Zdp for d ≥ 1
K Zp × Zp
T Zp
Pd i
For k = (x, y), m = (m1 , . . . , md ), MAC(k, m) = i=1 (mi x + y). Note that the
message space is assumed to be a vector of size d integers from Zp , but the key is the same
size as our previous construction. We now have a scheme where the key size is independent
of our message size. Now we have to prove this construction is 1-Time secure.
Pd i
Theorem 2 MAC(k, m) = i=1 (mi x + y) is 1-Time secure for ε = d/p.
Proof: Let X and Y be uniform random variables representing the choice of x and y in
the key. Thus K = (X, Y ) is also a uniform random variable. Thus for all messages m, and
all tags t, we have:
d
X
Pr[MAC(K, m) = t] = Pr[ (mi X i + Y )] = 1/p
i=1
Lecture 2, Page 4
This follows from the fact that the equation has a unique solution for X for every choice
of Y . Now consider the probability for any m 6= m0 and for any t, t0 :
Pr[MAC(K, m) = t0 , MAC(Kim) = t]
d
X d
X
i
= Pr[ (mi X + Y ) = t, (m0i X i + Y ) = t0 ]
i=1 i=1
d
X d
X
= Pr[ ((mi − m0i )xi ) = t − t0 , Y = t0 − (mi x0i )]
i=1 i=1
Pr[E] ∗ Pr[F |E] ≤ d/p ∗ 1/p ≤ d/p2
Where E and F are the random variables defined as the probability E := di=1 (mi xi +
P
y) = t − t0 and F := Y = t0 − di=1 (mi x0i ). Thus from the probability we just calculated
P
and the properties of conditional probabilities that we went over last class, we can show:
In practical matters, if we have a message size of 233 (about 8 GB) we can get security
of ε ≤ 2−102 with a key of only 258 bits! This is much improved from our last construction,
however we can still only use that key once for a single message. Can we do better an
authenticate more than one message with a single key? As it turns out, we can’t do
much better if we aren’t willing to put some restrictions on our adversary and move out of
statistical security. In fact, there is a lower bound on the number of messages and key size
required.
Theorem 3 To authenticate q messages with security ε = 2−r one needs a key of size
(q + 1)r.
t = MAC(ka , m)
c = Enc(ke , m)
She then sends (t, c) to Bob. Bob simply decrypts c and checks to see if the message
generates the same tag. Remember, authentication provides no guarantees as to the confi-
dentiality of the message. As a result Eve may be able to recover something about m from
t. This is bad!
Lecture 2, Page 5
As a result, the proper way to combine authentication and encryption is to ”encrypt
first, then MAC” as in the following construction.
c = Enc(ke , m)
t = MAC(ka , c)
4 Secret Sharing
Daniel, Jon, and abhi wish to found a baking empire, with the recipe for their famous
chocolate chip cookies as the corner stone of their success. Now, while they all agreed that
they were upstanding individuals, they still wished to control the recipe in such a way that
none of them could take entire recipe and found their own baking empire. In fact, they
wished to share the recipe amongst themselves in such a way that it required all three of
them to recover the recipe, and that with only two or one shares they could not know
anything about the recipe. Using secret sharing it is possible to get both properties.
abhi
s2
recipe
s1
s3
Daniel Jon
Let n be the number of parties, M the message space, and S the share space. We
$
− S n , Recover:
define a secret sharing scheme as tuple of two algorithms (Share: M →
S n → M).
Definition 2 [Correctness] A scheme is correct if the following holds:
Pr [Recover(Share(m)) = m] = 1
r∈Share
♦
That is to say that reassembling the shares proceeded by Share using the Recover
algorithm recovers the same message. Finally we define the security of the scheme.
Definition 3 [Security]
For all M, set of colluding parties A ⊆ {1, · · · , n} where |A| = n − 1. Let (s1 , · · · , sn ) =
Share(M ) and SA = {si : i ∈ A}. Then the distributions of SA and M are independent
♦
This definition is equivalent to the fact that observing a subset of shares doesn’t give
the adversary advantage, and also the definition that looking at the a subset of shares of
the message doesn’t allow the adversary to determine between two messages.
Lecture 2, Page 6
4.1 Secret Sharing Construction
Now that we have defined the syntax, security, and correctness of secret sharing, let us
provide a construction. Define M = Zq and S = Zq . Note, while we use Zp , any finite
group can be used for the message and share space. We define the following share and
recover algorithms
Share On input m:
Recover On input s1 , · · · , sn :
1. Compute s1 + · · · + sn
We now will show the scheme that is defined above meets our definition of security for
secret sharing.
Proof: For all M , set of colluding parties A ⊆ {1, · · · , n}/i any value sA (the sum of the
colluding parties), and for any m, we have:
Lecture 2, Page 7
t
X
p(x) := yi ∗ pi (x)
i=0
Share On input m:
1. Lagrange Interpolation
Proof: For all messages M , any t distinct points z1 , · · · , zt ⊆ Zq /{0} and values s1 , · · · , st
we have:
• For all x: x + 0 = x
Lecture 2, Page 8
• For all x: there exists −x such that x + (−x) = 0
• For all x ∈ F ∗ : x ∗ 1 = x
• For all x ∈ F ∗ : there exists x−1 such that x ∗ x−1 = 1
Lecture 2, Page 9