BISS01
BISS01
net/Studenti/BISS09
Lecture 1
Introduction to Cryptography
Stefan Dziembowski
University of Rome
p
La Sapienza
BiSS 2009
Bertinoro International
Spring School
2‐6 March 2009
Plan
1. Introduction
2
2. Historical ciphers
3. Information‐theoretic security
4. Computational security
Cryptography
In the past:
Now:
Common usage:
yp y of X” = “breakingg X”
“cryptoanalysis
Cryptography
yp g p y – ggeneral picture
p
encryption authentication
In the past:
lack of precise definitions, ad‐hoc design,
usually insecure.
Nowadays:
formal definitions, systematic design, very
secure constructions.
Provable security
B t
But...
• why do we want to do it?
• how to define it?
• and is it possible to achieve it?
Provable security – the motivation
In many areas of computer science formal proofs are not essential.
For example, instead of proving that an algorithm is efficient,
we can just simulate it on a “typical input”.
Why?
Because a notion of a
“t i l adversary”
“typical d ”
does not make sense.
SSecurity
i definitions
d fi i i are useful
f l also
l because
b they
h allow
ll us to construct
schemes in a modular way...
Kerckhoffs' principle
Kerckhoffs
Auguste Kerckhoffs (1883):
The enemy knows the system
short key k
doesn t know k
doesn’t
should not learn m
(Of course Bob can use the same method to send messages to Alice.)
(That’s why it’s called the symmetric setting)
Correctness
for every k we should have Deck(Enck(m)) = m.
Plan
1. Introduction
2
2. Historical ciphers
3. Information‐theoretic security
4. Computational security
Shift cipher
M = words over alphabet {A,...,Z} ≈ {0,...,25}
K = {0,...,25}
Cesar: k = 3
Securityy of the shift cipher
p
How to break the shift cipher?
Check all possible keys!
Let c be a ciphertext.
M t probably
Most b bl only
l one such
h k exists.
it
A B C D E F G H I J K L M N O P R S T U WV X Y Z
π
A B C D E F G H I J K L M N O P R S T U WV X Y Z
Use statistical p
patterns of the
language.
Enigma
Main goals:
1. define security
2. construct schemes that are “provably secure”
Plan
1. Introduction
2
2. Historical ciphers
3. Information‐theoretic security
4. Computational security
Definingg “securityy of an encryption
yp scheme” is not
trivial.
how to define
security
?
(m – a message)
An idea
“The adversary should not be able to compute K.”
A problem
bl
An idea
“The adversary should not be able to compute m.”
A problem
An idea
“The
The adversary should not learn any information about m.
m”
Ap
problem
An idea
“The adversary should not learn any additional information
about m.”
F two
For t distributions
di t ib ti PA and
d PB we write
it
PA = PB So, it is the same as saying:
if they are equal (as functions)
functions). “for
for every a
P(A = a) = P(B = a)”
if X is an event then
PA|X denotes the distribution of A conditioned on X:
PA|X (a)
( ) = P (A = a | X).
X)
Notation
are independent if
for
f every b0,b
b1 :
P A | B = b0 = P A | B = b1
More notation
If
• A : Ω → A is a random variable, and
• f : A → B is a function,
function
then f(A) denotes a random variable Ω → B,
defined as
f(A)(ω) = f(A(ω)).
If A is a set then
Y←A
means that Y is chosen uniformly at random
from the set A.
How to formalize the “Idea 4”?
“The adversary should not learn any additional information
b
about m.””
intuitive...
A perfectly secret scheme: one‐time pad
Correctness is trivial:
This
h is b
because ffor every m
the distribution PEnc(K,m) is uniform
( d hence
(and h does
d not depend
d d on m).
)
for every c:
( = m xor c)) = 2‐t
( ( , ) = c)) = P(K
P(Enc(K,m)
Observation
One time pad can be generalized as follows
follows.
• Enc(k,m) = m + k
• Dec(k,m)
ec(k,m) = m – k
Why the one‐time
one time pad is not practical?
This is because:
Enck((m0) xor Enck((m1) = ((k xor m0) xor ((k xor m1)
= m0 xor m1
37
One time‐pad is optimal in the class of
perfectly secret schemes
Theorem (Shannon 1949)
In every perfectly secret encryption scheme
Enc : K × M → C , Dec : K × C → M
we have |K| ≥ |M|.
Proof
P f secrecy implies
Perfect i li that
h the
h distribution
di ib i off Enc(K,m)
E (K ) does
d not depend
d d on m
|K| ≥ |M|
Fact: we always have that |C| ≥ |M|.
This is because for every k we have that
Enck : M → C is an injection
(otherwise we wouldn’t be able to decrypt).
38
Practicality?
y
Generally, the one‐time pad is not very practical, since:
• the key has to be as long as the total length of the encrypted
messages,
• it is hard to generate truly random strings.
However, it is sometimes used (e.g.
in the military applications),
because of the following
advantages:
• perfect
f t secrecy,
a KGB one‐time pad hidden • short messages can be encrypted
in a walnut shell using pencil and paper .
In the 1960s the Americans and the Soviets established a hotline
yp
that was encrypted usingg the one‐time p
pad.(additional
(
advantage: they didn’t need to share their secret encryption
methods) 39
V
Venona project
j t (1946 – 1980)
40
Outlook
We constructed
W d a perfectly
f l secret
encryption scheme
41
What to do?
Idea
use a model where the power of
the
h adversary
d is limited.
l d
How?
Alternative options:
quantum cryptography,
q yp g p y, bounded‐storage
g model,...
,
(not too practical)
Quantum cryptography
Stephen Wiesner (1970s),
(1970s) Charles H
H. Bennett and Gilles Brassard (1984)
quantum link
Alice Bob
Practicality?
Warning:
Quantum cryptography should not be confused with quantum computing.
A satellite scenario
A third party (a satellite) is
broadcasting random bits.
000110100111010010011010111001110111
111010011101010101010010010100111100
001001111111100010101001000101010010
001010010100101011010101001010010101
Alice Bob
Does it help?
No...
Eve (Shannon’s theorem of course
co rse also
holds in this case.)
Ueli Maurer (1993): noisy channel.
1 0 1 0 1 0 0 1 1 0 1 0 0 1 0
1 0 1 0 1
0 0 0 0 1 1 0 1
0 0 0 1 0
1 1 0 1 0
1 1 0 0 1 1 0 1 0 0 1
0 1
0
1 0 1 0
1 1 0 0 1 1 0 1 0 0 1
0 0 some bits get flipped
(because of the noise)
000110100111010010011010111001110111
111010011101010101010010010100111100
001001111111100010101001000101010010
001010010100101011010101001010010101
Therefore,
Th f for
f the
h real‐life
l lif applications,
li i iit iis
enough if the schemes are secure against the
computationally‐limited adversaries.
50
Practical cryptography starts here:
Eve is computationally‐bounded
Eve is computationally‐bounded
Ideas:
1 “She
1. She has can use at most 1000
Intel Core 2 Extreme X6800 Dual Core Processors
for at most 100 years...”
2. “She can buy equipment worth 1 million euro and use it for 30 years..”.
ε → a value
l ““very close
l to zero”.
”
A probabilistic
Turing Machine
has an additional
tape with
random bits. 0 1 1 0 1 0 1 1 0 1
Some notation
If M is a Turing Machine then
M(X)
Y ← M(X)
means that the variable Y takes the value that M
outputs on input X (assuming the random
input is chosen uniformly).
Interactive Turing Machines
A B
B has read‐only
read only access to the “A’s
As A has read
read‐only
only access to the “B’s
Bs
output tape”. output tape”.
Interactive Turing Machines
Of course, we can generalize
li it tto a group off n machines
hi
interacting with each other.
“very small”
=
“negligible”
=
approaches
h 0 faster
f t than
th the
th inverse
i off any polynomial
l i l
Formally
A function µ : N → R is negligible if
1
∀ ∃ ∀ | μ ( n) | ≤ c
c n0 n > n0 n
Nice properties of these notions
• A sum of two polynomials is a polynomial:
poly + poly = poly
Moreover:
A
P (M breaks the scheme X) is negligible
polynomial‐time
Turing Machine M
The terms “negligible” and “polynomial” make sense only if X (and the adversary) take an
additional input 1n called
a security parameter.
Disadvantage
However
Usually one can prove formally an asymptotic result and then argue
informally that “the
the constants are reasonable
reasonable”
adversary
(polynomial‐time probabilistic Turing machine) oracle
Security definition:
We say that (Enc,Dec)
(Enc Dec) is semantically‐secure
semantically secure if any polynomial time adversary guesses b
correctly with probability at most 0.5 + ε(n), where ε is negligible.
Testing the definition
c1 = Enc(k,m’1) oracle
...
chooses m’t m’t
c = Enc(k,m
(k b)
Security definition
Observation
Every CPA‐secure encryption has to be
• randomized, or
• “have a state”.
CPA in real‐life
Q: Aren’t we too pessimistic?
A: No! CPA can be implemented in practice
practice.
Example: routing
Enck(m)
k k
m
Is it possible to prove security?
Bad
d news:
Theorem
If semantically‐secure
encryption
i exists
i
(with |k| < |m| )
then
P ≠ NP
m0,,m1
1. selects
1 l t k randomly
d l
chooses random m0,m1
c 2. chooses a random b = 0,1
such that |mi|=n+1
3. calculates c := Enc(k,mb)
If (c,m0) Є L then output 0
else output 1
Proof [2/3]
The adversary
Th d guesses b incorrectly
i tl only l if b = 1
and (c,m0) Є L. In other words:
k
keys SSo, the
th adversary
d wins
i withith
c = Enck(m1) probability at least 3/4
Moral:
“If
If P
P=NP,
NP, then the semantically‐secure
semantically secure encryption is
broken”
Is it 100% true?
Not really...
This is
Thi i because
b even if P=NP
P NP we do
d nott know
k what
h t
are the constants.
Therefore
proving
i that
h an encryption
i scheme
h iis secure is
i probably
b bl much
h
harder than proving that P ≠ NP.
What can we prove?
We can prove conditional results.
results
then scheme X is
e sc
then e e X iss
scheme secure
secure.
secure.
Research program in cryptography
Base the security of cryptographic schemes on a small number of
well‐specified
p “computational
p assumptions”.
p
Examples of A:
“decisional Diffie‐Hellman assumption”
p
“strong RSA assumption”