20
Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Embed Size (px)

Citation preview

Page 1: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Cryptograpy

By Roya Furmuly

W

C

I

H

DF

O

P

S

1

2

39

L 7

Page 2: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

What Is It?

Enables two people (Alice and Bob) to communicate over an insecure channel in such a way so that an opponent (Oscar) cannot

understand what is being said.

Page 3: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

How Does It Work?

Alice encrypts the information (Plaintext), using a predetermined key, then sends the result (Ciphertext) to Bob.

Oscar cannot determine the plaintext because he doesn’t know the key.

Bob, who knows the encryption key, decrypts the ciphertext and reconstructs the plaintext.

Page 4: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Formal Definition

A Cryptosystem is a five-tuple (P,C,K,E,D )P = finite set of plaintexts

C = finite set of ciphertexts

K = finite set of keys (keyspace)

For each K K eK E and a corresponding dK

D. Each eK:P C and dK:C P are functions

such that dK(eK(x))=x x P.

Page 5: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Observations

The encryption function eK must be injective to avoid ambiguity.

i.e. if y= eK(x1)= eK(x2) where x1 not equal x2

Bob doesn’t know whether y= x1 or y= x2

If P = C , then the encryption function is a permutation.

Page 6: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Protocol

Choose random key K in K (when Oscar not present

or through a secure channel). Alice

Message: x=x1x2...xn where i in (1,n), xi in P

encrypts each xi using encryption rule yi= eK(xi) y=y1y2…yn

Bob uses decryption function dK(yi)=xi

x=x1x2...xn

Page 7: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Diagram

Alice encrypter decrypter

Oscar

key source

Bob

Oscar

x y

K

x

Page 8: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

What makes a Cryptosystem practical?

1. Encryption and Decryption functions should be efficiently computable.

2. Upon seeing ciphertext y, the opponent should be unable to determine the key K used (“security”).

Page 9: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Shift Cipher

Let P =C =K = Z26.

eK(x)=x+K mod 26

and

dK(y)=y-K mod 26 (x,y in Z26)

cool fact: for K=3, cryptosystem is called the Caesar Cipher.

Page 10: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Shift Cipher (cont’d)

We encrypt English text, by the following correspondence:

A 0, B 1, …, Z 25,

A B C D E F G H I J K L M N O P Q R S T U V W

0 1 2 3 4 5 6 7 8 9 101112 13 14 15161718192021 22

X Y Z 23 24 25

Page 11: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Let’s Encrypt!

Let the key be K=7, encrypt: UCLA BRUINS

convert letters to integers using chart:

20 2 11 0 1 17 20 8 13 18

add 7 to each value, reduce mod 26:

1 9 18 7 8 24 1 15 20 25

convert to sequence of integers:

BJSHIYBPUZ

Page 12: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Let’s Decrypt!

BJSHIYBPUZ

convert letters to integers:

1 9 18 7 8 24 1 15 20 25

subtract 7, reduce mod 26:

20 2 11 0 1 17 20 8 13 18

convert to letters:

UCLA BRUINS

Page 13: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Shift Cipher, any Good?

Nope! Fails security property. Keyspace is very small, only 25 possible

keys. Can easily be deciphered by an exhaustive

key search. Try K=1…25, until get a text that makes

sense.

Page 14: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Vigenere Cipher

Let m>0 be fixed. Let P =C =K = (Z26)m

For a key K=(k1,k2,…km) define

eK(x1,x2,…,xm)=(x1+k1, x2+k2,…,xm+km)

and

dK(y1,y2,…,ym)=(y1-k1, y2-k2,…,ym-km)

*all operations done in Z26

Page 15: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Let’s Encrypt!Let key=hot=(7,14,19), encrypt: SUMMER IS

HERE

convert to integers & “add” the keyword mod 26: 18 20 12 12 4 17 8 18 7 4 18 4

7 14 19 7 14 19 7 14 19 7 14 19

----------------------------------------------------

25 8 5 19 18 10 15 6 0 11 6 23

ZIFTSKPGALGX

Page 16: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Let’s Decrypt!

ZIFTSKPGALGX

convert to integers and “subtract” the keyword hot=(7,14,19) mod 26:

25 8 5 19 18 10 15 6 0 11 6 23

7 14 19 7 14 19 7 14 19 7 14 19

--------------------------------------------------------

18 20 12 12 4 17 8 18 7 4 18 4

SUMMER IS HERE

Page 17: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Vigenere Cipher, any Good?

Better than Shift Cipher Possible number of keys of length m is

(26)m Say m=5, then keyspace size is

(26)5 approx 1.1x107

So, exhaustive key search not feasible by hand (but OK by computer).

Page 18: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Other Cryptosystems

Data Encryption Standard (DES)

Based on permutaion of 64 bits at a time.

RSA

Based on difficulty of factoring large integers into primes.

Enigma

Machine with rotors that shifted letters in complicated manner.

Page 19: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

Summary

Cryptography allows us to communicate through insecure channels.

Shift Cipher…insecure (small keyspace) Vigenere Cipher…less insecure Complicated Cryptosystems

DES, RSA, ENIGMA

Page 20: Cryptograpy By Roya Furmuly W C I H D F O P S 1 2 3 9 L 7

WKH HQG