Cryptography and Cryptography and Network Security Network - - PowerPoint PPT Presentation

cryptography and cryptography and network security
SMART_READER_LITE
LIVE PREVIEW

Cryptography and Cryptography and Network Security Network - - PowerPoint PPT Presentation

Cryptography and Cryptography and Network Security Network Security Chapter Chapter 2 2 Fourth Edition Fourth Edition by William Stallings by William Stallings Lecture slides by Lawrie Brown Lecture slides by Lawrie Brown Symmetric


slide-1
SLIDE 1

Cryptography and Cryptography and Network Security Network Security Chapter Chapter 2 2

Fourth Edition Fourth Edition by William Stallings by William Stallings Lecture slides by Lawrie Brown Lecture slides by Lawrie Brown

slide-2
SLIDE 2

Symmetric Encryption Symmetric Encryption

  • r conventional /
  • r conventional / private

private-key key / single single-key key

  • sender and recipient share a common key

sender and recipient share a common key

  • all classical encryption algorithms are

all classical encryption algorithms are private private-key key

  • was only type prior to invention of public

was only type prior to invention of public- key in key in 1970 1970’s ’s

  • and by far most widely used

and by far most widely used

slide-3
SLIDE 3

Some Basic Terminology Some Basic Terminology

  • plaintext

plaintext - original message

  • riginal message
  • ciphertext

ciphertext - coded message coded message

  • cipher

cipher - algorithm algorithm for transforming plaintext to for transforming plaintext to ciphertext ciphertext

  • key

key - info used in cipher, known only to sender/receiver info used in cipher, known only to sender/receiver

  • encipher (encrypt)

encipher (encrypt) - converting plaintext to converting plaintext to ciphertext ciphertext

  • decipher (decrypt)

decipher (decrypt) - recovering recovering ciphertext ciphertext from plaintext from plaintext

  • cryptography

cryptography - study of encryption principles/methods study of encryption principles/methods

  • cryptanalysis (

cryptanalysis (codebreaking codebreaking) - study of principles/ study of principles/ methods of deciphering methods of deciphering ciphertext ciphertext without without knowing key knowing key

  • cryptology

cryptology - field of both cryptography and cryptanalysis field of both cryptography and cryptanalysis

slide-4
SLIDE 4

Symmetric Cipher Model Symmetric Cipher Model

slide-5
SLIDE 5

Requirements Requirements

  • two requirements for secure use of

two requirements for secure use of symmetric encryption: symmetric encryption:

  • a

a strong encryption strong encryption algorithm algorithm

  • a

a secret key secret key known only to sender / receiver known only to sender / receiver

  • mathematically have:

mathematically have:

Y Y = E = EK(X) X X = D = DK(Y)

  • assume encryption

assume encryption algorithm is known algorithm is known

  • implies a

implies a secure channel secure channel to distribute key to distribute key

slide-6
SLIDE 6

Cryptography Cryptography

  • characterize cryptographic system by:

characterize cryptographic system by:

  • type of encryption

type of encryption operations

  • perations used

used

  • substitution /

substitution / transposition / product transposition / product

  • number of keys used

number of keys used

  • single

single-key or private / two key or private / two-key or public key or public

  • way in which plaintext is processed

way in which plaintext is processed

  • block / stream

block / stream

slide-7
SLIDE 7

Cryptanalysis Cryptanalysis

  • bjective to
  • bjective to recover key

recover key not not just message just message

  • general approaches:

general approaches:

  • cryptanalytic attack

cryptanalytic attack

  • brute

brute-force attack force attack

slide-8
SLIDE 8

Model of Symmetric Model of Symmetric Cryptosystem Cryptosystem

slide-9
SLIDE 9

Cryptanalytic Attacks Cryptanalytic Attacks

  • ciphertext

ciphertext only

  • nly
  • nly know algorithm &
  • nly know algorithm & ciphertext

ciphertext, , is statistical, is statistical, know or can identify plaintext know or can identify plaintext

  • known plaintext

known plaintext

  • know/suspect plaintext &

know/suspect plaintext & ciphertext ciphertext

  • chosen plaintext

chosen plaintext

  • select plaintext and obtain

select plaintext and obtain ciphertext ciphertext

  • chosen

chosen ciphertext ciphertext

  • select

select ciphertext ciphertext and obtain plaintext and obtain plaintext

  • chosen text

chosen text

  • select plaintext or

select plaintext or ciphertext ciphertext to en/decrypt to en/decrypt

slide-10
SLIDE 10

More Definitions More Definitions

  • unconditional security

unconditional security

  • no matter

no matter how much how much computer power computer power or

  • r time

time is available, the cipher is available, the cipher cannot cannot be broken be broken since the since the ciphertext ciphertext provides provides insufficient insufficient information to uniquely determine the information to uniquely determine the corresponding plaintext corresponding plaintext

  • computational security

computational security

  • given limited

given limited computing resources computing resources (eg eg time time needed for calculations is greater than age of needed for calculations is greater than age of universe), the cipher cannot be broken universe), the cipher cannot be broken

