cs 5950 computer security and information assurance spring 2007 section 3 (ch. 2, part 1):...

100
CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer Science Western Michigan University Slides based on Security in Computing. Third Edition by Pfleeger and Pfleeger. Using some slides courtesy of: Prof. Aaron Striegel — course taught at U. of Notre Dame Prof. Barbara Endicott-Popovsky & Prof. Deborah Frincke (U. Idaho) — taught at U. Washington Prof. Jussipekka Leiwo — taught at Vrije Universiteit (Free U.), Amsterdam, The Netherlands Slides not created by the above authors are © 2006-2007 by Leszek T. Lilien Requests to use original slides for non-profit purposes will be gladly

Post on 22-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

CS 5950Computer Security and Information Assurance

Spring 2007

Section 3 (Ch. 2, Part 1):

Introduction to Cryptology

Dr. Leszek LilienDepartment of Computer Science

Western Michigan UniversitySlides based on Security in Computing. Third Edition by Pfleeger and

Pfleeger.Using some slides courtesy of:

Prof. Aaron Striegel — course taught at U. of Notre DameProf. Barbara Endicott-Popovsky & Prof. Deborah Frincke (U. Idaho) —

taught at U. WashingtonProf. Jussipekka Leiwo — taught at Vrije Universiteit (Free U.),

Amsterdam, The NetherlandsSlides not created by the above authors are © 2006-2007 by Leszek T. Lilien

Requests to use original slides for non-profit purposes will be gladly granted upon a written request.

Page 2: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

2© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Introduction to Cryptology – Outline (1)

3A. Terminology and Background3A.1. Threats to Messages

3A.2. Basic Terminology and Notation3A.3. Requirements for Crypto

Protocols3A.4. Representing Characters

3B. Basic Types of Ciphers3B.1. Substitution Ciphers

a. The Ceasar Cipherb. Other Substitution Ciphersc. One-Time Pads

3B.2. Transposition Ciphers3B.3. Product Ciphers

Page 3: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

3© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Introduction to Cryptology – Outline (2)

3C. Making „Good” Ciphers3C.1. Criteria for „Good” Ciphers3C.2. Stream and Block Ciphers3C.3. Cryptanalysis3C.4. Symmetric and Asymm. Cryptosystems

3D. The DES (Data Encryption Standard) Algorithm

3D.1. Background and History of DES3D.2. Overview of DES3D.3. Double and Triple DES3D.4. Security of DES

Page 4: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

4© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

3E. The Clipper Story

3F. AES (Advanced Encryption Standard)3F.1. The AES Contest3F.2. Overview of Rijndael3F.3. Strength of AES3F.4. Comparison of DES and AES

... More in Section 5 (Ch. 2, Part 2) ...

Introduction to Cryptology – Outline (3)

Page 5: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

5© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

3A.Terminology and Background3A.1. Threats to Messages

Interception Interruption

Blocking msgs Modification Fabrication

“A threat is blocked by control of a vulnerability” [Pfleeger & Pfleeger]

[cf. B. Endicott-Popovsky, U. Washington]

Page 6: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

6© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

3A.2. Basic Terminology & Notation

Cryptology: cryptography + cryptanalysis

Cryptography: art/science of keeping message secure

Cryptanalys: art/science of breaking ciphertext

Enigma in WW2 Read the real story – not fabrications!

Page 7: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

7© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Basic Cryptographic Scheme

plaintext ciphertext

original plaintext

ENCRYPTION

ENCODING

ENCIPHERING

E

DECRYPTION

DECODING

DECIPHERING

D

P C P

P = <p1, p2, ..., pn> pi = i-th char of P

P = „DO NOT TELL ANYBODY” p1 = „D”, p2 = „O”, etc.

By convention, cleartext in uppercase C = <c1, c2, ..., cn> ci = i-th char of C

C = „ep opu ufmm bozcpez” c1 = „e”, c2 = „p”, etc.

By convention, ciphertext in lowercase

Page 8: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

8© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Benefits of Cryptography

Improvement not a Solution! Minimizes problems Doesn’t solve them

Remember: There is no solution!

Adds an envelope (encoding) to an open postcard (cleartext)

[cf. D. Frincke, U. of Idaho]

Page 9: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

9© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Formal Notation

C = E(P) E – encryption rule/algorithm

P = D(C) D – decryption rule/algorithm

We need a cryptosystem, where: P = D(C)= D(E(P))

i.e., able to get the original message back

plaintext ciphertextoriginal

plaintextENCRYPTION

ENCODING

ENCIPHERING

E

DECRYPTION

DECODING

DECIPHERING

D

P C P

Page 10: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

10© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Cryptography in Practice

plaintext

P

ciphertext

ENCRYPTION

ENCODING

ENCIPHERING

E

C

hostile environmen

t

ciphertext

original plaintext

DECRYPTION

DECODING

DECIPHERING

D

C P

hostile environmen

t

Sending a secure message

Receiving a secure message

Page 11: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

11© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Keyed Crypto System

C = E(KE, P) E = set of encryption algorithms / KE selects Ei E

P = D(KD, C) D = set of decryption algorithms / KD selects Dj D

Crypto algorithms and keys like door locks and keys (p.37)

We need: P = D(KD, E(KE, P))

E DP C P

EncryptionKey

Decryption Key

KE KD

Page 12: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

12© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Classification of Cryptosystems w.r.t. Keys

Keyless cryptosystems exist (e.g., Caesar’s cipher - below)

Less secure

Keyed cryptosystems Symmetric cryptosystems: KE = KD

