Top Banner
Shannon’s theory Ref. Cryptography: theory and practice Douglas R. Stinson
34

Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Dec 20, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Shannon’s theory

Ref. Cryptography: theory and practice

Douglas R. Stinson

Page 2: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Shannon’s theory

1949, “Communication theory of Secrecy Systems” in Bell Systems Tech. Journal.

Two issues: What is the concept of perfect secrecy? Does

there any cryptosystem provide perfect secrecy?

It is possible when a key is used for only one encryption

How to evaluate a cryptosystem when many plaintexts are encrypted using the same key?

Page 3: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Outline

Introduction One-time pad

Elementary probability theory Perfect secrecy Entropy Spurious keys and unicity distance

Page 4: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Categories of cryptosystem (1)

Computational security: The best algorithm for breaking a cryptosyste

m requires at least N operations, where N is a very large number

No known practical cryptosystem can be proved to be secure under this definition

Study w.r.t certain types of attacks (ex. exhaustive key search) does not guarantee security against other type of attack

Page 5: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Categories of cryptosystem (2)

Provable security Reduce the security of the cryptosystem to

some well-studied problems that is thought to be difficult

Ex. RSA integer factoring problem Unconditional security

A cryptosystem cannot be broken, even with infinite computational resources

Page 6: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

One-Time Pad

Unconditional security !!! Described by Gilbert Vernam in 1917 Use a random key that was truly as

