Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer and Network Security

Similar presentations


Presentation on theme: "Computer and Network Security"— Presentation transcript:

1 Computer and Network Security
CSEN 1001 Computer and Network Security Amr El Mougy Alaa Gohar Heba Anwar

2 Lecture (2) Cryptographic Tools

3 Early History Egypt (Old Kingdom), ca. 1900BC. Use of non-standard hieroglyphs (probably not a serious attempt at secret communication) Mesopotamia, ca. 1500BC. Encrypted recipe for pottery glaze on clay tablet Hebrew, ca. 500BC. Monoalphabetic substitution cipher used by scholars

4 Not so Early History 800AD. Early description of frequency analysis for breaking substitution ciphers (credited to Arab mathematician Al- Kindi, 801–873). Works about cryptanalysis of single- and polyalphabetic ciphers Ahmad al-Qalqashandi 1355–1418 List of ciphers in his encyclopedia contains a cipher with multiple substitutions for each letter; frequency tables for letters to aid cryptanalysis 1467: Leon Battista Alberti (“father of Western cryptology”) describes the polyalphabetic cipher

5 Recent History WWII heavy use of rotor machines for complex polyalphabetic substitution ciphers The “Enigma” machine:

6 Recent History The time of WWII brought massive advances in cryptography as well as cryptanalysis In the 20th century, mathematical cryptography was developed Works by Claude Shannon. Any theoretically unbreakable cipher must have keys which are at least as long as the plaintext and used only once (one-time pad) Publication of the Data Encryption Standard in 1970 1976 Ground-breaking paper: Whitfield Diffie and Martin Hellman. “New Directions in Cryptography” solves key exchange problem and sparks development of asymmetric key algorithms

7 Cryptographic Tools Cryptographic algorithms important element in security services Review various types of elements symmetric encryption public-key (asymmetric) encryption digital signatures and key management secure hash functions Example is to encrypt stored data Characterize cryptographic system 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

8 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, and by far most widely used

9 Public Key Encryption

10 Requirements Two requirements for secure use of symmetric encryption:
a strong encryption algorithm a secret key known only to sender / receiver Mathematically have: Y = EK(X) X = DK(Y) Assume encryption algorithm is known Implies a secure channel to distribute key

11 Attacking Symmetric Encryption
Cryptanalysis rely on the nature of the algorithm plus some knowledge of plaintext characteristics even some sample plaintext-ciphertext pairs exploits characteristics of algorithm to deduce specific plaintext or key Brute-force attack try all possible keys on some ciphertext until get an intelligible translation into plaintext

12 Cryptanalysis Attacks
Ciphertext only only know algorithm & ciphertext, is statistical, know or can identify plaintext Known plaintext know/suspect plaintext & ciphertext Chosen plaintext select plaintext and obtain ciphertext Chosen ciphertext select ciphertext and obtain plaintext Chosen text select plaintext or ciphertext to en/decrypt

13 Encryption Schemes An encryption scheme is unconditionally secure if the ciphertext generated by the scheme does not contain enough information to determine uniquely the corresponding plaintext, no matter how much ciphertext is available An encryption scheme is said to be computationally secure if: 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

14 Exhaustive Key Search

15 Classical Substitution Ciphers
Where letters of plaintext are replaced by other letters or by numbers or symbols Or if plaintext is viewed as a sequence of bits, then substitution involves replacing plaintext bit patterns with ciphertext bit patterns

16 Caesar Cipher Earliest known substitution cipher (invented by Julius Caesar) First attested use in military affairs Replaces each letter by 3rd letter down in the alphabet. Example: Meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB 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 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 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 Then have Caesar cipher as: c = E(p) = (p + k) mod (26) p = D(c) = (c – k) mod (26)

17 Breaking Caesar Cipher
Only have 26 possible ciphers A maps to A,B,..Z Could simply try each in turn a brute force search Given ciphertext, just try all shifts of letters Do need to recognize when have plaintext Compression reduces chance of breaking

18 Monoalphabetic Cipher
Rather than just shifting the alphabet, shuffle (jumble) the letters arbitrarily Each plaintext letter maps to a different random ciphertext letter Hence key is 26 letters long Plain: abcdefghijklmnopqrstuvwxyz Cipher: DKVQFIBJWPESCXHTMYAUOLRGZN Plaintext: ifwewishtoreplaceletters Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA Now have a total of 26! = 4 x 1026 keys With so many keys, might think is secure But would be !!!WRONG!!!