Classic Encipher and decipher using the same key

Or one key is easily derived from other

Asymmetric cryptosystems: KE ≠ KD (previous slide)

A.k.a. a public key system Encipher and decipher using different keys

Computationally infeasible to derive one key from other

[cf. B. Endicott-Popovsky, U. Washington]

Page 13: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

13© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Cryptanalysis (1)

Cryptanalysts goals: Break a single msg Recognize patterns in encrypted msgs, to be able

to break the subsequent ones Infer meaning w/o breaking encryption

Unusual volume of msgs between enemy troops may indicate a coming attack

Busiest node may be enemy headquarters

Deduce the key, to facilitate breaking subsequent msgs

Find vulnerabilities in implementation or environment of an encryption algorithm

Find a general weakness in an encryption algorithm

Page 14: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

14© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Cryptanalysis (2)

Information used for cryptanalysts: Intercepted encrypted msgs Known encryption algorithms Intercepted plaintext Data known or suspected to be ciphertext Math or statistical tools and techniques Properties of natural languages

Esp. adversary’s natural language To confuse the Japanese cryptanalysts, Americans used

Navajo language in WW2 Propertiers of computer systems

Role of ingenuity / luck There are no rules!!!

Page 15: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

15© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Breakable Encryption (1)

Breakable encryption Theoretically, it is possible to devise

unbreakable cryptosystems Based on Shannon’s theory of information Practical cryptosystems almost always are

breakable, given adequate time and computing power

The trick is to make breaking a cryptosystem hard enough for the intruder

[cf. J. Leiwo, VU, NL]

Page 16: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

16© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Breakable Encryption (2)

Example: Breakability of an encryption algorithmMsg with just 25 characters 2625 possible decryptions ~ 1035 decryptions Only one is the right one Brute force approach to find the right one:

At 1010 (10 bln) decr./sec => 1035 / 1010 = 1025 sec = 10 bln yrs !

Infeasible with current technology

Be smarter – use ingenuity Could reduce 2625 to, say, 1015 decryptions to check

At 1010 decr./sec => 1015 / 1010 = 105 sec = ~ 1 day

Page 17: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

17© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

3A.3. Requirements for Crypto Protocols

Messages should get to destination Only the recipient should get it Only the recipient should see it Proof of the sender’s identity Message shouldn’t be corrupted in transit Message should be sent/received once

Proofs that message was sent/received (non-repudiation)

[cf. D. Frincke, U. of Idaho]

Page 18: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

18© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

3A.4. Representing Characters

Letters (uppercase only) represented by numbers 0-25 (modulo 26).

A B C D ... X Y Z

0 1 2 3 ... 23 24 25

Operations on letters:A + 2 = C

X + 4 = B (circular!)...

Page 19: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

19© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

3B. Basic Types of Ciphers

Substitution ciphers Letters of P replaced with other letters by

E

Transposition (permutation) ciphers Order of letters in P rearranged by E

Product ciphers E „=” E1 „+” E2 „+” ... „+” En

Combine two or more ciphers to enhance the security of the cryptosystem

Page 20: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

20© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

3B.1. Substitution Ciphers

Substitution ciphers: Letters of P replaced with other letters by

E

Outline:

a. The Caesar Cipher

b. Other Substitution Ciphers

c. One-Time Pads

Page 21: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

21© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

a. The Caesar Cipher (1)

ci=E(pi)=pi+3 mod 26 (26 letters in the English

alphabet)

Change each letter to the third letter following it (circularly)

A D, B E, ... X A, Y B, Z C

Can represent as a permutation : (i) = i+3 mod 26

(0)=3, (1)=4, ..., (23)=26 mod 26=0, (24)=1, (25)=2

Key = 3, or key = ‘D’ (bec. D represents 3)

Page 22: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

22© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

The Caesar Cipher (2)

Example [cf. B. Endicott-Popovsky]

P (plaintext): HELLO WORLD C (ciphertext): khoor zruog

Caesar Cipher is a monoalphabetic substitutioncipher (= simple substitution cipher)

Page 23: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

23© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Attacking a Substitution Cipher

Exhaustive search If the key space is small enough, try all possible

keys until you find the right one Cæsar cipher has 26 possible keys

from A to Z OR: from 0 to 25

Statistical analysis (attack) Compare to so called 1-gram (unigram) model

of English It shows frequency of (single) characters in

English

[cf. Barbara Endicott-Popovsky, U. Washington]

Page 24: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

24© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

1-grams (Unigrams) for English

a 0.080 h 0.060 n 0.070 t 0.090

b 0.015 i 0.065 o 0.080 u 0.030

c 0.030 j 0.005 p 0.020 v 0.010

d 0.040 k 0.005 q 0.002 w 0.015

e 0.130 l 0.035 r 0.065 x 0.005

f 0.020 m 0.030 s 0.060 y 0.020

g 0.015 z 0.002

[cf. Barbara Endicott-Popovsky, U. Washington]

Page 25: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

25© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Statistical Attack – Step 1

Compute frequency f(c) of each letter c in ciphertext

Example: c = ‘khoor zruog’ 10 characters: 3 * ‘o’, 2 * ‘r’, 1 * {k, h, z, u, g} f(c):

f(g)=0.1 f(h)=0.1 f(k)=0.1 f(o)=0.3 f(r)= 0.2f(u)=0.1 f(z)=0.1 f(ci) = 0 for any other ci

Apply 1-gram model of English Frequency of (single) characters in English 1-grams on previous slide

[cf. Barbara Endicott-Popovsky, U. Washington]

Page 26: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

26© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Statistical Attack – Step 2 (i) - correlation of frequency of letters in ciphertext

with frequency of corresponding letters in English —for key i

For key i: (i) = 0 ≤ c ≤ 25 f(c) * p(c – i) c representation of character (a-0, ..., z-25) f(c) is frequency of letter c in ciphertext C p(x) is frequency of character x in English Intuition: sum of probabilities for words in P, if i were the key

Example: C = ‘khoor zruog’ (P = ‘HELLO WORLD’)

f(c): f(g)=0.1, f(h)=0.1, f(k)=0.1, f(o)=0.3, f(r)=0.2, f(u)=0.1, f(z)=0.1c: g - 6, h - 7, k - 10, o - 14, r - 17, u - 20, z – 25

(i) = 0.1p(6 – i) + 0.1p(7 – i) + 0.1p(10 – i) +

+ 0.3p(14 – i) + 0.2p(17 – i) + 0.1p(20 – i) +

+ 0.1p(25 – i)

[cf. Barbara Endicott-Popovsky, U. Washington]

Page 27: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

27© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Statistical Attack – Step 2a (Calculations)

i (i) i (i) i (i) i (i)

0 0.0482 7 0.0442 13 0.0520 19 0.0315

1 0.0364 8 0.0202 14 0.0535 20 0.0302

2 0.0410 9 0.0267 15 0.0226 21 0.0517

3 0.0575 10 0.0635 16 0.0322 22 0.0380

4 0.0252 11 0.0262 17 0.0392 23 0.0370

5 0.0190 12 0.0325 18 0.0299 24 0.0316

6 0.0660 25 0.0430

[cf. Barbara Endicott-Popovsky, U. Washington]

Correlation (i) for 0≤ i ≤25

Page 28: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

28© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Statistical Attack – Step 3 (The Result) E.g., for i = 2:

(2) = 0.1 * p(6-2) + 0.1 * p(7-2) + ... == 0.1 * p(4) + 0.1 * p(5) + ... = 0.1 * 0.030 + 0.1 *

0.040 + ...

Most probable keys (largest (i) values):– i = 6, (i) = 0.0660

• plaintext EBIIL TLOLA

– i = 10, (i) = 0.0635• plaintext AXEEH PHKEW

– i = 3, (i) = 0.0575• plaintext HELLO WORLD

– i = 14, (i) = 0.0535• plaintext WTAAD LDGAS

Only English phrase is for i = 3– That’s the key (3 or ‘D’) – code broken

[cf. Barbara Endicott-Popovsky,

U. Washington]

4 = „C” & p(C) = 0.030 in the unigram table

Page 29: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

29© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Caesar’s Problem

Conclusion: Key is too short 1-char key – monoalphabetic substitution

Can be found by exhaustive search Statistical frequencies not concealed well by

short key They look too much like ‘regular’ English

letters

Solution: Make the key longer n-char key (n 2) – polyalphabetic substitution

Makes exhaustive search much more difficult Statistical frequencies concealed much better

Makes cryptanalysis harder[cf. Barbara Endicott-Popovsky, U. Washington]

Page 30: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

30© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

b. Other Substitution Ciphers

n-char key

Polyalphabetic substitution ciphers

Vigenere Tableaux cipher

Page 31: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

31© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Polyalphabetic Substitution - Examples

Flatten (difuse) somewhat the frequency distribution of letters by combining high and low distributions

Example – 2-key substitution: A B C D E F G H I J K L M

Key1: a d g j m p s v y b e h k

Key2: n s x c h m r w b g l q v

N O P Q R S T U V W X Y Z

Key1: n q t w z c f i l o r u x

Key2: a f k p u z e j o t y d i

[cf. J. Leiwo, VU, NL]

Question: How Key1 and Key2 were defined?

Page 32: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

32© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

... Example:

A B C D E F G H I J K L M

Key1: a d g j m p s v y b e h k

Key2: n s x c h m r w b g l q v

N O P Q R S T U V W X Y Z

Key1: n q t w z c f i l o r u x

Key2: a f k p u z e j o t y d i

[cf. J. Leiwo, VU, NL]

Answer:Key1 – start with ‘a’, skip 2, take next,

skip 2, take next letter, ... (circular)Key2 - start with ‘n’ (2nd half of alphabet), skip

4, take next, skip 4, take next, ... (circular)

Page 33: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

33© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Example: A B C D E F G H I J K L M

Key1: a d g j m p s v y b e h k

Key2: n s x c h m r w b g l q v

N O P Q R S T U V W X Y Z

Key1: n q t w z c f i l o r u x

Key2: a f k p u z e j o t y d i

Plaintext: TOUGH STUFF Ciphertext: ffirv zfjpm

use n (=2) keys in turn for consecutive P chars in P Note:

Different chars mapped into the same one: T, O f Same char mapped into different ones: F p, m ‘f’ most frequent in C (0.30); in English: f(f) = 0.02 << f(e) =

0.13

[cf. J. Leiwo, VU, NL]

Page 34: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

34© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Vigenere Tableaux (1)

P[cf. J. Leiwo, VU, NL]

Note: Row A – shift 0 (a->a)

Row B – shift 1 (a->b)

Row C – shift 2 (a->c)

...Row Z – shift 25 (a-

>z)

Page 35: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

35© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Vigenère Tableaux (2)

ExampleKey:EXODUS

Plaintext P:YELLOW SUBMARINE FROM YELLOW RIVER

Extended keyword (re-applied to mimic words in P):YELLOW SUBMARINE FROM YELLOW RIVEREXODUS EXODUSEXO DUSE XODUSE XODUS

