information security and management 2. classical encryption techniques chih-hung wang fall 2011 1

51
Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Upload: toby-ramsey

Post on 13-Jan-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Information Security and Management

2. Classical Encryption Techniques

Chih-Hung WangFall 2011

1

Page 2: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Basic Concepts

•History▫ Kahn’s The Codebreakers (1963-)

From its initial and limited use by the Egyptians some 4000 years ago, to the twentieth century where it played a crucial role in the outcome of both world wars.

▫ U.S. Federal Information Processing Standard (DES; Data Encryption Standard). 1977.

2

Page 3: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

History▫ New Directions in Cryptography

1976 Diffie and Hellman Introduced the revolutionary concept of

public-key cryptography Provided a new and ingenious method for

key exchange▫ RSA Cryptosystem

1978 Rivest, Shamir and Adleman discovered the first practical public-key encryption and signature scheme.

3

Page 4: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

History▫ ElGamal

1985, another class of powerful and practical public-key scheme.

▫ First international standard for digital signature (ISO/IEC 9796) Based on the RSA public-key scheme

▫ U.S. Government: Digital Signature Standard (DSS) ElGamal like system

4

Page 5: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Taxonomy5

Page 6: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Symmetric Encryption

•Conventional / private-key / single-key•Sender and recipient share a common key•All classical encryption algorithms are

private-key•Was only type prior to invention of public-

key in 1970’s

6

Page 7: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Basic Terminology• Plaintext - the original message • Ciphertext - the coded message • Cipher - algorithm for transforming plaintext to ciphertext • Key - info used in cipher known only to sender/receiver • Encipher (encrypt) - converting plaintext to ciphertext • Decipher (decrypt) - recovering ciphertext from plaintext• Cryptography - study of encryption principles/methods• Cryptanalysis (codebreaking) - the study of principles/

methods of deciphering ciphertext without knowing key• Cryptology - the field of both cryptography and

cryptanalysis

7

Page 8: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Symmetric Encryption

•Simplified Model

8

Page 9: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Symmetric Encryption

•Model of conventional cryptosystem

9

Page 10: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Symmetric Encryption

•Expression▫ X: the plaintext▫ Y: the Ciphertext▫ K: the secret key▫ Encryption:

Y = EK(X) X = DK(Y)

10

Page 11: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Requirements• There are two requirements for secure use of

symmetric encryption:▫ We need a strong encryption algorithm▫ Sender and receiver must have obtained

copies of the secret key in a secure fashion and must keep the key secure

• It is important to note that the security of symmetric encryption depends on the secrecy of the key

11

Page 12: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Cryptography

•can characterize by:▫ type of encryption operations used

substitution / transposition / product▫ number of keys used

single-key or private / two-key or public▫ way in which plaintext is processed

block / stream

12

Page 13: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Cryptanalysis

•Ciphertext only▫ Ciphertext to be decoded

•Known plaintext▫ Ciphertext to be decoded▫ One or more plaintext-ciphertext pairs

formed with the secret key

13

Page 14: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Cryptanalysis• Chosen plaintext

▫ Ciphertext to be decoded▫ Plaintext message chosen by cryptanalyst, together

with its corresponding ciphertext generated with the secret key

• Chosen ciphertext▫ Ciphertext to be decoded▫ Purported ciphertext chosen by cryptanalyst,

together with its corresponding decrypted plaintext generated with the secret key

14

Page 15: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Unconditionally Secure▫ The ciphertext generated by the scheme

does not contain enough information to determine uniquely the corresponding plaintext, no mater how much ciphertext is available. One-time pad No practical encryption algorithm is

unconditionally secure

15

Page 16: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Computationally Secure• An encryption scheme is computationally

secure if the ciphertext generated by the scheme meets one or both of the following criteria:▫ The cost of breaking the cipher exceeds the value

of the encrypted information▫ The time required to break the cipher exceeds the

useful lifetime of the information

16

Page 17: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Security Concept▫ PGP company (1997)▫ $100,000 computer: Brute-force attack

17

Key length (bits) Breaking time40 2 seconds56 35 hours64 1 years70 700 centenaries

128 1016 (Thousand years)

Page 18: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Exhaustive Search18

Key Size (bits) Number of Alternative keys

Time required at 1 encryption/us

Time required at 106 encryptions/us

32 232=4.3x109 231us = 35.8 mins

2.15 milliseconds

56 256=7.2x1016 255us = 1142 years

10.01 hours

128 2128=3.4x1038 2127us = 5.4x1024 years

5.4x1018 years

26 characters

(permutation)

