Presentation is loading. Please wait.

Presentation is loading. Please wait.

ITIS 3200: Introduction to Information Security and Privacy Dr. Weichao Wang.

Similar presentations


Presentation on theme: "ITIS 3200: Introduction to Information Security and Privacy Dr. Weichao Wang."— Presentation transcript:

1 ITIS 3200: Introduction to Information Security and Privacy Dr. Weichao Wang

2 2 Chapter 8: Basic Cryptography Classical Cryptography Public Key Cryptography Cryptographic Checksums

3 3 Overview Classical Cryptography (symmetric encryption) –Caesar cipher –Vigenère cipher –DES –AES Public Key Cryptography (asymmetric encryption) –RSA Cryptographic Checksums

4 4 Cryptosystem Quintuple ( E, D, M, K, C ) –M set of plaintexts –K set of keys –C set of ciphertexts –E set of encryption functions e: M  K  C –D set of decryption functions d: C  K  M –Usually, the cipher text is longer than or has the same length as the plaintext

5 5 Example Example: Caesar cipher (a circular shift mapping) –M = { sequences of letters } –K = { i | i is an integer and 0 ≤ i ≤ 25 } –E = { E k | k  K and for all letters m, E k (m) = (m + k) mod 26 } –D = { D k | k  K and for all letters c, D k (c) = (26 + c – k) mod 26 } –From the space point of view, C = M

6 6 Attacks Opponent whose goal is to break cryptosystem is the adversary –Assume adversary knows algorithm used, but not key –They are after the key and/or data contents Three types of attacks: –ciphertext only: adversary has only ciphertext; goal is to find plaintext, possibly key –known plaintext: adversary has ciphertext, corresponding plaintext; goal is to find key –chosen plaintext: adversary may supply plaintexts and obtain corresponding ciphertext; goal is to find key –It is not difficult to know both ciphertext and plaintext

7 7 Basis for Attacks Mathematical attacks –Based on analysis of underlying mathematics –For example: the safety of RSA is based on the difficulty to factor the product of two large prime numbers. If it is broken, then RSA will become unsafe. Statistical attacks –Make assumptions about the distribution of letters, pairs of letters (digrams), triplets of letters (trigrams), etc. Called models of the language –Examine ciphertext, correlate properties with the assumptions.

8 8 Classical Cryptography (symmetric) Sender, receiver share common key –Keys may be the same, or trivial to derive one from the other –Sometimes called symmetric cryptography –How to distribute keys: following chapters Two basic types –Transposition ciphers (shuffle the order) –Substitution ciphers (replacement) –Combinations are called product ciphers

9 9 Transposition Cipher Rearrange letters in plaintext to produce ciphertext Example (Rail-Fence Cipher) –Plaintext is HELLO WORLD –Rearrange as HLOOL ELWRD –Ciphertext is HLOOL ELWRD (order the letters in vertical, send out in horizontal)

10 10 Attacking the Cipher Anagramming –The frequency of the characters will not change –The key is a permutation function –If 1-gram frequencies match English frequencies, but other n-gram frequencies do not, probably transposition –Rearrange letters to form n-grams with highest frequencies

11 11 Example Ciphertext: HLOOLELWRD Frequencies of 2-grams beginning with H –HE 0.0305 –HO 0.0043 –HL, HW, HR, HD < 0.0010 Frequencies of 2-grams ending in H –WH 0.0026 –EH, LH, OH, RH, DH ≤ 0.0002 Implies E follows H

12 12 Example Arrange so the H and E are adjacent HE LL OW OR LD Read off across, then down, to get original plaintext May need to try different combinations or n- grams

13 13 Substitution Ciphers Change characters in plaintext to produce ciphertext –The replacement rule can be fixed or keep changing Example (Caesar cipher) –Plaintext is HELLO WORLD –Change each letter to the third letter after it in the alphabet (A goes to D, ---, X goes to A, Y to B, Z to C) Key is 3, usually written as letter ‘D’ (which letter to replace “A”) –Ciphertext is KHOOR ZRUOG

14 14 Attacking the Cipher Exhaustive search –If the key space is small enough, try all possible keys until you find the right one –Caesar cipher has 26 possible keys –On average, you only need to try half of them Statistical analysis –The ciphertext has a character frequency –Compare (and try to align it) to 1-gram model of English

15 15 Statistical Attack Compute frequency of each letter in ciphertext: G0.1H0.1K0.1O0.3 R0.2U0.1Z0.1 Apply 1-gram model of English –Frequency of characters (1-grams) in English is on next slide