Ciphertext:cbxoio wlppujmks ilgq vsofhb owyyj

Question: How derived from the keyword and the Vigenère tableaux?

[cf. J. Leiwo, VU, NL]

Page 36: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

36© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Vigenère Tableaux (3) Example

...Extended keyword (re-applied to mimic words in P):YELLOW SUBMARINE FROM YELLOW RIVEREXODUS EXODUSEXO DUSE XODUSE XODUS

Ciphertext:cbxoio wlppujmks ilgq vsofhb owyyj

Answer:c from P indexes rowc from extended key indexes column

e.g.: row Y and column e ‘c’row E and column x ‘b’row L and column o ‘z’...

[cf. J. Leiwo, VU, NL]

Page 37: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

37© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

c. One-Time Pads (1) OTP (One-Time Pad) – a variant of Vigenère

Tableaux Fixes problem with VT: key used might be too short

Above: ‘EXODUS’ – 6 chars Sometimes considered a perfect cipher

Used extensively during Cold War

One-Time Pad: Large, nonrepeating set of long keys on pad

sheets/pages Sender and receiver have identical pads

Example: 300-char msg to send, 20-char key per sheet

=> use & tear off 300/20 = 15 pages from the pad

Page 38: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

38© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

One-Time Pads (2)

Example – cont.: Encryption:

Sender writes letters of consecutive 20-char keys above the letters of P (from the pad 15 pages)

Sender enciphers P using Vigenère Tableaux (or other pre-arranged chart)

Sender destroys used keys/sheets

Decryption: Receiver uses Vigenère Tableaux Receiver uses the same set of consecutive 20-

char keys from the same 15 consecutive pages of the pad

Receiver destroys used keys/sheets

Page 39: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

39© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

One-Time Pads (3) Note:

Effect: a key as long as the message If only key length ≤ the number of chars in the pad

The key is always changing (and destroyed after use) Weaknesses

Perfect synchronization required between S and R Intercepted or dropped messages can destroy

synchro Need lots of keys Needs to distribute pads securely

No problem to generate keys Problem: printing, distribution, storing, accounting

Frequency distribution not flat enough Non-flat distribution facilitates breaking

Page 40: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

40© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Types of One-Time Pads

Vernam Cipher = (lttr + random nr) mod 26 (p.48) Need (pseudo) random nr generator E.g., V = 21; (V +76) mod 26 = 97 mod 26 = 19; 19

= t

Book Ciphers (p.49) Book used as a pad

need not destroy – just don’t reuse keys Use common Vigenère Tableaux Details: textbook

Incl. example of breaking a book cipher Bec. distribution not flat

Page 41: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

41© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Question:Does anybody know other ciphers using books?

Or invent your own cipher using books?

Page 42: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

42© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Question:...other ciphers using books?

My examples: Use any agreed upon book

P: SECRET

Example 2: Use: (page_nr, line_nr, word_nr)

C: 52 2 4

Computer can help find words in a big electronic book quickly!

Example 1: Use: (page_nr, line_nr, letter_in_line)

C: 52 2 1 52 1 1 52 1 16 ...

Better: use different pages for each char in P

52 ever, making predictions in ten letter

seven of those secret positi

gorithm

Page 52 from a book:

Page 43: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

43© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

3B.2. Transposition Ciphers (1)

Rearrange letters in plaintext to produce ciphertext

Example 1a and 1b: Columnar transposition Plaintext: HELLO WORLD Transposition onto: (a) 3 columns:

HELLOWORLDXX XX - padding

Ciphertext (read column-by column):(a) hlodeorxlwlx (b)

hloolelwrd

What is the key? Number of columns: (a) key = 3 and (b) key =

2

(b) onto 2 columns:

HELLOWORLD

Page 44: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

44© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Transposition Ciphers (2)

Example 2: Rail-Fence Cipher Plaintext: HELLO WORLD Transposition into 2 rows (rails) column-by-

column:HLOOL

ELWRD Ciphertext: hloolelwrd (Does it look

familiar?)

What is the key? Number of rails key = 2

[cf. Barbara Endicott-Popovsky, U. Washington]

Page 45: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

45© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Attacking Transposition Ciphers

Anagramming n-gram – n-char strings in English

Digrams (2-grams) for English alphabet are are: aa, ab, ac, ...az, ba, bb, bc, ..., zz (262 rows in digram table)

Trigrams are: aaa, aab, ... (263 rows)

4-grams (quadgrams?) are: aaaa, aaab, ... (264 rows)

Attack procedure: If 1-gram frequencies in C match their freq’s in

English but other n-gram freq’s in C do not match their freq’s in English, then it is probably a transposition encryption

Find n-grams with the highest frequencies in C Start with n=2

Rearrange substrings in C to form n-grams with highest freq’s

[cf. Barbara Endicott-Popovsky, U. Washington]

Page 46: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

46© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Example: Step 1Ciphertext C: hloolelwrd (from Rail-Fence

cipher) N-gram frequency check

1-gram frequencies in C do match their frequencies in English 2-gram (hl, lo, oo, ...) frequencies in C do not match

their frequencies in English Question: How frequency of „hl” in C is calculated?

3-gram (hlo, loo, ool, ...) frequencies in C do not match their frequencies in English

... => it is probably a transposition

Frequencies in English for all 2-grams from C starting with h he 0.0305 ho 0.0043 hl, hw, hr, hd < 0.0010

Implies that in hloolelwrd e follows h

[cf. Barbara Endicott-Popovsky, U. Washington]