19 Breaking the Monoalphabetic Cipher
Given ciphertext: UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ

20 Breaking the Monoalphabetic Cipher
Human languages are redundant, eg “secrty s awsm" letters are not equally commonly used In English E is by far the most common letter followed by T,R,N,I,O,A,S Other letters like Z,J,K,Q,X are fairly rare Have tables of single, double & triple letter frequencies for various languages

21 Breaking the Monoalphabetic Cipher
Key concept - monoalphabetic substitution ciphers do not change relative letter frequencies Discovered by Arabian scientists in 9th century Calculate letter frequencies for ciphertext Compare counts/plots against known values If Caesar cipher look for common peaks/troughs peaks at: A-E-I triple, NO pair, RST triple troughs at: JK, X-Z For monoalphabetic must identify each letter tables of common double/triple letters help

22 Breaking the Monoalphabetic Cipher
Given ciphertext: UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ Count relative letter frequencies Guess P & Z are e and t Guess ZW is “th” and hence ZWP is “the”. Frequency of two-letter combinations is known as digrams Proceeding with trial and error finally get: it was disclosed yesterday that several informal but direct contacts have been made with political representatives of the viet cong in moscow

23 “pack my box with five dozen liquor jugs”
Problem 1 In the English language, a sentence that contains all 26 letters of the alphabet is called a perfect pangram. These sentences may have important use in some cryptography algorithms. Specify a good use of a perfect pangram for any cryptography algorithm (hint: think of the monoalphabetic cipher). Using the answer in part (a), use the following perfect pangram: “pack my box with five dozen liquor jugs” To encrypt the statement: “I am going to graduate very soon” using the cipher you chose in part (a). Is the encryption algorithm that you used considered secure? Why? Solution For the monoalphabetic cipher, a perfect pangram can be used as the key. First construct the substitution table Then perform the substitution to be: XPHBVXFBNVBZPKLPNMQMZJEVVF c) It is vulnerable to frequency analysis, so it is not secure. 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 P A C K M Y B O X W I T H F V E D N L Q U R J S

24 Problem 2 The following cipher texts have been encrypted using Caesar cipher, find out the original text: m xlmro, xlivijsvi m ibmwx Solution Caesar Cipher is broken either with brute force or frequency analysis. Using Frequency Analysis, the letter ‘m’ is repeated, and single letter words are scarce in English; examples are ‘a’ and ‘I’. To decipher the rest of the text, we find the shift needed to turn ‘m’ to ‘a’ and ‘m’ to ‘I’, whichever produces a meaningful sentence is the correct shift. Fours shifts backwards are needed to turn ‘m’ to ‘I’, continuing to shift each of the letters of the cipher text 4 shifts backwards produces the decrypted text: I think, therefore I exist

25 Problem 3 The following ciphertext was produced using a Caesar cipher. Break the encryption to obtain the plaintext. Note that the most commonly occurring letter in the English language is “e” and the second most commonly occurring letter is “t”. MAX YTNEM, WXTK UKNMNL, EBXL GHM BG HNK LMTKL UNM BG HNKLXEOXL Solution By analyzing the ciphertext, the most commonly occurring letter is M, followed by X. If we assume that M is equivalent to e and X is equivalent to t we do not get a meaningful phrase. Thus, we can estimate that M = t and X = e. Analysis confirms that this is a shift of 19 letters in both substitutions. Using this same shift for all letters gives the plaintext The fault, dear Brutus is lies not in our stars but in ourselves