long as the message, no repetitionsnKCP )( 2 ),,( 1 nxxx ),,( 1 nKKK

2 mod ),,()( 11 nnK KxKxxe

2 mod ),,()( 11 nnK KyKyyd

For ciphertext ),,( 1 nyyy

Page 7: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Example: one-time pad

Given ciphertext with Vigenère Cipher: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS

Decrypt by hacker 1:

Ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTSKey: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyihPlaintext: mr mustard with the candlestick in the hall

Decrypt by hacker 2:

Ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTSKey: pftgpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwtPlaintext: miss scarlet with the knife in the library

Which one?

Page 8: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

a b c d e f g h i j k l m n o p q r s t u v w x y z ?A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ?B C D E F G H I J K L M N O P Q R S T U V W X Y Z ? AC D E F G H I J K L M N O P Q R S T U V W X Y Z ? A BD E F G H I J K L M N O P Q R S T U V W X Y Z ? A B CE F G H I J K L M N O P Q R S T U V W X Y Z ? A B C DF G H I J K L M N O P Q R S T U V W X Y Z ? A B C D EG H I J K L M N O P Q R S T U V W X Y Z ? A B C D E FH I J K L M N O P Q R S T U V W X Y Z ? A B C D E F GI J K L M N O P Q R S T U V W X Y Z ? A B C D E F G HJ K L M N O P Q R S T U V W X Y Z ? A B C D E F G H IK L M N O P Q R S T U V W X Y Z ? A B C D E F G H I JL M N O P Q R S T U V W X Y Z ? A B C D E F G H I J KM N O P Q R S T U V W X Y Z ? A B C D E F G H I J K LN O P Q R S T U V W X Y Z ? A B C D E F G H I J K L MO P Q R S T U V W X Y Z ? A B C D E F G H I J K L M NP Q R S T U V W X Y Z ? A B C D E F G H I J K L M N OQ R S T U V W X Y Z ? A B C D E F G H I J K L M N O PR S T U V W X Y Z ? A B C D E F G H I J K L M N O P QS T U V W X Y Z ? A B C D E F G H I J K L M N O P Q RT U V W X Y Z ? A B C D E F G H I J K L M N O P Q R SU V W X Y Z ? A B C D E F G H I J K L M N O P Q R S TV W X Y Z ? A B C D E F G H I J K L M N O P Q R S T UW X Y Z ? A B C D E F G H I J K L M N O P Q R S T U VX Y Z ? A B C D E F G H I J K L M N O P Q R S T U V WY Z ? A B C D E F G H I J K L M N O P Q R S T U V W XZ ? A B C D E F G H I J K L M N O P Q R S T U V W X Y? A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

abcdefghijklmnopqrstuvwxyz?

Page 9: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Problem with one-time pad

Truly random key with arbitrary length? Distribution and protection of long keys

The key has the same length as the plaintext!

One-time pad was thought to be unbreakable, but there was no mathematical proof until Shannon developed the concept of perfect secrecy 30 years later.

Page 10: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Preview of perfect secrecy (1)

When we discuss the security of a cryptosystem, we should specify the type of attack that is being considered Ciphertext-only attack

Unconditional security assumes infinite computational time Theory of computational complexity × Probability theory ˇ

Page 11: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Preview of perfect secrecy (2)

Definition: A cryptosystem has perfect secrecy if Pr[x|y] = Pr[x] for all xP, yC

Idea: Oscar can obtain no information about the plaintext by observing the ciphertext

Alice Bob

Oscar

x y

Page 12: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Outline

Introduction One-time pad

Elementary probability theory Perfect secrecy Entropy Spurious keys and unicity distance

Page 13: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Discrete random variable (1)

Def: A discrete random variable, say X, consists of a finite set X and a probability distribution defined on X.

The probability that the random variable X takes on the value x is denoted Pr[X=x] or Pr[x]

0≤Pr[x] for all xX, 1]Pr[ Xx

x

Page 14: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Discrete random variable (2)

Ex. Consider a coin toss to be a random variable defined on {head, tails} , the associated probabilities Pr[head]=Pr[tail]=1/2

Ex. Throw a pair of dice. It is modeled by Z={(1,1), (1,2), …, (2,1), (2,2), …, (6,6)}

where Pr[(i,j)]=1/36 for all i, j. sum=4 corresponds to {(1,3), (2,2), (3,1)} with

probability 3/36

Page 15: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Joint and conditional probability

X and Y are random variables defined on finite sets X and Y, respectively.

Def: the joint probability Pr[x, y] is the probability that X=x and Y=y

Def: the conditional probability Pr[x|y] is the probability that X=x given Y=y

Pr[x, y] =Pr[x|y]Pr[y]= Pr[y|x]Pr[x]

Page 16: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Bayes’ theorem If Pr[y] > 0, then

Ex. Let X denote the sum of two dice. Y is a random variable on {D, N}, Y=D i

f the two dice are the same. (double)

]Pr[

]|Pr[]Pr[]|Pr[

y

xyxyx

3

1

36/3

)6/1)(6/1(

]4Pr[

]Pr[]|4Pr[]4|Pr[

DDD

Page 17: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Outline

Introduction One-time pad

Elementary probability theory Perfect secrecy Entropy Spurious keys and unicity distance

Page 18: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Definitions

Assume a cryptosystem (P,C,K,E,D) is specified, and a key is used for one encryption

Plaintext is denoted by random variable x Key is denoted by random variable K Ciphertext is denoted by random variable y

Plaintext Ciphertext

x y

K

Page 19: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Perfect secrecy

Definition: A cryptosystem has perfect secrecy if Pr[x|y] = Pr[x] for all xP, yC

Idea: Oscar can obtain no information about the plaintext by observing the ciphertext

Alice Bob

Oscar

x y

Page 20: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Relations among x, K, y

Ciphertext is a function of x and K

y is the ciphertext, given that x is the plaintext

)}(:{

)](Pr[]Pr[]Pr[KCyK

K ydKy xKy

)}(:{

]Pr[]|Pr[ydxK K

Kxy Kxy

Page 21: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Relations among x, K, y

x is the plaintext, given that y is the ciphertext

]|Pr[ yx yx]Pr[

]|Pr[]Pr[

y

xyx

)}(:{

)}(:{

)](Pr[]Pr[

]Pr[]Pr[

KCyKK

ydxK

ydK

KxK

xK

Kx

Page 22: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Ex. Shift cipher has perfect secrecy (1)

Shift cipher: P=C=K=Z26 , encryption is defined as

Ciphertext:

26 mod )()( KxxeK

26

)](Pr[]Pr[]Pr[ZK

K ydKy xKy

26

]Pr[261

ZK

Kyx

261

261

26

]Pr[ ZK

Kyx

Page 23: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Ex. Shift cipher has perfect secrecy (2)

Pr[y|x]

Apply Bayes’ theorem

261]26 mod )(Pr[ xyK

]Pr[

]|Pr[]Pr[]|Pr[

y

xyxyx

]Pr[]Pr[

261

261

xx

Perfect secrecy

Page 24: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Perfect secrecy when |K|=|C|=|P|

(P,C,K,E,D) is a cryptosystem where |K|=|C|=|P|.

The cryptosystem provides perfect secrecy iff every keys is used with equal probability 1/|K| For every xP, yC, there is a unique key K suc

h that

Ex. One-time pad in Z2

yxeK )(

Page 25: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Outline

Introduction One-time pad

Elementary probability theory Perfect secrecy Entropy Spurious keys and unicity distanceHow about the security when many plaintexts are encrypted using one key?

Page 26: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Preview (1)

We want to know: the average amount of ciphertext required

for an opponent to be able to uniquely compute the key, given enough computing time

Plaintext Ciphertextxn yn

K

Page 27: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Preview (2)

We want to know: How much information about the key is rev

ealed by the ciphertext = conditional entropy H(K|Cn)

We need the tools of entropy

Page 28: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Entropy (1)

Suppose we have a discrete random variable X What is the information gained by the outcome

of an experiment? Ex. Let X represent the toss of a coin, Pr[he

ad]=Pr[tail]=1/2 For a coin toss, we could encode head by 1,

and tail by 0 => i.e. 1 bit of information

Page 29: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Entropy (2) Ex. Random variable X with Pr[x1]=1/2,

Pr[x2]=1/4, Pr[x3]=1/4 The most efficient encoding is to

encode x1 as 0, x2 as 10, x3 as 11. Notice: probability 2-n => n bits p => -log2 p The average number of bits to encode

X2

32

4

12

4

11

2

1

Page 30: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Entropy: definition

Suppose X is a discrete random variable which takes on values from a finite set X. Then, the entropy of the random variable X is defined as

Xx

xxH ]Pr[log]Pr[)( 2X

Page 31: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Entropy : example

Let P={a, b}, Pr[a]=1/4, Pr[b]=3/4. K={K1, K2, K3}, Pr[K1]=1/2, Pr[K2]=Pr[K3]= 1/4. encryption matrix: a b

K1 1 2

K2 2 3

K3 3 4

H(P)= 81.04

3log

4

3

4

1log

4

122

H(K)=1.5, H(C)=1.85

Page 32: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Conditional entropy

Known any fixed value y on Y, information about random variable X

Conditional entropy: the average amount of information about X that is revealed by Y

Theorem: H(X,Y)=H(Y)+H(X|Y)

x

yxyxyH ]|Pr[log]|Pr[)|( 2X

y x

yxyxyH ]|Pr[log]|Pr[]Pr[)|( 2YX

Page 33: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Theorem (1)

Let (P,C,K,E,D) be a cryptosystem, then H(K|C) = H(K) + H(P) – H(C) Proof:

H(K,P,C) = H(C|K,P) + H(K,P)

Since key and plaintext uniquely determine the ciphertext

H(C|K,P) = 0

H(K,P,C) = H(K,P) = H(K) + H(P)

Key and plaintext are independent

Page 34: Shannon ’ s theory Ref. Cryptography: theory and practice Douglas R. Stinson.

Theorem (2) We have Similarly,

Now,

H(K,P,C) = H(K,C) = H(K) + H(C)

H(K,P,C) = H(K,P) = H(K) + H(P)

H(K|C)= H(K,C)-H(C)

= H(K,P,C)-H(C)

= H(K)+H(P)-H(C)