as table of freq’s of English diagrams shows

Page 47: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

47© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Example: Step 2

Arrange so the h and e are adjacentSince 2-gram suggests a solution, cut C into 2

substrings – the 2nd substring starting with e: hlool elwrd

Put them in 2 columns:helloworld

Read row by row, to get original P: HELLO WORLD

[cf. Barbara Endicott-Popovsky, U. Washington]

Page 48: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

48© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2B.3. Product Ciphers

A.k.a. combination ciphers

Built of multiple blocks, each is: Substitution

or: Transposition

Example: two-block product cipher E2(E1(P, KE1), KE2)

Product cipher might not be stronger than its individual components used separately! Might not be even as strong as individual

components

Page 49: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

49© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2C. Making „Good” Ciphers

Cipher = encryption algorithm

Outline

2C.1. Criteria for „Good” Ciphers

2C.2. Stream and Block Ciphers

2C.3. Cryptanalysis

2C.4. Symmetric and Asymmetric Cryptosystems

Page 50: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

50© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2C.1. Criteria for „Good” Ciphers (1)

„Good” depends on intended application Substitution

C hides chars of P If > 1 key, C dissipates high frequency chars

Transposition C scrambles text => hides n-grams for n > 1

Product ciphers Can do all of the above

What is more important for your app?What facilities available to sender/receiver?

E.g., no supercomputer support on the battlefield

Page 51: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

51© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Criteria for „Good” Ciphers (2)

Claude Shannon’s criteria (1949):

1. Needed degree of secrecy should determine amount of labor

How long does the data need to stay secret?(cf. Principle of Adequate Protection)

2. Set of keys and enciphering algorithm should be free from complexity

Can choose any keys or any plaintext for given E E not too complex (cf. Principle of

Effectiveness)

3. Implementation should be as simple as possible Complexity => errors (cf. Principle of

Effectiveness)[cf. A. Striegel]

Page 52: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

52© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Criteria for „Good” Ciphers (3) Shannon’s criteria (1949) – cont.

4. Propagation of errors should be limited Errors happen => their effects should be limited

One error should not invlidate the whole C(None of the 4 Principles — Missing? — Invent a new Principle?)

5. Size / storage of C should be restricted Size (C) should not be > size (P) More text is more data for cryptanalysts to work

with Need more space for storage, more time to send

(cf. Principle of Effectiveness)

Proposed at the dawn of computer era – still valid! [cf. A. Striegel]

Page 53: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

53© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Criteria for „Good” Ciphers (4)

Characteristics of good encryption schemes Confusion:

interceptor cannot predict what will happen to C when she changes one char in P

E with good confusion:hides well relationship between

P”+”K, and C

Diffusion:changes in P spread out over many parts of C

Good diffusion => attacker needs access to much of C to infer E

Page 54: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

54© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Criteria for „Good” Ciphers (5)

Commercial Principles of Sound Encryption Systems1. Sound mathematics

Proven vs. not broken so far

2. Verified by expert analysis Including outside experts

3. Stood the test of time Long-term success is not a guarantee

Still. Flows in many E’s discovered soon after their release

Examples of popular commercial E’s: DES / RSA / AES [cf. A. Striegel]

DES = Data Encryption StandardRSA = Rivest-Shamir-AdelmanAES = Advanced Encryption Standard (rel. new)

Page 55: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

55© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2C.2. Stream and Block Ciphers (1)a. Stream ciphers

b. Problems with stream ciphers

c. Block ciphers

d. Pros / cons for stream and block ciphers

Page 56: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

56© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

a. Stream Ciphers (1) Stream cipher: 1 char from P 1 char for C

Example: polyalphabetic cipher P and K (repeated ‘EXODUS’):YELLOWSUBMARINEFROMYELLOWRIVEREXODUSEXODUSEXODUSEXODUSEXODUS

Encryption (char after char, using Vigenère Tableaux):(1) E(Y, E) c (2) E(E, X) b (3) E(L, O) z ...

C: cbzoiowlppujmksilgqvsofhbowyyj C as sent (in the right-to-left order):Sender

SReceiv

erR

jyywobhfosvqgliskmjupplwoiozbc

Page 57: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

57© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Stream Ciphers (2) Example: polyalphabetic cipher - cont.

C as received (in the right-to-left order):

C and K for decryption:cbzoiowlppujmksilgqvsofhbowyyjEXODUSEXODUSEXODUSEXODUSEXODUS

Decryption:(1) D(c, E) Y (2) D(b, X) E (3)D(z, O) L ...

Decrypted P:YEL...

Q: Do you know how D uses Vigenère Tableaux?

SenderS

ReceiverR

jyywobhfosvqgliskmjupplwoiozbc

Page 58: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

58© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

b. Problems with Stream Ciphers (1) Problems with stream ciphers Dropping a char from key K results in wrong decryption Example:

P and K (repeated ‘EXODUS’) with a char in K missing:YELLOWSUBMARINEFROMYELLOWRIVEREODUSEXODUSEXODUSEXODUSEXODUSE

Encryption (using VT):

1) E(Y,E) c2) E(E,O) s3) E(L,D) o ...

Ciphertext: cso...C in the order as sent (right-to-

left):...osc

missing X in K ! (no errors in repeated K later)

Page 59: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

59© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

C and correct K (‘EXODUS’) for decryption: cso...

EXO... Decryption (using VT, applying correct key):

1) D(c, E) Y2) D(s, X) V3) D(o, O) A ...

Decrypted P:YVA... - Wrong!

