Upload
adrian-newman
View
215
Download
0
Embed Size (px)
Citation preview
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.1
CSE565: Computer SecurityLecture 2
Basic Encryption & Decryption
CSE565: Computer SecurityLecture 2
Basic Encryption & Decryption
Shambhu Upadhyaya
Computer Science & Eng.
University at Buffalo
Buffalo, New York, 14260
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.2
Overview Lecture 2 Overview
Terminology (10 minutes) Encryption by Substitutions & Transpositions
(60 minutes)
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.3
AnnouncementsAnnouncements
Background Material – 1 Properties of Arithmetic
Inverses Divisors Prime Numbers Greatest Common Divisor
Background Material – 2 Modular arithmetic
Basic properties Operations
Refer to Useful Notes on Handouts page
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.4
Terminology Encryption
A process of encoding a message Decryption
It is the reverse process
Encryption Algorithms A key K is generally used Symmetric encryption: Asymmetric encryption:
)),(,( PKEKDP
)),(,( PKEKDP ED
Plaintext
P=(p1,p2, …pn)
CiphertextOriginalPlaintext
Encryption Decryption
C=(c1,c2, … cm)C=E(P)
P=D(C) =D(E(P))
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.5
Cryptography &
Cryptanalysis Cryptography
Hidden writing – encryption to conceal text Cryptanalysis
Break an encryption Attempt to break a single message Attempt to recognize patterns in encrypted
messages Attempt to find general weaknesses
Breakable Encryption Given enough time and data, encryption can
be broken Practicality is an issue Risky to proclaim an algorithm secure!
Cryptanalysis AttacksCryptanalysis Attacks
Type of attack What is known to cryptanalyst
Ciphertext only Algorithm, ciphertext
Known plaintext Algorithm, ciphertext, corresponding plaintext
Chosen plaintext Algorithm, ciphertext, plaintext chosen by analyst with corresponding ciphertext
Chosen ciphertext Algorithm, ciphertext, ciphertext chosen by analyst with corresponding decrypted plaintext
Chosen text Combination of the above two
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 3.6
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.7
Substitutions & Transpositions
Substitutions Monoalphabetic Ciphers Polyalphabetic Ciphers These are called Stream Ciphers
Transpositions Permutation These are Block Ciphers
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.8
Monoalphabetic
Ciphers Caesar Cipher Formula: Treaty Impossible --> wuhdwb lpsrvvleoh Advantages & Disadvantages
Easy to perform Simple, so easy to predict the pattern Repeat characters give clue to break
Permutation Cipher Use a key ABCDE ……… Keyab………. Since key is short, most plaintext letters are only one
or two positions off Time complexity of these algorithms – linear in n where n
is the no. of characters in plaintext
3)( iii ppEc
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.9
Polyalphabetic Substitution
Ciphers Main problem with mono-alphabetic ciphers is the non-flat frequency distribution
A flat distribution gives no information to cryptanalyst
Flattening by combining distributions Two or more separate encryption alphabets for the
same character of the plaintext E.g., one encryption for characters in odd positions
and another for at even positions Reduces the repeat symbols in the ciphertext Makes it hard to break (Discussion of an example)
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.10
Vigenere Tableau Need to smooth out peaks and valleys of frequency
distribution Can be done by extending no. of permutations Extreme case – extend to 26 permutations A 26 X 26 table is used (discussion of example) Key word of length 3 is sufficient to smooth out the
distribution Cryptanalysis of Polyalphabetic Substitution
Reading exercise Focus on Kasiski method and Index of
Coincidence method (Look up Ref. Texts) (http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher)
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.11
Perfect Substitution
Cipher Requires an infinite non-repeating sequence of alphabets
This will confound the cryptanalyst One-Time pads Vernam Cipher
Uses an arbitrarily long sequence of numbers Formula:
Random Numbers Middle digits of phone numbers in a residential
directory Pseudo random numbers – linear congruential
random number generator Formula:
nprc iii mod
nbrar i mod)*(1i
Unbreakable CipherUnbreakable Cipher
Use a Vigenere table with 27 characters (includes space)
Use a one-time key as long as the message Two different decryptions using two keys Cryptanalyst cannot figure out which key is
correct – hence the code is unbreakable
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.12
ciphertextkeyplaintext
ciphertextkeyplaintext
ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTSpxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyihmr mustard with the candlestick in the hall
ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTpftgpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwtmiss scarlet with the knife in the library
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.13
Transpositions It is a method where letters of the message are rearranged
Goal here is diffusion rather than confusion Information is spread widely across the ciphertext
Columnar transposition is an easy one Characters are rearranged into columns (Study of an example)
Encipherment/Decipherment Complexity Algorithm is constant in the amount of work per character Time is proportional to length of message Space required is directly proportional to message length Output characters cannot be produced until all characters are
read in Delay depends on the length of the message
Not appropriate for long messages
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.14
Cryptanalysis Digrams, trigrams & other patterns used to break
encryption Digram – letter pairs such as -re- -th- -en- -ed- etc. Trigram – groups such as ent, and, ing, thi etc.
Cryptanalysis by trial & error & using a moving window for comparison This is a reading exercise! (http://en.wikipedia.org/wiki/Transposition_cipher)
Double transposition algorithm makes breaking more difficult It uses transposition of a transposed text Discussion of example
9/03/15 UB Fall 2015CSE565: S. Upadhyaya
Lec 2.15
Summary Stream Ciphers
Mono and poly-alphabetic encryptions Since they convert one symbol of plaintext immediately
into a symbol of ciphertext Features include: a) speed of transformation, b) low
error propagation Disadvantages are: a) low diffusion, b) susceptible to
malicious insertions Block Ciphers
Columnar transposition algorithm and fractionated Morse
Group of plaintext symbols are encrypted as one block Features include: a) diffusion, b) immunity to insertions Disadvantages are: a) slowness of encryption, b) error
propagation