Stream Ciphers - Block Ciphers (1)
Stream Ciphers - Block Ciphers (1)
Cryptography
Murat Osmanoglu
Formal Definiton of Security
(in the Context of Encryption)
If you don’t understand what you want to achieve, how can
you possibly know when (or if) you have achieve it?
Formal Definiton of Security
(in the Context of Encryption)
If you don’t understand what you want to achieve, how can
you possibly know when (or if) you have achieve it?
Sounds good
Formal Definiton of Security
(in the Context of Encryption)
• What should a secure encryption scheme guarantee ?
Sounds good
• Known-plaintext attack :
• the adversary has some plaintext-ciphertext pairs computed
using some key
• it tries to get information about the plaintext of some other
ciphertext computed using the same key
Formal Definiton of Security
(in the Context of Encryption)
There are several options for the threat model
• Ciphertext-only attack :
• the adversary just observes a ciphertext and attemps to
determine information about the underlying plaintext
• Known-plaintext attack :
• the adversary has some plaintext-ciphertext pairs computed
using some key
• it tries to get information about the plaintext of some other
ciphertext computed using the same key
• Chosen-plaintext attack :
• the adversary is allowed to get some plaintext-ciphertext pairs
for plaintexts of its choice
Formal Definiton of Security
(in the Context of Encryption)
There are several options for the threat model
• Ciphertext-only attack :
• the adversary just observes a ciphertext and attemps to
determine information about the underlying plaintext
• Known-plaintext attack :
• the adversary has some plaintext-ciphertext pairs computed
using some key
• it tries to get information about the plaintext of some other
ciphertext computed using the same key
• Chosen-plaintext attack :
• the adversary is allowed to get some plaintext-ciphertext pairs
for plaintexts of its choice
• Chosen-ciphertext attack :
• the adversary is additionally allowed to get the decryption of
ciphertexts of its choice
Perfect Secrecy
• ‘’A Mathematical Theory of Communication’’, Claude E. Shannon, Bell
System Technical Journal, 1948
Perfect Secrecy
• ‘’A Mathematical Theory of Communication’’, Claude E. Shannon, Bell
System Technical Journal, 1948
Ciphertext-only attack
Perfect Secrecy
• An encryption scheme is perfectly secret if for every m
in M and for every c in C, Pr[M=m] = Pr[M=m l C=c]
• If m is two-letter message:
m : 0 1 1 0 1 1 0 0 1 1
XOR
k : 1 0 1 1 0 1 0 1 0 1
c : 1 1 0 1 1 0 0 1 1 0
One-Time Pad
• introduced by Frank Miller in 1882
• patented by Vernam in 1917
• Shannon demonstrated that one-time pad achieves perfect secrecy
• It is not practical !
• the key is as long as the message
• the key cannot be reused
• two parties must share a new key whenever they
coomunicate
Computational Security
Charlie Adversary
(Challenger)
k, Enc( . )
Computational Security
4) regardless of any information an attacker already has, a ciphertext
should leak no additional information about the underlying plaintext
Charlie Adversary
(Challenger)
m1, m0 in M
k, Enc( . )
Computational Security
4) regardless of any information an attacker already has, a ciphertext
should leak no additional information about the underlying plaintext
Charlie Adversary
(Challenger)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
Computational Security
4) regardless of any information an attacker already has, a ciphertext
should leak no additional information about the underlying plaintext
Charlie Adversary
(Challenger)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
b’
Computational Security
4) regardless of any information an attacker already has, a ciphertext
should leak no additional information about the underlying plaintext
Charlie Adversary
(Challenger)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
b’
Charlie Adversary
(Challenger)
m1, m0 in M
k, Enc( . )
The scheme is IND-EAV secure
cb = Enc(k, mb)if the adversary
b ç {0, 1}
wins the game with the probability 1/2 + ε
b’
• the client and the server use the same key (usually created from the
user’s password) in exactly same way for sending their messages
k k
Attacks on Stream Ciphers
1) two-time pad is insecure
• the client and the server use the same key (usually created from the
user’s password) in exactly same way for sending their messages
m1
k m2 k
m3
• the client and the server use the same key (usually created from the
user’s password) in exactly same way for sending their messages
m1 s1
k m2 s2 k
m3 s3
m
Attacks on Stream Ciphers
2) no integrity (just confidentiality)
Enc
m m XOR k
Attacks on Stream Ciphers
2) no integrity (just confidentiality)
Enc
m m XOR k
XOR
u
m XOR k XOR u
Attacks on Stream Ciphers
2) no integrity (just confidentiality)
Enc
m m XOR k
XOR
u
Dec
m XOR u m XOR k XOR u
Attacks on Stream Ciphers
2) no integrity (just confidentiality)
Enc
From : Alice From : Alice
XOR
...
Dec
From : xxxx From : xxxx
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie Adversary
(Challenger)
k, Enc( . )
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie m Adversary
(Challenger)
Enc(k, m)
k, Enc( . )
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie m Adversary
(Challenger)
Enc(k, m)
m1, m0 in M
k, Enc( . )
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie m Adversary
(Challenger)
Enc(k, m)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie m Adversary
(Challenger)
Enc(k, m)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
Enc(k, m)
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie m Adversary
(Challenger)
Enc(k, m)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
Enc(k, m)
b’
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie m Adversary
(Challenger)
Enc(k, m)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
Enc(k, m)
b’
adversary wins the game if b = b’
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie m Adversary
(Challenger)
Enc(k, m)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
The scheme is IND-CPA
m secure if the adversary
wins the game with the probability 1/2 + ε
Enc(k, m)
b’
adversary wins the game if b = b’
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie m Adversary
(Challenger)
Enc(k, m)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
The scheme is IND-CPA
m secure if the adversary
wins the game with the probability 1/2 + ε
Enc(k, m)
one-time pad is not IND-CPA secure
b’
adversary wins the game if b = b’
Computational Security
indistinguishability under chosen-plaintext attack (IND-CPA)
Charlie m Adversary
(Challenger)
Enc(k, m)
m1, m0 in M
k, Enc( . )
cb = Enc(k, mb)
b ç {0, 1}
The scheme is IND-CPA
m secure if the adversary
wins the game with the probability 1/2 + ε
Enc(k, m)
one-time pad is not IND-CPA secure
b’
deterministic encryption
adversary is not
wins the game if IND-CPA
b = b’ secure
Block Ciphers
k bits KEY
n bits n bits
n bits n bits
Canonical Examples
• DES : n = 64 bits, k = 56 bits
• 3DES : n = 64 bits, k = 168 bits
• AES : n = 128 bits, k = 128, 192, 256 bits
Block Ciphers
k bits KEY
n bits n bits
Canonical Examples
• DES : n = 64 bits, k = 56 bits
• 3DES : n = 64 bits, k = 168 bits
• AES : n = 128 bits, k = 128, 192, 256 bits
Block Ciphers
k
k1 k2 ... kn
k1 k2 ... kn
k1 k2 ... kn
h+ps://en.wikipedia.org/wiki/DES_Challenges
DES – Exhaustive Search
Strengthening DES
• Triple-DES
DES – Exhaustive Search
Strengthening DES
• Triple-DES
• Triple-DES
• Triple-DES
• Triple-DES
• 1998 : 15 submission
• 1998 : 15 submission
• if m1 = m2, then c1 = c2
Modes of Operations
Electronic Code Book
• if m1 = m2, then c1 = c2
• same data block always gets encrypted in the same way
reveals patterns when data repeats
Modes of Operations
Electronic Code Book
• if m1 = m2, then c1 = c2
• same data block always gets encrypted in the same way
reveals patterns when data repeats
• it is deterministic !
not IND-CPA, not IND-EAV
Modes of Operations
Cipher Block Chaining
Modes of Operations
Cipher Block Chaining
• uses a random initialization vector
• block i depends on block i-1
Modes of Operations
Cipher Block Chaining
• uses a random initialization vector
• block i depends on block i-1