26 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 A 5X5 matrix of letters based on a keyword Fill in letters of keyword (without 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

27 Encrypting and Decrypting
Plaintext is encrypted two letters at a time If a pair is a repeated letter, insert filler like 'X’ If both letters fall in the same row, replace each with letter to right (wrapping back to start from end). Ex: ar becomes RM If both letters fall in the same column, replace each with the letter below it (again wrapping to top from bottom). Ex: mu becomes CM Otherwise each letter is replaced by the letter in the same row and in the column of the other letter of the pair. Ex: hs becomes BP

28 Security of Playfair 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. by US & British military in WW1 It can be broken, given a few hundred letters Since still has much of plaintext structure

29 Problem 4 Solution Encryption table
Encrypt the following phrase with the Playfair cipher. The key is “children” Too cool for school Solution Encryption table Letters will be encrypted as: to oc ox ol fo rs ch ox ol Thus, the ciphertext is: um fd kz md gf np hi kz md C h i/j l d r e n a b f g k m o p q s t u v w x y z

30 Polyalphabetic Cipher
Improve security using multiple cipher alphabets Make 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

31 Vigenère Cipher Simplest polyalphabetic substitution 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 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: plaintext: ciphertext: d e c p t i v w a r s o y u l f Z I C V T W Q N G R A H Y L M J

32 Plaintext Key

33 Breaking the Vigenère Cipher
Have multiple ciphertext letters for each plaintext letter Hence letter frequencies are obscured, but not totally lost Start with letter frequencies see if look like monoalphabetic or not If not, then need to determine number of alphabets, since then can attach each Kasiski method developed by Babbage/Kasiski is a way of breaking Vigenere Repetitions in ciphertext give clues to period, so find same plaintext an exact period apart which results in the same ciphertext Of course, could also be random fluke eg repeated “VTW” in previous example suggests size of 3 or 9 Then attack each monoalphabetic cipher individually using same techniques as before

34 Problem 5 Solution a) Plain text: Key : Result :
a) Encrypt “Attack Now” using Vigenère cipher, with the keyword “Play” using tabula recta. b) Perform an examination to find the length of the key that was used to produce the following Vigenère cipher text. io ygx wewq ss tswmw nzl eytluonnr. vs wewq ss hzo aj acw ysamdi yo mw eytluojd. Solution a) Plain text: Key : Result : p l a y t c k n o w P E T Y R V N M L b) First, we find repetitions of sequences in the cipher: io ygx wewq ss tswmw nzl eytluonnr. vs wewq ss hzo aj acw ysamdi yo mw eytluojd. The distances between repetitions are 25 characters and 35 characters respectively. Using prime factorization: 25 = 5 *5 35 = 5*7 Therefore the gcd = 5 This indicates a key length of 5.

35 Problem 6 Assume that Vigenere cipher was used to convert the following plaintext into ciphertext: If the sequence of characters TICRMQUIRTJR was found twice in the ciphertext, once starting at the 10th character position and again starting at the 241st character position (numbering starts from 1), we can use the Kasiski method to estimate that the key length can be multiples of 241 – 10 = 231 = 3*7*11 Thus, we estimate that the length of the key is 3, 7 or 11 characters. Discover the key. Plaintext c r y p t o g a h Ciphertext T I C R M Q U J

36 Solution 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 1 2 3 4 5
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 At position 10, the shift is T – c = 19 – 2 = 17 = r Similarly, the remaining letters give the corresponding keyword: rrectcorrect This is obviously not periodic with period 3 or 11, while period 7 is possible. A keyword of length 7 starts at position 15, resulting in the keyword: correct

37 One-time Pad A random key as long as the message is used to encrypt and decrypt a single message The key is then discarded, never to be used again The output bears no statistical relationship to the plaintext Given any plaintext of equal length to the ciphertext, there is a key that produces that plaintext. Therefore, if you did an exhaustive search of all possible keys, you would end up with many legible plaintexts, with no way of knowing which was the intended plaintext ciphertext: ANKYODKYUREPFJBYOJDSPLREYIUNOFDOIUERFPLUYTS key: pxlmvmsydofuyrvzwc tnlebnecvgdupahfzzlmnyih plaintext: mr mustard with the candlestick in the hall key: mfugpmiydgaxgoufhklllmhsqdqogtewbqfgyovuhwt plaintext: miss scarlet with the knife in the library Large number of keys need to be used. Key distribution is a big problem

38 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 Simplest transposition cipher is the Rail Fence Cipher Write message letters out diagonally over a number of rows Then read off cipher row by row eg. write message out as: m e m a t r h t g p r y e t e f e t e o a a t Giving ciphertext MEMATRHTGPRYETEFETEOAAT

39 Row Transposition Ciphers
A more complex transposition Write letters of message out in rows over a specified number of columns, then reorder the columns according to some key before reading off the rows Key: Plaintext: Ciphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ Ciphers using substitutions or transpositions are not secure because of language characteristics Hence consider using several ciphers in succession to make harder, but: two substitutions make a more complex substitution two transpositions make more complex transposition but a substitution followed by a transposition makes a new much harder cipher 4 3 1 2 5 6 7 a t c k P o s n e d u i l w m x y Z

40 Rotor Machines Before modern ciphers, rotor machines were most common complex ciphers in use 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

41 Rotor Machines

42 Note The material in this lecture can be found in Chapter 2, Cryptography and network security. Everything except “Hill cipher” has been covered.


Download ppt "Computer and Network Security"

Similar presentations


Ads by Google