We know it’s wrong, Receiver might not know it yet!

C as received (in the right-to-left order):...osc

Problems with Stream Ciphers (2)

Page 60: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

60© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Problems with Stream Ciphers (3)

The problem might be recoverable Example:

If R had more characters decoded, R might be able to detect that S dropped a key char, and R could recover

E.g., suppose that R decoded: YELLOW SUBMAZGTR

R could guess, that the 2nd word should really be:SUBMARINE

=> R would know that S dropped a char from K after sending „SUBMA”

=> R could go back 4 chars, drop a char from K („recalibrate K with C”), and get „resynchronized” with S

Page 61: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

61© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

c. Block Ciphers (1)

We can do better than using recovery for stream ciphers Solution: use block ciphers

Block cipher:1 block of chars from P 1 block of chars for C Example of block cipher: columnar transposition Block size = „o(message length)” (informally)

Page 62: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

62© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Block Ciphers (2)

Why block size = „o(message length)” ? Because must wait for ”almost” the entire C before

can decode some characters near beginning of P E.g., for P = ‘HELLO WORLD’, block size is „o(10)” Suppose that Key = 3 (3 columns):

C as sent (in the right-to-left order):

HELLOWORLDXX

xlwlxroedolhSender

SReceiv

erR

Page 63: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

63© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Block Ciphers (3) C as received (in the right-to-left order): R knows: K = 3, block size = 12 (=> 4 rows)

=> R knows that characters wil be sent in the order: 1st-4th-7th-10th--2nd-5th-8th-11th--3rd-6th-9th-

12th R must wait for at least:

1 char of C to decode 1st char of P (‘h’) 5 chars of C to decode 2nd char of P (‘he’) 9 chars of C to decode 3rd, 4th, and 5th chars of P

(‘hello’) 10 chars of C to decode 6th, 7th, and 8th chars of P

(‘hello wor’) etc.

xlwlxroedolh

123456789abc

a=10b=11c=12

Page 64: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

64© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Block Ciphers (4) Informally, we might call ciphers like the above example

columnar transposition cipher „weak-block” ciphers R can get some (even most) but not all chars of P

before entire C is received R can get one char of P immediately

the 1st-after 1 of C (delay of 1 - 1 = 0) R can get some chars of P with „small” delay

e.g., 2nd-after 5 of C (delay of 5 - 2 = 3) R can get some chars of P with „large” delay

e.g., 3rd-after 9 of C (delay of 9 – 3 = 6)

There are block ciphers when R cannot even start decoding C before receiving the entire C

Informally, we might call them „strong-block” ciphers

Page 65: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

65© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

d. Pros / Cons for Stream and Block Ciphers (1)

Pros / cons for stream ciphers + Low delay for decoding individual symbols

Can decode ASA received + Low error propagation

Error in E(c1) does not affect E(c2)

- Low diffusion Each char separately encoded => carries

over its frequency info - Susceptibility to malicious insertion / modification

Adversary can fabricate a new msg from pieces of broken msgs, even if he doesn’t know E (just broke a few msgs)

Page 66: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

66© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Pros / cons for block ciphers + High diffusion

Frequency of a char from P diffused over (a few chars of) a block of C

+ Immune to insertion Impossible to insert a char into a block without

easy detection (block size would change) Impossible to modify a char in a block without

easy detection (if checksums are used)

Pros / Cons for Stream and Block Ciphers (2)

Page 67: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

67© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Pros / Cons for Stream and Block Ciphers (3)

Pros / cons for block ciphers — Part 2 - High delay for decoding individual chars

See example for ‘hello worldxx’ above For some E can’t decode even the 1st char before

whole k chars of a block are received

- High error propagation It affects the block, not just a single char

Page 68: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

68© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2C.3. Cryptanalysis (1)

What cryptanalysts do when confronted with unknown?Four possible situations w.r.t. available info:

1) C available2) Full P available3) Partial P available4) E available (or D available)

(1) – (4) suggest 5 different approaches

Page 69: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

69© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Cryptanalysis (2) Cryptanalyst approaches

1) Ciphertext-only attack We have shown examples for such attacks

E.g., for Caesar’s cipher, columnar transposition cipher

2) Known plaintext attack Analyst have C and P

Needs to deduce E such that C=E(P), then finds D

3) Probable plaintext attack Partial decryption provides partial match to C

This provides more clues

Page 70: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

70© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Cryptanalysis (3)

Cryptanalyst approaches – cont.4) Chosen plaintext attack

Analyst able to fabricate encrypted msgs Then observe effects of msgs on adversary’s actions

This provides further hints

5) Chosen ciphertext attack Analyst has both E and C Run E for many candidate plaintexts to find P

for which E(P) = C Purpose: to find KE

Page 71: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

71© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2C.4. Symmetric and Asymmetric Cryptosystems (1)

Symmetric encryption = secret key encryption KE = KD — called a secret key or a private key Only sender S and receiver R know the key

As long as the key remains secret, it also provides authentication (= proof of sender’s identity)

[cf. J. Leiwo]

Page 72: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

72© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Symmetric andAsymmetric Cryptosystems (2)

Problems with symmetric encryption: Ensuring security of the „key channel” Need an efficient key distribution infrastructure

A separate key needed for each communicating S-R pair For n communicating users, need:

n * (n -1) /2 keys

Page 73: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

73© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Symmetric andAsymmetric Cryptosystems

(3) Asymmetric encryption = public key

encryption (PKE) KE ≠ KD — public and private keys

PKE systems eliminate symmetric encr. problems Need no secure key distribution channel