26! = 4x1026 2x1026us = 6.4x1012 years

6.4x106 years

Brute-force Attack

The attacker tries every possible key on a piece of ciphertext until an intelligible translation into plaintext is obtained. On average, half of all possible keys must be tried to achieve success

Page 19: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Classical Encryption

• Poem▫ 紀曉嵐:

精神炯炯 老貌堂堂烏巾白髯 龜鶴呈祥

• Riddle▫ 紀曉嵐:

鳳遊禾蔭鳥飛去 馬走蘆邊草不生

19

Page 20: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Classical Encryption

20

6

H28

Serial number of a can

Page 21: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Classical Encryption• Substitution Techniques

▫ Caesar Cipher Plaintext: meet me after the toga party Cipher :PHHW PH DIWHU WKH WRJD

SDUMB C=E(p) = (p+3) mod (26) C=E(p) = (p+ (or -) k) mod (26)

▫ Brute-force cryptanalysis The encryption and decryption algorithms are

known Try all 25 possible keys The language of the plaintext is known and

easily recognizable

21

Page 22: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Brute-force Attack of Caesar Cipher

22

Page 23: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Classical Encryption• Monoalphabetic Ciphers

▫ A dynamic increase in the key space can be achieved by allowing an arbitrary substitution. Plain : a b c d e f g Cipher: D C Q F A M Z

Possible keys = 26! > 4x1026 Time evaluation

Assume one can try 10000 keys per second Average time to find out the key

▫4x1026 / 4x107x104x2 =5x1014 years

23

Page 24: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Monoalphabetic Ciphers• Cryptanalysis

▫ The relative frequency of the letters can be determined and compared to a standard frequency distribution for English

▫ Ex: Ciphertext:

UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZVUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ

24

Page 25: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Monoalphabetic Ciphers

•Relative frequency table

25

P:13.13 H:5.83 F:3.33 B:1.67 C:0

Z:11.67 D:5.00 W:3.33 G:1.67 K:0

S:8.33 E:5.00 Q:2.50 Y:1.67 L:0

U:8.33 V:4.17 T:2.50 I:0.88 N:0

O:7.50 X:4.17 A:1.67 J:0.88 R:0

M:6.67        

Page 26: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Monoalphabetic Ciphers• Relative Frequency of Letters in English Text

26

Page 27: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Monoalphabetic Ciphers•Comparing results

27

E:12.75 L:3.75 W:1.50T:9.25 H:3.50 V:1.50R:8.50 C:3.50 B:1.25N:7.75 F:3.00 K:0.50I:7.75 U:3.00 X:0.50O:7.50 M:2.75 Q:0.50A:7.25 P:2.75 J:0.25S:6.00 Y:2.25 Z:0.25D:4.25 G:2.00  

Page 28: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Monoalphabetic Ciphers• It seems likely …

▫ P & Z are the equivalents of E & T▫ S,U,O, M and H are all of relatively high frequency

and probably corresponding to plain letters from the set {R,N,I,O,A,S}

▫ The letters with the lowest frequencies: A, B, G, I and J are likely included in the set {W, V, B, K, X, Q, J, Z}

▫ Powerful Tools: the frequency of two-letter combinations.

28

Page 29: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Playfair Cipher

•not even the large number of keys in a monoalphabetic cipher provides security

•one approach to improving security was to encrypt multiple letters

•the Playfair Cipher is an example • invented by Charles Wheatstone in 1854,

but named after his friend Baron Playfair

29

Page 30: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Playfair Key Matrix

• a 5X5 matrix of letters based on a keyword • fill in letters of keyword (sans duplicates) • fill rest of matrix with other letters• eg. using the keyword MONARCHY

M O N A R

C H Y B D

E F G I/J K

L P Q S T

U V W X Z

30

Page 31: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Encrypting and Decrypting• Plaintext encrypted two letters at a time:

1. if a pair is a repeated letter, insert a filler like 'X',eg. "balloon" encrypts as "ba lx lo

on" 2. if both letters fall in the same row, replace each

with letter to right (wrapping back to start from end), eg. “ar" encrypts as "RM"

3. if both letters fall in the same column, replace each with the letter below it (again wrapping to top from bottom), eg. “mu" encrypts to "CM"

4. otherwise each letter is replaced by the one in its row in the column of the other letter of the pair, eg. “hs" encrypts to "BP", and “ea" to "IM" or "JM" (as desired)

31

Page 32: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Security of the Playfair Cipher• Security much improved over

monoalphabetic since have 26 x 26 = 676 digrams