slide-11
SLIDE 11

Brute Force Search Brute Force Search

  • always possible to simply try every key

always possible to simply try every key

  • most basic attack, proportional to key size

most basic attack, proportional to key size

  • assume either know / recognise plaintext

assume either know / recognise plaintext

Key Size (bits) Number of Alternative Keys Time required at 1 decryption/µs Time required at 106 decryptions/µs 32 232 = 4.3 × 109 231 µs = 35.8 minutes 2.15 milliseconds 56 256 = 7.2 × 1016 255 µs = 1142 years 10.01 hours 128 2128 = 3.4 × 1038 2127 µs = 5.4 × 1024 years 5.4 × 1018 years 168 2168 = 3.7 × 1050 2167 µs = 5.9 × 1036 years 5.9 × 1030 years 26 characters (permutation) 26! = 4 × 1026 2 × 1026 µs = 6.4 × 1012 years 6.4 × 106 years

slide-12
SLIDE 12

Classical Substitution Classical Substitution Ciphers Ciphers

  • where

where letters of plaintext are replaced by letters of plaintext are replaced by

  • ther letters or by numbers or symbols
  • ther letters or by numbers or symbols
  • r if plaintext is
  • r if plaintext is viewed as a sequence of

viewed as a sequence of bits, then substitution involves replacing bits, then substitution involves replacing plaintext bit patterns with ciphertext bit plaintext bit patterns with ciphertext bit patterns patterns

slide-13
SLIDE 13

Caesar Cipher Caesar Cipher

  • earliest known substitution cipher

earliest known substitution cipher

  • by Julius Caesar

by Julius Caesar

  • first attested use in military affairs

first attested use in military affairs

  • replaces each letter by

replaces each letter by 3 3rd letter on rd letter on

  • example:

example:

meet me after the toga party meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB PHHW PH DIWHU WKH WRJD SDUWB

slide-14
SLIDE 14

Caesar Cipher Caesar Cipher

  • can define transformation as:

can define transformation as:

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 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 A B C

  • mathematically give each letter a number

mathematically give each letter a number

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 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

  • then have Caesar cipher as:

then have Caesar cipher as:

c c = E( = E(p) = ( ) = (p p + + k) ) mod ( mod (26 26) p p = = D(c) D(c) = (c = (c – k) mod ( ) mod (26 26)

slide-15
SLIDE 15

Cryptanalysis of Caesar Cryptanalysis of Caesar Cipher Cipher

  • nly have
  • nly have 26

26 possible ciphers possible ciphers

  • A maps to A,B,..Z

A maps to A,B,..Z

  • could simply try each in turn

could simply try each in turn

  • a

a brute force search brute force search

  • given ciphertext,

given ciphertext, just try all shifts of letters just try all shifts of letters

  • do need to recognize when have plaintext

do need to recognize when have plaintext

  • eg. break ciphertext "GCUA VQ DTGCM"
  • eg. break ciphertext "GCUA VQ DTGCM"
slide-16
SLIDE 16

Monoalphabetic Cipher Monoalphabetic Cipher

  • rather than just shifting the alphabet

rather than just shifting the alphabet

  • could shuffle (jumble) the letters arbitrarily

could shuffle (jumble) the letters arbitrarily

  • each plaintext letter maps to a different random

each plaintext letter maps to a different random ciphertext letter ciphertext letter

  • hence key is

hence key is 26 26 letters long letters long

Plain: abcdefghijklmnopqrstuvwxyz Plain: abcdefghijklmnopqrstuvwxyz Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN Plaintext: ifwewishtoreplaceletters Plaintext: ifwewishtoreplaceletters Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA

slide-17
SLIDE 17

Monoalphabetic Cipher Monoalphabetic Cipher Security Security

  • now have a total of

now have a total of 26 26! = ! = 4 4 x x 1026 1026 keys keys

  • with so many keys, might think is secure

with so many keys, might think is secure

  • but would be

but would be !!!WRONG!!! !!!WRONG!!!

  • problem is language characteristics

problem is language characteristics

slide-18
SLIDE 18

Language Redundancy and Language Redundancy and Cryptanalysis Cryptanalysis

  • human languages are

human languages are redundant redundant

  • eg

eg "th th lrd lrd s m s m shphrd shphrd shll shll nt nt wnt wnt" "

  • letters are not equally commonly used

letters are not equally commonly used

  • in English E is by far the most common letter

in English E is by far the most common letter

  • followed by T,R,N,I,O,A,S

followed by T,R,N,I,O,A,S

  • ther letters like Z,J,K,Q,X are fairly rare
  • ther letters like Z,J,K,Q,X are fairly rare
  • have tables of single, double & triple letter

have tables of single, double & triple letter frequencies for various languages frequencies for various languages

slide-19
SLIDE 19

English Letter Frequencies English Letter Frequencies

slide-20
SLIDE 20

Use in Cryptanalysis Use in Cryptanalysis

  • key concept

key concept - monoalphabetic monoalphabetic substitution substitution ciphers do not change relative letter frequencies ciphers do not change relative letter frequencies

  • discovered by Arabian scientists in

discovered by Arabian scientists in 9th

th century

century

  • calculate letter frequencies for

calculate letter frequencies for ciphertext ciphertext

  • for

for monoalphabetic monoalphabetic must identify each letter must identify each letter

  • tables of common double/triple letters help

tables of common double/triple letters help

slide-21
SLIDE 21

Example Cryptanalysis Example Cryptanalysis

  • given ciphertext:

given ciphertext:

UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ

  • count relative letter frequencies (see text)

count relative letter frequencies (see text)

  • guess P & Z are e and t

guess P & Z are e and t

  • guess ZW is th and hence ZWP is the

guess ZW is th and hence ZWP is the

  • proceeding with trial and error finally get:

proceeding with trial and error finally get:

it was disclosed yesterday that several informal but it was disclosed yesterday that several informal but direct contacts have been made with political direct contacts have been made with political representatives of the viet cong in moscow representatives of the viet cong in moscow

slide-22
SLIDE 22

Playfair Cipher Playfair Cipher

  • not even

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

  • ne approach to improving security was to
  • ne approach to improving security was to

encrypt multiple letters encrypt multiple letters

  • the

the Playfair Playfair Cipher Cipher is an example is an example

  • invented by Charles Wheatstone in

invented by Charles Wheatstone in 1854 1854, , but named after his friend but named after his friend Baron Baron Playfair Playfair

slide-23
SLIDE 23

Playfair Key Matrix Playfair Key Matrix

  • a

a 5 5X X5 5 matrix of letters based on a keyword matrix of letters based on a keyword

  • fill in letters of keyword (sans duplicates)

fill in letters of keyword (sans duplicates)

  • fill rest of matrix with other letters

fill rest of matrix with other letters

  • eg. using the keyword MONARCHY
  • eg. using the keyword MONARCHY

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

slide-24
SLIDE 24

Encrypting and Decrypting Encrypting and Decrypting

  • plaintext is encrypted two letters at a time

plaintext is encrypted two letters at a time

1. 1.

if a pair is a repeated letter, insert filler like 'X’ if a pair is a repeated letter, insert filler like 'X’

2. 2.

if both letters fall in the same row, replace if both letters fall in the same row, replace each with letter to right each with letter to right (wrapping back to start wrapping back to start from end) from end)

3. 3.

if both letters fall in the same column, replace if both letters fall in the same column, replace each with the letter below it (again wrapping to each with the letter below it (again wrapping to top from bottom) top from bottom)

4. 4.

  • therwise each letter is replaced by the letter
  • therwise each letter is replaced by the letter

in the same row and in the column of the other in the same row and in the column of the other letter of the pair letter of the pair

slide-25
SLIDE 25
slide-26
SLIDE 26
slide-27
SLIDE 27

Example Example

  • “I see you there”

I see you there”

  • IF odd Add Q

IF odd Add Q

slide-28
SLIDE 28

Answer Answer

  • is

is ee ee yo yo ut ut he re he re

  • is ex

is ex ey ey ou

  • u th

th er er eq eq

  • CA OS GH ZQ BQ BS OH

CA OS GH ZQ BQ BS OH

slide-29
SLIDE 29

Security of Security of Playfair Playfair Cipher Cipher

  • security much improved over

security much improved over monoalphabetic monoalphabetic

  • and correspondingly more

and correspondingly more ciphertext ciphertext

  • was widely used for many years

was widely used for many years

  • eg

eg. . by US & British military in WW by US & British military in WW1

  • it

it can can be broken, given a few hundred letters be broken, given a few hundred letters

  • since still has much of plaintext structure

since still has much of plaintext structure

slide-30
SLIDE 30

Polyalphabetic Ciphers Polyalphabetic Ciphers

  • polyalphabetic

polyalphabetic substitution ciphers substitution ciphers

  • improve security using

improve security using multiple cipher alphabets multiple cipher alphabets

  • make

make cryptanalysis harder cryptanalysis harder with more alphabets with more alphabets to guess and flatter to guess and flatter frequency distribution frequency distribution

  • use a key to select which alphabet is used for

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

  • use each alphabet in turn

use each alphabet in turn

  • repeat from start after end of key is reached

repeat from start after end of key is reached

slide-31
SLIDE 31

Vigenère Cipher Vigenère Cipher

  • simplest

simplest polyalphabetic polyalphabetic substitution cipher substitution cipher

  • effectively multiple

effectively multiple caesar caesar ciphers ciphers

  • key is

key is multiple letters multiple letters long K = k long K = k1 k2 ... ... kd

  • ith

th letter specifies

letter specifies ith

th alphabet to use

alphabet to use

  • repeat from start after d letters in message

repeat from start after d letters in message

  • decryption simply works in reverse

decryption simply works in reverse

slide-32
SLIDE 32

The Modern The Modern Vigenère Vigenère Table Table

slide-33
SLIDE 33

Example of Example of Vigenère Cipher Vigenère Cipher

  • write the plaintext out

write the plaintext out

  • write the keyword repeated above it

write the keyword repeated above it

  • use each key letter as a

use each key letter as a caesar caesar cipher key cipher key

  • encrypt the corresponding plaintext letter

encrypt the corresponding plaintext letter

  • eg

eg using keyword using keyword deceptive deceptive

key: key: deceptivedeceptivedeceptive deceptivedeceptivedeceptive plaintext: plaintext: wearediscoveredsaveyourself wearediscoveredsaveyourself ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ

slide-34
SLIDE 34

Security of Security of Vigenère Ciphers Vigenère Ciphers

  • have multiple

have multiple ciphertext ciphertext letters for each letters for each plaintext letter plaintext letter

  • hence letter

hence letter frequencies frequencies are obscured are obscured

  • but not totally lost

but not totally lost

  • start with

start with a letter frequencies a letter frequencies

  • see if look

see if look monoalphabetic monoalphabetic

  • if not,

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

slide-35
SLIDE 35

Kasiski Method Kasiski Method

  • method developed by

method developed by Babbage / Babbage / Kasiski Kasiski

  • repetitions

repetitions in in ciphertext ciphertext give clues to period give clues to period

  • so find

so find same plaintext same plaintext an exact an exact period apart period apart

  • which results in the same

which results in the same ciphertext ciphertext

  • f course,
  • f course, could also be random fluke

could also be random fluke

  • eg

eg repeated “VTW” in previous example repeated “VTW” in previous example

  • suggests size of

suggests size of 3 3 or

  • r 9
  • then attack each

then attack each monoalphabetic monoalphabetic cipher cipher individually using same techniques as before individually using same techniques as before

slide-36
SLIDE 36

Autokey Cipher Autokey Cipher

  • ideally want a key as

ideally want a key as long as the message long as the message

  • Vigenère

Vigenère proposed the proposed the autokey autokey cipher cipher

  • with keyword is

with keyword is prefixed prefixed to message as key to message as key

  • knowing keyword can recover the first few letters

knowing keyword can recover the first few letters

  • use these in turn on the rest of the message

use these in turn on the rest of the message

  • eg

eg. . given key given key deceptive deceptive

key: key: deceptivewearediscoveredsav deceptivewearediscoveredsav plaintext: plaintext: wearediscoveredsaveyourself wearediscoveredsaveyourself ciphertext:ZICVTWQNGKZEIIGASXSTSLVVWLA ciphertext:ZICVTWQNGKZEIIGASXSTSLVVWLA

slide-37
SLIDE 37

One One-Time Pad Time Pad

  • if a

if a random key random key as long as the message is used, as long as the message is used, the cipher will be secure the cipher will be secure

  • called a One

called a One-Time pad Time pad

  • is

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

  • since for

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

  • can

can only use

  • nly use the key

the key once

  • nce though

though

  • problems in

problems in generation generation & safe & safe distribution of key distribution of key

slide-38
SLIDE 38

Transposition Ciphers Transposition Ciphers

  • now consider classical

now consider classical transposition transposition or

  • r

permutation permutation ciphers ciphers

  • these hide the message by rearranging

these hide the message by rearranging the letter order the letter order

  • without

without altering altering the the actual letters actual letters used used

  • can recognise these since have the

can recognise these since have the same same frequency distribution frequency distribution as the original text as the original text

slide-39
SLIDE 39

Rail Fence cipher Rail Fence cipher

  • write message letters out diagonally over a

write message letters out diagonally over a number of rows number of rows

  • then read off cipher row by row

then read off cipher row by row

  • eg. write message out as:
  • eg. write message out as:

m e m a t r h t g p r y m e m a t r h t g p r y e t e f e t e o a a t e t e f e t e o a a t

  • giving ciphertext

giving ciphertext

MEMATRHTGPRYETEFETEOAAT MEMATRHTGPRYETEFETEOAAT

slide-40
SLIDE 40

Row Transposition Ciphers Row Transposition Ciphers

  • a more complex transposition

a more complex transposition

  • write letters of message out in rows over a

write letters of message out in rows over a specified number of columns specified number of columns

  • then reorder the columns according to

then reorder the columns according to some key before reading off the rows some key before reading off the rows

Key: Key: 4 3 1 2 5 6 7

4 3 1 2 5 6 7

Plaintext: Plaintext:

  • Ciphertext

Ciphertext: : TTNAAPTMTSUOAODWCOIXKNLYPETZ TTNAAPTMTSUOAODWCOIXKNLYPETZ

slide-41
SLIDE 41

Product Ciphers Product Ciphers

  • ciphers using

ciphers using substitutions or transpositions substitutions or transpositions are are not secure not secure because of because of language characteristics language characteristics

  • hence consider

hence consider using several ciphers using several ciphers in in succession to succession to make harder make harder, , but: but:

  • two substitutions

two substitutions make a more make a more complex substitution complex substitution

  • two transpositions

two transpositions make more make more complex transposition complex transposition

  • but a

but a substitution followed by a transposition substitution followed by a transposition makes a makes a new much harder cipher new much harder cipher

  • this is

this is bridge bridge from from classical classical to to modern ciphers modern ciphers

slide-42
SLIDE 42

Rotor Machines Rotor Machines

  • before modern ciphers,

before modern ciphers, rotor machines rotor machines were were most common complex most common complex ciphers in use ciphers in use

  • widely used in WW

widely used in WW2

  • German Enigma,

German Enigma, Allied Allied Hagelin Hagelin, , Japanese Purple Japanese Purple

  • implemented a very complex, varying

implemented a very complex, varying substitution cipher substitution cipher

  • used a series of

used a series of cylinders cylinders, , each giving one each giving one substitution, which substitution, which rotated rotated and and changed after changed after each letter each letter was encrypted was encrypted

  • with

with 3 3 cylinders have cylinders have 26 263=17576 17576 alphabets alphabets

slide-43
SLIDE 43

Rotor Machine Principles Rotor Machine Principles

slide-44
SLIDE 44

Hagelin Rotor Machine Hagelin Rotor Machine

slide-45
SLIDE 45

Steganography Steganography

  • an alternative to encryption

an alternative to encryption

  • hides existence of message

hides existence of message

  • using only a subset of letters/words in a

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

  • using invisible ink

using invisible ink

  • hiding in LSB in graphic image or sound file

hiding in LSB in graphic image or sound file

  • has drawbacks

has drawbacks

  • high overhead to hide relatively few info bits

high overhead to hide relatively few info bits

slide-46
SLIDE 46

Summary Summary

  • have considered:

have considered:

  • classical cipher techniques and terminology

classical cipher techniques and terminology

  • monoalphabetic substitution ciphers

monoalphabetic substitution ciphers

  • cryptanalysis using letter frequencies

cryptanalysis using letter frequencies

  • Playfair cipher

Playfair cipher

  • polyalphabetic ciphers

polyalphabetic ciphers

  • transposition ciphers

transposition ciphers

  • product ciphers and rotor machines

product ciphers and rotor machines

  • stenography

stenography