=> easy key distribution

Page 74: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

74© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Symmetric andAsymmetric Cryptosystems (4)

One PKE approach: R keeps her private key KD

R can distribute the correspoding public key KE to anybody who wants to send encrypted msgs to her

No need for secure channel to send KE

Can even post the key on an open Web site — it is public!

Only private KD can decode msgs encoded with public KE!

Anybody (KE is public) can encode Only owner of KD can decode

Page 75: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

75© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Symmetric and Asymmetric Cryptosystems (5)

Symm. vs. Asymm. Key AlgorithmsSymmetric

Key: K (= KD = KE) K kept secret

K agreed upon between 2 parties in advance

Like using a „simple”safe (with one door) Need safe key to

deposit doc in safe Need safe key to

get doc from safe[Symmetric - cf. Barbara Endicott-Popovsky, U.Washington, Source: D. Frincke, U. of Idaho]

Asymmetric Key pair: < KE, KD >, KD ≠ KE

KD kept secretKE public (usually; or known to n users)

KE distributed to k users before first communication (by owner of KD)

Like using a safe with locked deposit slot Need deposit slot key to slide

doc into safe Need safe door key to get doc

from safe

Page 76: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

76© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Symmetric and Asymmetric Cryptosystems (6)

Need for Key Management

Private key must be carefully managed in both SE and PKE (asymm.) cryptosystems Storing / safeguarding / activating-deactivating

Keys can expire - e.g. to take a key

away from a fired employee

Public key must be carefully distributed in PKE systems=> Key management is a major issue[cf. A. Striegel]

Page 77: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

77© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2D. DES (Data Encryption Standard) Outline

2D.1. Background and History of DES

2D.2. Overview of DES

2D.3. Double and Triple DES

2D.4. Security of DES

Page 78: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

78© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2D.1. Background and History of DES (1) Early 1970’s - NBS (Nat’l Bureau of Standards)

recognized general public’s need for a secure crypto system

NBS – part of US gov’t / Now: NIST – Nat’l Inst. of Stand’s & Technology

„Encryption for the masses” [A. Striegel]

Existing US gov’t crypto systems were not meant to be made public

E.g. DoD, State Dept.

Problems with proliferation of commercial encryption devices

Incompatible Not extensively tested by independent body

Page 79: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

79© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Background and History of DES (2) 1972 - NBS calls for proposals for a public crypto system Criteria:

Highly secure / easy to understand / publishable /available to all / adaptable to diverse app’s / economical / efficient to use / able to be validated /exportable

In truth: Not too strong (for NSA, etc.)

1974 – IBM proposed its Lucifer DES based on it Tested by NSA (Nat’l Security Agency) and the general public

Nov. 1976 – DES adopted as US standard for sensitive but unclassified data / communication

Later adopted by ISO (Int’l Standards Organization) Official name: DEA - Data Encryption Algorithm / DEA-1 abroad

Page 80: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

80© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2D.2. Overview of DES (1)

DES - a block cipher a product cipher

16 rounds (iterations) on the input bits (of P) substitutions (for confusion) and

permutations (for diffusion)

Each round with a round key Generated from the user-supplied key

Easy to implement in S/W or H/W

Page 81: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

81© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Overview of DES (2)

Basic Structure Input: 64 bits (a block) Li/Ri– left/right half of the input

block for iteration i (32 bits) – subject to substitution S and permutation P (cf. Fig 2-8– text)

K - user-supplied key Ki - round key:

56 bits used +8 unused(unused for E but often used for error checking)

Output: 64 bits (a block) Note: Ri becomes L(i+1) All basic op’s are simple logical ops

Left shift / XOR

[Fig. – cf. J. Leiwo]

K1

K16

Input

Input PermutationL0 R0

S

P

K

R1L1

L16 R16

Final Permutation

Output

Page 82: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

82© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Overview of DES (3) -

Generation of Round Keys

key

PC-1

C0 D0

LSH LSH

D1

PC-2 K1

K16LSH LSH

C1

PC-2

key – user-supplied key (input)

PC-1, PC-2 – permutation tables PC-2 also extracts 48 of 56 bits

K1 – K16 – round keys (outputs) Length(Ki) = 48

Ci / Di – confusion / diffusion (?)

LSH –left shift (rotation) tables

[Fig: cf. Barbara Endicott-Popovsky, U. Washington]

Page 83: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

83© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Overview of DES (4) -

Problems with DES Diffie, Hellman 1977 prediction: “In a few years,

technology would allow DES to be broken in days.”

Key length is fixed (= 56) 256 keys ~ 1015 keys „Becoming” too short for faster computers

1997: 3,500 machines – 4 months 1998: special „DES cracker” h/w – 4 days

Design decisions not public Suspected of having backdoors

Speculation: To facilitate government access?

Page 84: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

84© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2D.3. Double and Triple DES (1)

Double DES: Use double DES encryption

C = E(k2, E(k1, P) )

Expected to multiply difficulty of breaking the encryption Not true!

In general, 2 encryptions are not better than one

[Merkle, Hellman, 1981]

Only doubles the attacker’s work

Page 85: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

85© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Double and Triple DES (2)