• would need a 676 entry frequency table to analyse (verses 26 for a monoalphabetic)

• and correspondingly more ciphertext • was widely used for many years (eg. US &

British military in WW1) • it can be broken, given a few hundred letters • since still has much of plaintext structure

32

Page 33: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Relative Frequency of Occurrence of Letters

33

Page 34: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Polyalphabetic Ciphers• Another approach to improving security is to

use multiple cipher alphabets called polyalphabetic substitution ciphers

• Makes cryptanalysis harder with more alphabets to guess and flatter frequency distribution

• Use a key to select which alphabet is used for each letter of the message

• Use each alphabet in turn • Repeat from start after end of key is reached

34

Page 35: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Vigenère Cipher•Simplest polyalphabetic substitution

cipher is the Vigenère Cipher •Effectively multiple caesar ciphers •Key is multiple letters long K = k1 k2 ...

kd • ith letter specifies ith alphabet to use •Use each alphabet in turn •Repeat from start after d letters in

message•Decryption simply works in reverse

35

Page 36: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Example• Write the plaintext out • Write the keyword repeated above it• Use each key letter as a caesar cipher key • Encrypt the corresponding plaintext letter• eg using keyword deceptive

key: deceptivedeceptivedeceptiveplaintext: wearediscoveredsaveyourselfciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ

36

Page 37: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Aids

•Simple aids can assist with en/decryption •a Saint-Cyr Slide is a simple manual aid

▫ a slide with repeated alphabet ▫ line up plaintext 'A' with key letter, eg 'C' ▫ then read off any mapping for key letter

•can bend round into a cipher disk •or expand into a Vigenère Tableau (see

text Table 2.3)

37

Page 38: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Vigenère Tableau

38

Page 39: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Security of Vigenère Ciphers

•have multiple ciphertext letters for each plaintext letter

•hence letter frequencies are obscured but not totally lost

•start with letter frequencies▫ see if look monoalphabetic or not

•if not, then need to determine number of alphabets, since then can attach each

39

Page 40: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Autokey Cipher• ideally want a key as long as the message• Vigenère proposed the autokey cipher • with keyword is prefixed to message as key• knowing keyword can recover the first few

letters • use these in turn on the rest of the message• but still have frequency characteristics to

attack • eg. given key deceptive

key: deceptivewearediscoveredsav plaintext: wearediscoveredsaveyourself ciphertext:ZICVTWQNGKZEIIGASXSTSLVVWLA

40

Page 41: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Gilbert Vernam (1918)

• Encryption

• Decryption

iii kpc

iii kcp

41

pi : ith binary digit of plaintextki : ith binary digit of keyci : ith binary digit of ciphertext: exclusive-or (XOR)

Page 42: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

One-Time Pad

•if a truly random key as long as the message, with no repetitions is used, the cipher will be secure called a One-Time pad

•is unbreakable since ciphertext bears no statistical relationship to the plaintext

•since for any plaintext & any ciphertext there exists a key mapping one to other

•can only use the key once though•have problem of safe distribution of key

42

Page 43: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Example of One-time Pad

43

Page 44: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Two Fundamental Difficulties

44

1. Making large quantities of random keys2. Key distribution problem

Limited utility: is useful primarily for low-bandwidth channels

Page 45: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Transposition Ciphers

•now consider classical transposition or permutation ciphers

•these hide the message by rearranging the letter order

•without altering the actual letters used•can recognise these since have the same

frequency distribution as the original text

45

Page 46: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Transposition Ciphers

•Transposition Techniques

•Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ

46

Key 4 3 1 2 5 6 7plain a t t a c k p  o s t p o n e  d u n t i l t  w o a m x y z

Page 47: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Rotor Machines• Before modern ciphers, rotor machines were

most common product cipher• were widely used in WW2

▫ German Enigma, Allied Hagelin, Japanese Purple• Implemented a very complex, varying

substitution cipher• Used a series of cylinders, each giving one

substitution, which rotated and changed after each letter was encrypted

• with 3 cylinders have 263=17576 alphabets

47

Page 48: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Three-rotor Machine48

Page 49: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Steganography

•An alternative to encryption•Hides existence of message

▫ using only a subset of letters/words in a longer message marked in some way

▫ using invisible ink▫ hiding in LSB in graphic image or sound

file•Has drawbacks

▫ high overhead to hide relatively few info bits

49

Page 50: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Relative Techniques

•Character marking•Invisible ink•Pin punctures•Typewriter correction ribbon

50

Page 51: Information Security and Management 2. Classical Encryption Techniques Chih-Hung Wang Fall 2011 1

Example of Steganography51