Lect1 PDF
Lect1 PDF
Lect1 PDF
1 L ECTURE S UMMARY
We overview the aims and the philosophy of modern cryptography. We exemplify this approach
with the first shot at a definition of encryption scheme security, which we will develop later on in
this class. We then give a classic definition given by Claude Shannon of perfect secrecy for an
encryption. We show that various classic ciphers fail to satisfy this definition, but we also show a
cipher called One-Time Pad which does satisfy it. However, this cipher has very limited applicability
because the communicating parties must share a pre-agreed key which is as long as the message, i.e.
as all the communication they will be able to secretly exchange between them. We show, moreover,
that this is a fundamental limitation of every perfectly secure cipher. In other words, we show
that no perfectly secure cipher can have keys shorter than the message. This motivates the need
to relax Shannon’s information-theoretic perfect secrecy requirement on encryption schemes with a
computational secrecy property instead. We’ll develop such computational secrecy property in the
next lecture.
L1-1
may intercept Alice’s communication, but reading it should not enable her to reconstruct Alice’s
message to Bob. This is the essence of the problem of secure communication.
To communicate the message secretly, Alice must transform her plaintext message somehow.
We call this transformation an encryption, while the reverse transformation done by the receiver Bob
is called decryption. The original message is called a plaintext while the output of the encryption
procedure applied to the plaintext is called a ciphertext. Thus the above secure communication
problem can be solved by a (private key) encryption scheme. We call an encryption scheme EΣ a
triple of (efficient) algorithms (Kgen, Enc, Dec) and a message space M s.t.
KGen is a probabilistic algorithm which picks key k
(for simplicity assume for now that k is picked at random in some keyspace K)
Enc is an encryption algorithm, Enc : K × M → C
C is a ciphertext space (defined by Enc, K, and M)
Dec is a decryption algorithm, Dec : K × C → M
Apart from requiring that all these algorithms are efficient, we also require the completeness prop-
erty2 , which says that:
∀k←K , ∀m∈M , if c ← Enc(k, m) then m ← Dec(k, c)
Now we are ready for the first attempt at defining what we mean by a secure encryption:
Definition 1 (One-Way Secure Encryption (first draft)) We call a (private key) encryption scheme
EΣ one-way secure if for every efficient algorithm E, the following holds:3
P r[E(c) = m | k ← K, m ← M, c ← Enc(k, m)] ≤ negl (1)
(where by negl we denote a negligible probability)
In other words, if k and m are picked at random and c = Enc(k, m) then E is unlikely to output
back m given the ciphertext c. (We postpone the exact definition of an efficient algorithm and
negligible probability to the next lecture.)
Intuitively, what the “one-way security” property of encryption implies is that it is computa-
tionally hard to decrypt the message from a ciphertext of a random message. We call it “one-way”
because it says that encrypting is like a one-way process: It is easy to encode a message in a cipher-
text (given the key), but it is hard to reverse this encoding and get the message back (without the
key).
Limitations of One-Way Security. While this “one-way security” property must hold for an en-
cryption scheme to be secure in any sense at all, this property is actually pretty weak:
What about a-priori knowledge on messages space? If the message is chosen not at random from
the whole (big) space M, but say the message is always some fixed m0 or m1 , for example
m0 =”buy IBM stock” and m1 =”sell IBM stock”, then the fact that the encryption is one-
way secure as specified above does not imply that an efficient algorithm E cannot guess the
message m, if E knows that m is equal to either m0 or to m1 .
2
“Completeness” properties always say that everything works as it should if the parties use the protocol as it is intended
3
With notation P r[A | B] we denote a conditional probability that event A holds given that event B occurs.
L1-2
What if all security depends on only few bits of m? Even if E does not have any a-priori infor-
mation about the messages exchanged by A and B, one-way security is hardly enough. Be-
cause what if E is interested not in the whole m but only in some particular bits of it? An
encryption scheme can be indeed one-way secure while revealing some bits of m, and if these
bits are exactly what E wants most to learn about m, the encryption scheme is not satisfactory.
Semantic Security Rather than merely requiring that E cannot decrypt the whole m given c =
Enc(k, m) for randomly chosen k and m, we can pose a stronger requirement, called “se-
mantic security”. We’ll define this notion precisely later on, but at first approximation, we call
an encryption scheme semantically secure if anything that can be computed by some efficient
algorithm E about message m given the ciphertext c = Enc(k, m), for random k and m
chosen according to any, potentially very restricted, probability distribution M, can be also
efficiently computed without knowing this ciphertext. In other words, semantic security cap-
tures the notion that the ciphertext is useless for deciphering any information about message
chosen from any a-priori known distribution.4
Active Attacks In both communication games above, the adversary E is passive in the sense that
E only gets to see one ciphertext c of message m ∈ M for some probability distribution
M. However, an adversary can be active too, so the security can be defined in terms of (non-
existence of) an efficient algorithm E which first has access to either the encryption algorithm
of Alice or the decryption algorithm of Bob, for example E can ask Alice to see encryptions
of some (test) messages m1 , m2 , ... of E’s choice, and only then E faces either the one-way
encryption or the semantic-security test.
Another point I want you to draw from the above example is that this was just one example
of defining some security property of a cryptographic communication scheme. In the above case
we defined “one-way security” of a private key encryption scheme. But there are other “secure
communication tasks” we will want to achieve in this class:
Public key encryption allows Alice and Bob to have a private conversation without the necessity
of first exchanging a secret key. One party, say Bob, can have a public and a private key pair.
Alice, knowing Bob’s public key, can encrypt messages so that only Bob, the owner of the
corresponding private key, can decrypt it. Unlike the private-key encryption discussed above,
this way everyone, for example by grabbing Bob’s public key from his webpage, can send
messages secretly to Bob. But also unlike in the case of private-key encryption, when we
define the security property of public-key encryption, the attacker E should also learn Bob’s
public key. Thus the communication game between A, B, and C changes quite a bit.
Digital signatures enable Bob to verify that the message he receives is from Alice, and that it has
not been modified by anyone else. Here E’s task will be to create a signature forgery, i.e. a
4
If this sounds too complex, just skip it for now. It’ll be clearer later on.
L1-3
message which will convince Bob that it came from Alice, while in fact Alice has never signed
this message. As in the case of encryption, we can and should consider active attackers E
who first ask Alice to sign any number of (test) messages m1 , m2 , ... of their choice, and still
are unable to produce a forgery on some m s.t. for all i, m 6= mi .
Identification Schemes enable Alice to authenticate herself to Bob. Eve’s task is to spoof Alice to
Bob, i.e. to convince Bob that she, Eve, is Alice too...
Secure function evaluation allows Alice and Bob (and possibly more parties) to compute some
function of their input without revealing any extra information to other parties or eavesdrop-
pers. One example of a function one would want to compute securely are various database
problems. For example, Alice and Bob each have a database containing a list of some police
suspects. Can they compare the lists securely in the sense that they will identify all suspects
who appear on both lists, but no other information about their databases will be exchanged in
the process of this computation?
Algorithms are public We preclude the “security by obscurity” approach. We assume that the
adversary knows what scheme he is attacking, and hence knows what Encryption and De-
cryption algorithms Alice and Bob use. This assumption is implicit in definition 1 when we
say “for every” algorithm E, which implies that we include algorithms E which are aware of
algorithms KGen, Enc, and Dec.
Secrets are secret Note that attacker E does not get to see the key k. This is almost always the
case. If E knows everything that A and B know, it’s hard to think of any notion of a se-
cure communication task that A and B can perform while E is somehow precluded from
participation.
Adversary is bounded Usually, the adversary E has some limitations. In definition 1, he is re-
quired to be an efficient, i.e. probabilistic polynomial-time, algorithm. This limits the amount
of time and space he has to compute. But there are notions of security for unbounded adver-
sary too. This will be the perfect security notion we’ll develop below.
Computational hardness assumptions We will usually assume that there are some problems which
are computationally hard, like the factoring problem.
L1-4
if the underlying hardness assumption holds (i.e. factoring or discrete log problem are indeed com-
putationally hard) then the encryption scheme EΣ is one-way secure.
In fact, the big picture of cryptography is that we can build in the above fashion, from relatively
simple assumptions (like hardness of factoring), to more complicated ones (like one-wayness of en-
cryption). In the process we can identify some cryptographic objects, like one-way functions, pseu-
dorandom number generators, collision-resistant functions, and more, whose security properties are
“natural” in the sense that we can find multiple uses for them, to construct efficient signatures, au-
thentication schemes, encryption schemes, and other secure communication schemes. At the same
time, they are well-defined and therefore we can attempt to construct them using various number-
theoretic assumptions (like hardness of factoring or discrete-log) and we can improve and/or better
understand the efficiency and security of these constructions.
Definition 2 (Perfect Secrecy) An encryption scheme satisfies perfect secrecy if for all messages
m1 , m2 in message space M and all ciphertexts c ∈ C, we have
where both probabilities are taken over the choice of K in K and over the coin tosses of the (possi-
bly) probabilistic algorithm Enc.
Note that another way of stating the perfect secrecy requirement is that for any c ∈ C there exists
a constant pc ∈ [0, 1] s.t. for all m ∈ M , we have P rob[Enc(K, m) = c] = pc .
K←K
In other words, what perfect secrecy requires is that, given a ciphertext, every message in the
message space is exactly as likely to be the underlying plaintext. To put it yet another way, the
plaintext is independent of the ciphertext. Thus the perfect secrecy requirement implies that the
eavesdropper truly learns nothing at all about the underlying plaintext.
Given this strong definition of secrecy, let’s look how some classic ciphers do with regards to it.
L1-5
K : {0, ..., 25} defines the shift (Historical note: k = 3 is known as “Caesar’s cipher”)
c = End(k, [m1 , ..., mℓ ]) = [(m1 + k mod 26), ..., (mℓ + k mod 26)]
• Keyspace is too small, only 26 possible keys; succumbs to brute force (exhaustive search)
attack easily.
However, let’s see how this cipher fails the perfect secrecy definition.
Claim 3 Shift cipher does not satisfy the perfect secrecy property for ℓ ≥ 2.
Proof: Take m1 = “AB”, m2 = “AZ”, and c = “BC”. Then there exists a key k ∈ K s.t.
Enc(k, m1 ) = c, namely k = 1. However, for all k ∈ K we have Enc(k, m2 ) 6= c, and hence
P rob[Enc(K, m1 ) = c] = 1/26, while P rob[Enc(K, m2 ) = c] = 0, and so the perfect secrecy
K←K K←K
requirement is violated.
Claim 4 For ℓ = 1, i.e. for one-letter long messages, shift cipher actually does satisfy the perfect
secrecy property.
Proof: Note that for every letter m and every c ∈ C where C = M = {A, ..., Z}, there is a unique
key k = c − m mod 26 s.t. Enc(k, m) = (m + k mod 26) = c. And therefore for every m, c we
have P rob[Enc(k, m) = c] = 1/26, and so the perfect secrecy requirement is satisfied.
k←K
K : permutations on {0, ..., 25}; i.e. each k∈K is chosen at random and is a 1:1 mapping from
{0, ..., 25} to {0, ..., 25}
c = Enc(k, [m1 , ..., mℓ ]) = [k(m1 ), k(m2 ), ..., k(mℓ )], for m = [m1 , ..., mℓ ] ∈ M and k ∈ K
L1-6
Example 2 Key k is the mapping from Plaintext Alphabet to Ciphertext Alphabet.
So if m=”HELLO”; k is mapping in Table 1; c=”JREEM”
Comments on security:
• Vulnerable to brute force attack: keyspace is 26! (not so bad for a computer).
Claim 5 Permutation cipher also is perfectly secure for ℓ = 1 but fails to satisfy the perfect secrecy
property for ℓ ≥ 2.
c = Enc(k, [m1 , ..., mℓ ]) s.t. c = [c1 , ..., cℓ ] where ci = (mi + ki( mod n) ) mod 26 for m =
[m1 , ..., mℓ ] ∈ M and k = [k0 , ..., kn−1 ] ∈ K.
i.e. a key k can be thought of as the double (n-character keyword, effective key). If n < ℓ,
concatenate k to itself ⌊ℓ/k⌋ times to get the effective key.
Example 3 m =“HELLOBOB”
k =(keyword=“SECRET”,effective key=“SECRETSE”)
Using {A, ..., Z} ≡ {0, ..., 25}, we get
c =[(H+S),(E+E),(L+C),(L+R),(O+E),(B+T),(O+S),(B+E)] mod 26 = “ZINCSUGF”
Comments on security:
• Although this withstands simple frequency analysis, the scheme breaks once you figure the
keyword length (n). Once n is known (or guessed), one simply does frequency analysis on n
blocks of ciphertext, each block formed by concatenating every nth letter of the original c.
• A brute force attack requires a search of 26n , which leaks information if n < ℓ.
Claim 6 Additive cipher is perfectly secure for ℓ = n but fails to satisfy the perfect secrecy property
for ℓ ≥ n.
L1-7
3.5 O NE T IME PAD [OTP] (V ERNAM C IPHER )
M : {0, 1}ℓ , where ℓ is the message length.
K : {0, 1}ℓ .
c = Enc(k, m) = m ⊕ k, for m ∈ M, k ∈ K, where “⊕” stands for a bit-wise xor
m = Dec(k, c) = c ⊕ k, for m ∈ M, k ∈ K.
Decryption works because (c ⊕ k) = ((m ⊕ k) ⊕ k) = m ⊕ (k ⊕ k) = m
Example 4
m = [0011100100010110101101110]
k = [1110100110101000110001111]
c = [1101000010111110011100001]
P rob[Enc(k, m1 ) = c] = P rob[Enc(k, m2 ) = c]
k←K k←K
L1-8
Even though the OTP method is secure, it has a big flaw which makes it impractical: The key
needs to be as long as the total length of all communication that can ever be encrypted using this
key. So if two communication components (computers, cell phones, whatever) establish a shared
key of length, say, ℓ = 1K bytes, and plan to use it to communicate secretly using the OTP cipher,
they can only send at most 1K of traffic between each other. There might be some exotic cases
where this is enough, but it usually will not be.
Note also that there does not seem to be a way to bootstrap this initial key so that to send some
traffic, say 0.5K, using 0.5K of the key material, and then have one party create and secretly send
to the other a new 1K secret key using the remaining 0.5K of the old secret key material.
In fact, we can easily show that no such trick can possibly work and that the above impracticality
of the OTP cipher is inherent to any cipher which satisfies Shannon’s perfect secrecy requirement.
Theorem 8 (Optimality of OTP) For any encryption scheme EΣ which satisfies Shannon’s perfect
secrecy requirement, it must be that the keyspace K has the same size as the message space M.
If keys and messages are binary string, M = {0, 1}ℓ and K = {0, 1}n , this means that an
encryption scheme can be perfectly secure only if n = ℓ. Thus the OTP cipher is optimal with
respect to the key length.
Proof: Assume for contradiction that an encryption scheme EΣ has |K| < |M|. Take any ciphertext
cC s.t. there exists some m∗ ∈ M and k∗ ∈ K s.t. Enc(k∗ , m∗ ) = c. Let us count the number of
messages m that could result from the decryption of c under some valid secret key k ∈ K. I.e.,
let S ∈ M be the set of messages S = {m | ∃k∈K Enc(k, m) = c}. Note that S = {m =
Dec(k, c)}k∈K , and since to every k ∈ K there corresponds at most one unique m = Dec(k, c),
the size of set S is at most the size of K. Therefore, there exists a non-empty set S ′ = M \ S of
messages s.t. for each m ∈ S ′ there exists no key kK s.t. c = Enc(k, m). In other words, for all
m ∈ S ′ we have
P rob[Enc(K, m) = c] = 0
K←K
P rob[Enc(K, m∗ ) = c] 6= 0
K←K
L1-9
A Shannon’s Original Definition of Secrecy
Definition 9 (Shannon Secrecy) Let D be any probability distribution on messages. An encryption
scheme satisfies Shannon secrecy w.r.t. the message distribution D if for all messages m (regardless
of the probability distribution D) and all c ∈ C we have
where the first probability is taken over M chosen according to distribution D, over random keys
K chosen in K, and over the possible random choices of the (possibly) probabilistic encryption
algorithm Enc, while the second probability is taken over M ← D.
We say that encryption scheme satisfies Shannon secrecy if it satisfies Shannon secrecy w.r.t. all
probability distributions D on messages.
What this requirement says is that, for any a-priori distribution of messages D,5 the probability
that a communicated message M D is equal to any particular message m does not change even if we
know the ciphertext c = Enc(K, M ), for randomly generated key K ← K. In other words, seeing
a ciphertext does not tell us any more about message M which the attacker does not already know
from the a-priori message distribution D.
5
For example, we might know that A and B usually communicate in English sentences, in which case the a-priori
probability distribution D would assign an extremely low probability to message m =”axrqe asdvas”...
L1-10