02-classical_encryption dr mohasin
TRANSCRIPT
-
8/6/2019 02-Classical_encryption DR MOHASIN
1/19
CEN 448ecur y an n erne ro oco s
Chapter 2
Classical Encryption Techniques
Dr. Mostafa Hassan DahshanComputer Engineering Department
King Saud University
Acknowledgements
These notes use some slides from
WilliamStallings.com website made by Dr.Lawrie Brown
Imported slides have Italic Titles
2
-
8/6/2019 02-Classical_encryption DR MOHASIN
2/19
Symmetric Encryption
aka conventional, private-key / single-key sender and recipient share a common key
private-key
was only type prior to invention of public-
ke in 1970s and by far most widely used
3
In redients
Plaintext
original intelligible message
performs substitutions, transformations
input: plaintext, key. output: ciphertext
Secret Ke
different keys different outputs,
4
-
8/6/2019 02-Classical_encryption DR MOHASIN
3/19
In redients
Cipher textunintelligible scrambled message
Decryption algorithm
encryption algorithm run in reverse
input: ciphertext, key. output: plaintext
5
Sim lified Model
6
-
8/6/2019 02-Classical_encryption DR MOHASIN
4/19
Sim lified Model
7
Requirements
two requirements for secure use of
symme r c encryp on:a strong encryption algorithm
a secret key known only to sender / receiver
mathematicall have:Y= EK(X)
= K
assume encryption algorithm is known
implies a secure channel to distribute key8
-
8/6/2019 02-Classical_encryption DR MOHASIN
5/19
Characterization
Type of operationsubstitution: each element of plaintext (bit,
character ma ed to another element
transposition: plaintext elements rearranged
stream cipher: element by element (bit, byte)block cipher: block transformed as a whole
9
Encr tion Attacks
Cryptanalysis
exploit characteristics of algorithm todeduce laintext or encr tion ke
may use pairs of plaintext, ciphertext
-
try all possible keys on ciphertext
on average, half of possible keys tried
10
-
8/6/2019 02-Classical_encryption DR MOHASIN
6/19
Types of Encryption Security
cipher cannot be brokenno ma er ow muc compu er power or me s
available
determine the corresponding plaintext
-
computational security
information
information11
Cryptanalysis Attacks
Attempt to deduce specific plaintext or key
Rely on
some knowledge of plaintext characteristics
Examples
some file t es have common header
exploit statistics of human language
12
-
8/6/2019 02-Classical_encryption DR MOHASIN
7/19
Cryptanalysis Attacks
13
Brute Force Attacks
always possible to simply try every key
most basic attack, proportional to key size
14
-
8/6/2019 02-Classical_encryption DR MOHASIN
8/19
Brute Force Attacks
Key size (bits) Number of
alternative keys
Time required at 1
decryption/sTime required at 10
decryption/s32 2 = 4.3 x 10 2 s = 35.8 minutes 2.15 milliseconds
56 256
= 7.2 x 1016
255
s = 1142 years 10.01 hours
128 2 = 3.4 x 10 2 s = 5.4 x 10 years 5.4 x 10 years
168 2168
= 3.7 x 1050
2167
s = 5.9 x 1036
years 5.9 x 1030
years
c aracters
(permutation)
= x 2 x 10 s = . x years . x years
15
Substitution Techniques
Letters in plaintext is replaced by
other letters
symbols
a n ex -sequence s rep ace y a
ciphertext sequence
16
-
8/6/2019 02-Classical_encryption DR MOHASIN
9/19
Substitution Techni ues
Caesar cipher Monoalphabetic ciphers
Polyalphabetic ciphers
One-time pad
17
Caesar Ci her
Ciphertext letter = plaintext letter + 3
Letters wrap around, Z is next after Aa 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
18
-
8/6/2019 02-Classical_encryption DR MOHASIN
10/19
Caesar Ci her
C = E(3, p) = (p + 3) mod 26 If shift is different from 3
= = + ,
p = D(k, C) = (C k) mod 26
19
Brute Force Attack
Encryption and
ecryp on a gor msare known
Only 25 keys to try
Plaintext lan ua e is
known
20
-
8/6/2019 02-Classical_encryption DR MOHASIN
11/19
Monoal habetic Ci her
Arbitrary substitution of letters Number of keys 26251 = 26! (Over
26
Regularities in the language can be
exp o e
21
Monoal habetic Exam le
22
-
8/6/2019 02-Classical_encryption DR MOHASIN
12/19
Monoal habetic Exam le
Frequency of letters P e, Z t
Frequency of two-
letter combinations
ZW th
23
Pla fair Ci her
55 matrix of letters
Constructed using a keyword
C H Y B D
E F G I/J K
U V W X Z
24
-
8/6/2019 02-Classical_encryption DR MOHASIN
13/19
Pla fair Ci her
Plaintext encrypted two letters at a time Repeating letters separated by filler x
e.g. balloon ba lx lo on
Letters in same row are each replaced by. . .
Letters in same col are each replaced by. . .
Otherwise, letter replaced by one in its rowan co o e o er e er. s
25
Pla fair Ci her
Advantages
2626 diagrams (two letter combinations)
Disadvantages
still leaves much of language structure
few 100s of ciphertext letters are enough for
cryptanalysis
26
-
8/6/2019 02-Classical_encryption DR MOHASIN
14/19
Relative Fre uenc of Letters
27
Polyalphabetic Ciphers
polyalphabetic substitution ciphers
improve security using multiple cipher alphabets make cr tanal sis harder with more al habets
to guess and flatter frequency distribution
each letter of the message
repeat from start after end of key is reached
28
-
8/6/2019 02-Classical_encryption DR MOHASIN
15/19
Vigenre Cipher
simplest polyalphabetic substitution cipher effectively multiple Caesar ciphers
1 2 ... d
ith letter specifies ith alphabet to use
use each alphabet in turn
decryption simply works in reverse
29
Vigenre Cipher
30
-
8/6/2019 02-Classical_encryption DR MOHASIN
16/19
Example of Vigenre Cipher
write the plaintext out write the keyword repeated above it
use each ke letter as a Caesar ci her ke
encrypt the corresponding plaintext letter
key: deceptivedeceptivedeceptive
p a ntext: weare scovere saveyourse
ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ
31
One-Time Pad
if a truly random key as long as the message is
use , e c p er w e secure called a One-Time pad
is unbreakable since ciphertext bears no
statistical relationshi to the laintext
since forany plaintext & any ciphertext there
can only use the key once though
pro ems n genera on sa e s r u on o ey32
-
8/6/2019 02-Classical_encryption DR MOHASIN
17/19
One-Time Pad Example
Vigenre scheme with 27 characters 27th character is space
- ,
key: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih
plaintext: mr mustard with the candlestick in the hall
ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS
key: mfugpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt
laintext: miss scarlet with the knife in the librar
33
Trans osition Techni ues
Perform some permutations on plaintext
letters
Rail fence cipher
ranspos t on matr x
34
-
8/6/2019 02-Classical_encryption DR MOHASIN
18/19
Rail Fence Ci her
Plaintext written as sequence of diagonals Read off as sequence of rows
MEMATRHTGPRYETEFETEOAAT
35
Trans osition Matrix
Write message in rectangle, row by row
Read message off, column by column
Order of columns is the key
36
-
8/6/2019 02-Classical_encryption DR MOHASIN
19/19
Trans osition Matrix
Original order of letters 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27 28
er ranspos on 03 10 17 24 04 11 18 25 02 09 16 23 01 08 15 22
Somewhat regular structure
37
Trans osition Matrix
More than one stage of transposition
After second transposition
04 23 19 14 11 01 26 21 18 08 06 28