Sei sulla pagina 1di 51

Information Security and

Management

2. Classical Encryption
Techniques
Chih-Hung Wang
Spring 2014
1
Basic Concepts
History
Kahns 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
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
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
Taxonomy
5
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
1970s
6
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
Symmetric Encryption
Simplified Model
8
Symmetric Encryption
Model of conventional cryptosystem
9
Symmetric Encryption
Expression
X: the plaintext
Y: the Ciphertext
K: the secret key
Encryption:
Y = E
K
(X)
X = D
K
(Y)
10
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
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
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
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
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
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
Security Concept
PGP company (1997)
$100,000 computer: Brute-force attack
17
Key length (bits)

Breaking time

40

2 seconds

56

35 hours

64

1 years

70

700 centenaries

128

10
16
(Thousand years)

Exhaustive Search
18
Key Size (bits) Number of
Alternative keys
Time required
at 1
encryption/us
Time required
at 10
6

encryptions/us
32 2
32
=4.3x10
9
2
31
us = 35.8
mins
2.15
milliseconds
56 2
56
=7.2x10
16
2
55
us = 1142
years
10.01 hours
128 2
128
=3.4x10
38
2
127
us =
5.4x10
24
years
5.4x10
18
years

26 characters
(permutation)
26! = 4x10
26
2x10
26
us =
6.4x10
12
years
6.4x10
6
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
Classical Encryption
Poem




Riddle


19
Classical Encryption
20
6

H28
Serial number of a can
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
Brute-force Attack of Caesar Cipher
22
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! > 4x10
26

Time evaluation
Assume one can try 10000 keys per second
Average time to find out the key
4x10
26
/ 4x10
7
x10
4
x2 =5x10
14
years
23
Monoalphabetic Ciphers
Cryptanalysis
The relative frequency of the letters can be determined and
compared to a standard frequency distribution for English
Ex: Ciphertext:

UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPES
XUDBMETSXAIZVUEPHZHMDZSHZOWSFPAPP
DTSVPQUZWYMXUZUHSXEPYEPOPDZSZUFPO
MBZWPFUPZHMDJUDTMOHMQ
24
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









Monoalphabetic Ciphers
Relative Frequency of Letters in English Text
26
Monoalphabetic Ciphers
Comparing results

27
E:12.702

D:4.253
L:4.025
P:1.929
B:1.492
V:0.978

T:9.056

A:8.167
O:7.507
I:6.996
N:6.749
S:6.327
H:6.094


C:2.782

U:2.758
M:2.406
W:2.360


K:0.772

J:0.153
X:0.150
Q:0.095

F:2.228
G:2.015
Z:0.074

R:5.987

Y:1.974





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
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
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
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
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
Relative Frequency of Occurrence of
Letters
33
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
Vigenre Cipher
Simplest polyalphabetic substitution cipher is
the Vigenre Cipher
Effectively multiple caesar ciphers
Key is multiple letters long K = k1 k2 ... kd
i
th
letter specifies i
th
alphabet to use
Use each alphabet in turn
Repeat from start after d letters in message
Decryption simply works in reverse
35
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: deceptivedeceptivedeceptive
plaintext: wearediscoveredsaveyourself
ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ

36
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 Vigenre Tableau (see text
Table 2.3)
37
Vigenre Tableau
38
Security of Vigenre 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
Autokey Cipher
ideally want a key as long as the message
Vigenre 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
Gilbert Vernam (1918)
Encryption





Decryption
i i i
k p c
i i i
k c p
41
p
i
: ith binary digit of plaintext
k
i
: ith binary digit of key
c
i
: ith binary digit of ciphertext
: exclusive-or (XOR)
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
Example of One-time Pad
43
Two Fundamental Difficulties
44
1. Making large quantities of random keys
2. Key distribution problem

Limited utility: is useful primarily for low-bandwidth channels
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
Transposition Ciphers
Transposition Techniques





Ciphertext:
TTNAAPTMTSUOAODWCOIXKNLYPETZ

46
Key

4

3

1

2

5

6

7

plain

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

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 26
3
=17576 alphabets
47
Three-rotor Machine
48
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
Relative Techniques
Character marking
Invisible ink
Pin punctures
Typewriter correction ribbon
50
Example of Steganography
51

Potrebbero piacerti anche