16 16 Character Frequencies a0.080h0.060n0.070t0.090 b0.015i0.065o0.080u0.030 c j0.005p0.020v0.010 d0.040k0.005q0.002w0.015 e0.130l0.035r0.065x0.005 f0.020m0.030s0.060y0.020 g0.015z0.002

17 17 Frequency chart of English Frequency chart of ciphertext

18 18 Statistical Analysis Try to align the two charts f(c): frequency of character c in ciphertext  (i): correlation of frequency of letters in ciphertext with corresponding letters in English, assuming key is i –  (i) =  0 ≤ c ≤ 25 f(c)p(c – i) –  (i) = 0.1p(6 – i) + 0.1p(7 – i) + 0.1p(10 – i) + 0.3p(14 – i) + 0.2p(17 – i) + 0.1p(20 – i) + 0.1p(25 – i) p(x) is frequency of character x in English –This correlation value should be a maximum when the two charts are aligned

19 19 Correlation:  (i) for 0 ≤ i ≤ 25 i (i)(i) i (i)(i) i (i)(i) i (i)(i) 00.048270.0442130.0520190.0315 10.036480.0202140.0535200.0302 20.041090.0267150.0226210.0517 30.0575100.0635160.0322220.0380 40.0252110.0262170.0392230.0370 50.0190120.0325180.0299240.0316 60.0660250.0430

20 20 The Result Most probable keys, based on  : –i = 6,  (i) = 0.0660 plaintext EBIIL TLOLA –i = 10,  (i) = 0.0635 plaintext AXEEH PHKEW –i = 3,  (i) = 0.0575 plaintext HELLO WORLD –i = 14,  (i) = 0.0535 plaintext WTAAD LDGAS Only English phrase is for i = 3 –That’s the key (3 or ‘D’) The algorithm will become more complicated if the encryption is not a circular shift We are only reducing the searching space by guided guess

21 21 Caesar’s Problem Key is too short –Can be found by exhaustive search –Statistical frequencies not concealed well They look too much like regular English letters –The most frequently seen character could be “E” So make it longer –Multiple letters in key –Idea is to smooth the statistical frequencies to make cryptanalysis harder What if in the cipher text, every character has the same frequency? All correlation will have the same value

22 22 What we can get from this: –If the key contains only 1 character, we have 26 choices –If the key contains m characters, we need to try 26 ^ m combinations. m=5, 12 million choices.

23 23 Vigenère Cipher Like Caesar cipher, but use a longer key Example –Message THE BOY HAS THE BALL –Key VIG ( right shift 21, 8, 6 times, then repeat ) –Encipher using Caesar cipher for each letter: key VIG VIG VIG VIG VIG V plain THE BOY HAS THE BAL L cipher OPK WWE CIY OPK WIR G

24 24 Now we have: –Three groups of characters encrypted by V, I, and G respectively –Each group is a Caesar cipher (fixed shift offset) –Approach: Figure out the length of the key Decipher each group as a Caesar’s cipher –Hint: when the same plaintext is encrypted by the same segment of key, we have the same cipher Can be used to derive the period

25 25 Attacking the Cipher Approach –Establish period; call it n –Break message into n parts, each part being enciphered using the same key letter So each part is like a Caesar cipher –Solve each part You can leverage one part from another because English has its special rule

26 26 Establish Period Kasiski: repetitions in the ciphertext occur when characters of the key appear over the same characters in the plaintext Example: key VIG VIG VIG VIG VIG V plain THE BOY HAS THE BAL L cipherOPK WWE CIY OPK WIR G Note the key and plaintext line up over the repetitions (underlined). As distance between repetitions is 9, the period is a factor of 9 (that is, 1, 3, or 9)

27 27 We guess the period is 3, so we divide the cipher text into three groups –Each group is a Caesar cipher –Using previous approaches to solve them

28 28 One-Time Pad A Vigenère cipher with a random key at least as long as the message –Provably unbreakable –Why? Every character in the key is random. It has the same chance to be “a”, “b”, ---, “z” –Look at ciphertext DXQR. Equally likely to correspond to plaintext DOIT (key AJIY) and to plaintext DONT (key AJDY) and any other 4-letter words –Warning: keys must be random, or you can attack the cipher by trying to regenerate the key


Download ppt "ITIS 3200: Introduction to Information Security and Privacy Dr. Weichao Wang."

Similar presentations


Ads by Google