Triple DES: Is it C = E(k3, E(k2, E(k1, P) ) ?

Not soooo simple!

Page 86: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

86© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Triple DES: Tricks used:

D not E in the 2nd step, k1 used twice (in steps 1 & 3)

It is:C = E(k1, D(k2, E(k1, P) )

andP = D(k1, E(k2, D(k1, C) )

Doubles the effective key length 112-bit key is quite strong

Even for today’s computers For all feasible known attacks

Double and Triple DES (3)

Page 87: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

87© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2D.4. Security of DES

So, is DES insecure?

No, not yet 1997 attack required a lot of coperation The 1998 special-purpose machine is still

very expensive Triple DES still beyond the reach of these 2

attacks

But ... In 1995, NIST (formerly NBS) began search

for new strong encryption standard

Page 88: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

88© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2E. The Clipper Story (1) ... Or: How not to set up a standard

A scenario Only a single electronic copy of a corporation’s

crucial (and sensitive) document To prevent espionage, strong encryption used to

protect that document Only CEO knows the key CEO gets hit by a truck Is the document lost forever?

Key escrow (a depository) facilitates recovery of the document if the key is lost

[cf. J. Leiwo]

Page 89: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

89© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

The Clipper Story (2)

1993 - Clipper - U.S. Government’s attempt to mandate key escrow

Secret algorithm, invented by National Security Agency

Only authorities, can recover any communications Add an escrow key and split into halves Give each half to a different authority If there is a search warrant, authorities can

combine their halves and recover intercepted communication

Of course, government will use it for legitimate purposes only [cf. J. Leiwo]

Page 90: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

90© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

The Clipper Story (3) Clipper failed big time:

Classified algorithm, h/w (Clipper chip) implement’s only

Equipment designed AND keys provided by government

No export of equipment

Public relations disaster “Electronic civil liberties" organizations (incl. Electronic

Privacy Information Center & Electronic Frontier Foundation) challenged the Clipper chip proposal

Their claims: It would subject citizens to increased, possibly

illegal, government surveillance Strength of encryption could not be evaluated by

the public (bec. secret algorithm) – might be insecure

[above -cf. J. Leiwo]

Page 91: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

91© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2F. AES (Advanced Encryption Standard)

... Or: How to set up a standard

Outline2F.1. The AES Contest

2F.2. Overview of Rijndael

2F.3. Strength of AES

2F.4. Comparison of DES and AES

Page 92: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

92© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2F.1. The AES Contest (1)

1997 – NIST calls for proposals Criteria:

Unclassifed code Publicly disclosed Royalty-free worldwide Symmetric block cipher for 128-bit blocks Usable with keys of 128, 192, and 256 bits

1998 – 15 algorithms selected

(NIST = Nat’l Institute of Standards and Technology)

Page 93: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

93© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

The AES Contest (2) 1999 – 5 finalists [cf. J. Leiwo]

MARS by IBM RC6 by RSA Laboratories Rijndael by Joan Daemen and Vincent Rijmen Serpent by Ross Anderson, Eli Biham and Lars

Knudsen Twofish by Bruce Schneier, John Kelsey, Doug

Whiting, Dawid Wagner, Chris Hall and Niels Ferguson

Evaluation of finalists Public and private scrutiny Key evaluation areas:

security / cost or efficiency of operation /ease of software implementation

Page 94: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

94© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

The AES Contest (3) 2001- … and the winner is …

Rijndael (RINE-dahl) Authors: Vincent Rijmen + Joan Daemen

(Dutchmen)

Adopted by US gov’t as Federal Info Processing Standard 197 (FIPS

197)

Page 95: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

95© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2F.2. Overview of Rijndael/AES

Similar to DES – cyclic type of approach 128-bit blocks of P # of iterations based on key length

128-bit key => 9 “rounds” (called rounds, not cycles)

192-bit key => 11 rounds 256-bit key => 13 rounds

Basic ops for a round: Substitution – byte level (confusion) Shift row (transposition) – depends on key length

(diff.) Mix columns – LSH and XOR (confusion +diffusion) Add subkey – XOR used (confusion)

Page 96: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

96© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2F.3. Strengths of AES

Not much experience so far (since 2001)

But: Extensive cryptanalysis by US gov’t and

independent experts Dutch inventors have no ties to NSA or

other US gov’t bodies (less suspicion of trapdoor)

Solid math basis Despite seemingly simple steps within rounds

Page 97: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

97© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

2F.4. Comparison of DES & AES (1) DES AES

Date 1976 1999Block size [bits] 64 128Key length [bits] 56 (effect.) 128, 192, 256, or

moreEncryption substitution, substitution, shift, bitPrimitives permutation mixingCryptographic confusion, confusion,Primitives diffusion diffusionDesign open openDesign closed openRationaleSelection secret secret, but acceptedprocess public commentsSource IBM, enhan- independent Dutch

ced by NSA cryptographers

Page 98: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

98© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Comparison of DES & AES (2)

Weaknesses in AES? 20+ yrs of experience with DES eliminated fears

of its weakness (intentional or not) Might be naïve…

Experts pored over AES for 2-year review period

Page 99: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

99© 2006-2007 by Leszek T. LilienSection 3/1 – Computer Security and Information Assurance – Spring 2007

Comparison of DES & AES (3) Longevity of AES?

DES is 30 yrs old (1976) DES-encrypted message can be cracked in days

Longevity of AES more difficult to answer Can extend key length to > 256 bits (DES: 56)

2 * key length => 4 * number of keys Can extend number of rounds (DES: 16)

Extensible AES seems to be significantly better than DES, but..

Human ingenuity is unpredicatble!=> Need to incessantly search for better and better

encryption algorithms

Page 100: CS 5950 Computer Security and Information Assurance Spring 2007 Section 3 (Ch. 2, Part 1): Introduction to Cryptology Dr. Leszek Lilien Department of Computer

End of of Section 3 (Ch.2, Part 1): Introduction to Cryptology