Presentation is loading. Please wait.

Presentation is loading. Please wait.

T215B Communication and information technologies (II) Session 4

Similar presentations


Presentation on theme: "T215B Communication and information technologies (II) Session 4"— Presentation transcript:

1 T215B Communication and information technologies (II) Session 4
Arab Open University Block 4 Protecting and prying

2 Session Outline Part 5: Encryption Breaking a Cipher
Linguistic Analysis Building Stronger Ciphers Building Blocks of modern encryption systems Arab Open University

3 3.2 Linguistic analysis [1/8]
The first approach to cipher breaking is Brute Force Attack A second approach to cipher breaking is the linguistic analysis Linguistic Analysis: to attempt to exploit any linguistic patterns inherited from the plaintext (for only textual contexts). All written languages exhibit characteristic patterns. For example, in written English the letter ‘q’ is almost always followed by a ‘u’ certain pairs of letters (known as digraphs) are more likely to appear together than others: ‘th’ is common as are ‘ea’, ‘of’, and ‘st’. Some identical letters can often appear together, for example ‘ee’, ‘oo’, ‘tt’, but seldom ‘uu’ or ‘hh’. There is a higher probability of certain letters appearing than other letters For example , in written English The most common letter is ‘e’, followed by ‘t’, ‘a’ and ‘o’. ‘etaoin’ are the six most frequent letters. Arab Open University

4 3.2 Linguistic analysis [2/8]
Arab Open University

5 3.2 Linguistic analysis [3/8]
Arab Open University

6 3.2 Linguistic analysis [4/8]
Arab Open University

7 3.2 Linguistic analysis [5/8]
A ciphertext sequence can also be analysed for letter frequency. If the analysis shows a curve similar to Figure 5.8 or Figure 5.9 then: There is a strong possibility that the most frequently occurring ciphertext letters will correspond to their equivalents in standard English text! Arab Open University How linguistic analysis can help to break ciphers?

8 3.2 Linguistic analysis [6/8]
Standard English letter frequency Activity 5.7: The figure below shows the results of letter frequency analysis of a sample of ciphertext. Does the ciphertext exhibit a pattern similar to standard English letter frequencies? If so, what assumptions could you make about the cipher? Activity 5.7 – Comments: The following similarities can be noted: R – Z → A – I B – G → K – P I – P → R – Y. Ciphertext letter frequency Arab Open University

9 3.2 Linguistic analysis [7/8]
Activity 5.7 – Comments: The similarities mean that the cipher was created using a simple substitution cipher! The ordering of the letters was preserved in the ciphertext but their identity was changed. In fact, if the ciphertext letter frequency plot was shifted to the left by 17 places the result would look very similar to the standard English plot. The guess would be that the cipher used was a simple Caesar cipher with a key of 17. Arab Open University

10 3.2 Linguistic analysis [8/8]
Linguistic patterns can prove useful for breaking simple transposition ciphers too. In a transposition cipher, the positions of the letters change but their identity remains the same For example, there will be the same frequency of the letter “E” in the ciphertext as there is in the plaintext. Given a long enough sample of transposition ciphertext, frequency analysis can provide a useful starting point for the cryptanalyst. If the results indicate a match with standard letter frequencies then the ciphertext is most likely the result of a transposition cipher. This knowledge points to various analytical techniques to help break the cipher, exploiting the kind of patterns we discussed. Arab Open University

11 Session Outline Part 5: Encryption Breaking a Cipher
Building Stronger Ciphers Increasing the Key Space Weakening the linguistic association An unbreakable cipher Building Blocks of modern encryption systems Arab Open University

12 4. Building stronger ciphers [1/1]
To combat Brute force attack we need: A very large key space To combat Linguistic analysis benefits we need: A weak association between the linguistic patterns in the plaintext and ciphertext So, two desirable characteristics are required to build strong ciphers: a very large key space a weak association with the linguistic patterns in the plaintext. Arab Open University How ciphers can be designed to address these requirements?

13 4.1 Increasing the key space [1/9]
Using the simple Caesar cipher, the maximum key length is 26. What if encrypt letters as pairs (digraphs) instead of singly? Possible digraphs are: aa, ab, ac, …, ay, az Then, ba, bb, bc, …, by, bz Then … … … za, zb, …, zy, zz Numerical coding: Since each single letter represents one of 26 possibilities each pair of letters would represent one of 26 × 26 = = 676 possibilities Arab Open University aa ab az ba bb bz za zb zz 1 25 26 27 51 650 651 675

14 4.1 Increasing the key space [2/9]
So digraph coding provides a means of increasing the key space from 26 to 676! Using a simple Caesar cipher: the key can take any value between 0 and 25! Using a Caesar cipher with digraph coding: the key can take any value between 0 and 675! Do you think it is practical to search in a table of 676 columns? How to mathematically calculate the numerical code of a digraph? The numerical code of a digraph is given by: p = p1 x 26 + p2 Where p is the numerical equivalent of the digraph in question. p1 is the numerical equivalent of the first letter in the pair (on the left). p2 is the numerical equivalent of the second letter in the pair (on the right). Arab Open University

15 4.1 Increasing the key space [3/9]
Activity 5.10: Calculate the numerical code value for the first digraph in the word ‘zenith’. Sol.: ‘zenith’ would be treated as three separate digraphs: ze ni th. The first digraph is ‘ze’. pz= 25 and pe = 4. So the digraph ‘ze’ is coded as pze = pz x 26 + pe So, pze = (25 × 26) + 4 = 654 Arab Open University How to convert a numerical code to its equivalent digraph?

16 4.1 Increasing the key space [4/9]
Example:Convert 325 into its equivalent digraph. Sol.: 325 = p1 x 26 + p2 so = 𝑝 1 + 𝑝 2 26 So, if we divide 325 by 26: p1 would be the quotient of the division p2 would be the remainder of the division While 325/26 = = p1 = 12 → this numerical code is equivalent to the letter ‘m’ p2 = 13 → this numerical code is equivalent to the letter ‘n’ So 325 is equivalent to the digraph ‘mn’ Arab Open University How to encrypt a digraph using Caesar cipher?

17 4.1 Increasing the key space [5/9]
Activity 5.11: Using digraphs for coding and encrypting alphabetic symbols: (a) what value would be used for the modulus? (b) what values could be chosen for the key? Sol. (a) A coded digraph can take one of a possible 26 × 26 = 676 different combinations. So the modulus is 676. (b) The key can be any number from 0 to 675. Note that “0” can be excluded from the key space since a key of K=0 will not change the plaintext! The general encryption formula of a Caesar cipher with digraph coding is: c ≡ p + K mod 676 Arab Open University

18 4.1 Increasing the key space [6/9]
Example:Use a Caesar Cipher with digraph coding to encrypt the following plaintext: ‘zenith’ with a key of K=347. Sol.:‘zenith’ contains three digraphs: ze; ni and th. ‘ze’ encryption : pze=pz x 26 + pe = (25 × 26) + 4 ; so pze= 654 So cze ≡ pze + K mod 676 ≡ mod 676 ≡ 1001 mod 676 ≡ 325 mod 676 The next step is to convert 325 into the equivalent digraph to derive the ciphertext: 25/26 = = p1 = 12 → this numerical code is equivalent to the letter ‘M’ p2 = 13 → this numerical code is equivalent to the letter ‘N’ so the ciphertextdigraph for ‘ze’ is ‘MN’. Arab Open University

19 4.1 Increasing the key space [7/9]
Example:Use a Caesar Cipher with digraph coding to encrypt the following plaintext: ‘zenith’ with a key of K=347. Sol.:‘zenith’ contains three digraphs: ze; ni and th. ‘ni’ encryption : pni=pnx 26 + pi= (13 × 26) + 8 ; so pni= 346 So cni≡ pni+ K mod 676 ≡ mod 676 ≡ 693 mod 676 ≡ 17 mod 676 The next step is to convert 17 into the equivalent digraph to derive the ciphertext: 17/26 = p1 = 0 → this numerical code is equivalent to the letter ‘a’ p2 = 17 → this numerical code is equivalent to the letter ‘r’ so the ciphertext digraph for ‘ni’ is ‘AR’. Arab Open University

20 4.1 Increasing the key space [8/9]
Example: Use a Caesar Cipher with digraph coding to encrypt the following plaintext: ‘zenith’ with a key of K=347. Sol.: ‘zenith’ contains three digraphs: ze; ni and th. ‘th’ encryption : Using the same method described previously, the ciphertext digraph for ‘th’ is ‘GQ’. So, using a Caesar cipher with digraph coding, ‘zenith’ is encrypted as ‘MNARGQ’ Arab Open University Can we further increase the key space?

21 4.1 Increasing the key space [9/9]
Activity 5.13: What key space is possible by encoding the letters as blocks of: (a) 3 (or trigraph)? (b) 5? (c) 10? Sol.: (a) a block of 3 (or trigraph) would result in 263 = possible keys. (b) a block of 5 would result in 265 = possible keys. (c) a block of 10 would result in 2610 = 1.41 x 1014 (to 2 decimal places) possible keys. Arab Open University

22 Session Outline Part 5: Encryption Breaking a Cipher
Building Stronger Ciphers Increasing the Key Space Weakening the linguistic association An unbreakable cipher Building Blocks of modern encryption systems Arab Open University

23 4.2 Weakening the linguistic association [1/5]
The Caesar cipher uses a monoalphabetic substitution. The key remains constant For example, the plaintext letter ‘e’ will always be encrypted as the same ciphertext symbol. The ciphertext inherits the linguistic patterns of the plaintext The ciphertext is susceptible to letter frequency and other linguistic analysis! How to decouple from the linguistic patterns of the plaintext? One way to do so is to encrypt with a cipher that uses a succession of different keys. The Vigenère cipher provides an example of how this can be achieved. Arab Open University

24 4.2 Weakening the linguistic association [2/5]
The Vigenère cipher uses a key known as a running key, which is generated by a keyword. Example: Use the Vigenère cipher with the keyword ‘jupiter’ to encrypt the following sentence: “A stitch in time saves nine” Solution: Using the convention of assigning a numerical value to each letter, ‘jupiter’ would produce a key sequence of 9, 20, 15, 8, 19, 4, 17. This provides a succession of different keys that can be used over and over again in the same sequence. Each symbol in the plaintext is encrypted using the next key in the sequence. Arab Open University

25 4.2 Weakening the linguistic association [3/5]
Example: Use the Vigenère cipher with the keyword ‘jupiter’ to encrypt the following sentence: “A stitch in time saves nine Solution: The following Caesar Cipher’s formula is used to determine the numerical code of the ciphertext of each letter: c ≡ p + K mod 26 Where K takes sequentially the following values : {9, 20, 15, 8, 19, 4, 17} Arab Open University

26 4.2 Weakening the linguistic association [4/5]
Weakness of a Vigenère cipher: Where similar letters appear at distances corresponding to the keyword length, their ciphertext letters will match each other! For example, the letter pair ‘ti‘ in the plaintext word ‘stitch’ and the letter pair ‘ti’ in ‘time’ are both encrypted as ‘IQ’. Arab Open University 7 steps = keyword length

27 4.2 Weakening the linguistic association [5/5]
Weakness of a Vigenère cipher: Given a large enough sample of ciphertext the probability of such an issue to appear increases A cryptanalyst can hence determine the length of the running key ‘n’ Every nth symbol can then be treated and analyzed as one strand The cipher can then be easily solved! Arab Open University Solution?

28 Session Outline Part 5: Encryption Breaking a Cipher
Building Stronger Ciphers Increasing the Key Space Weakening the linguistic association An unbreakable cipher Building Blocks of modern encryption systems Arab Open University

29 4.3 An unbreakable cipher [1/2]
The idea is to use a key that is identical in length to the plaintext, and to use it only once. Encryption based on this method is known as one-time pad encryption. A One Time Pad Encryption: A random key – the pad – is generated that is at least as long as the plaintext message Two copies of the pad are required one is used by the sender to encrypt the message. one is used by the recipient to decrypt the message. Once it has been used both copies must be destroyed. Arab Open University

30 4.3 An unbreakable cipher [2/2]
The random nature of the pad (key) means that: The ciphertext has no linguistic association with the original plaintext The ciphertext cannot be broken by analysis or brute force. When properly applied, the one-time pad is the only known truly unbreakable cipher. One-time pads have been successfully used in the past, mostly for high-level diplomatic exchanges. But a one-time pad is not a practical cipher for use in modern communication technologies. Arab Open University Example of a one time pad (wikimedia commons, 2009)

31 Session Outline Part 5: Encryption Breaking a Cipher
Building Stronger Ciphers Building Blocks of modern encryption systems Introduction Block Ciphers Stream Ciphers Symmetric Key System Arab Open University

32 5. Building blocks of modern encryption systems [1/4]
The ciphers discussed in the preceding sections were developed to protect the privacy of text-based communications. These were usually written on paper or, in later years, transmitted by wireless telegraphy. Many profound changes have occurred in the last few decades in the technologies we use to communicate, store and process data. The old encryption methods are no longer practical The old encryption methods cannot provide the level of protection needed today. Arab Open University

33 5. Building blocks of modern encryption systems [2/4]
Modern encryption systems are classified according to some general characteristics: They are block ciphers or stream ciphers? They use symmetric or asymmetric key systems? All are based on complex mathematical algorithms that rely on powerful processing capabilities. These processes are generally implemented by operating at the bit level in the plaintext input, either: physically in hardware using electronic devices known as logic gates, or in software programming using computational logic. A key point to bear in mind here is that the data to be encrypted is not always text. Though, the ‘ciphertext’ and ‘plaintext’ notations are commonly used when encryption is discussed. Arab Open University

34 5. Building blocks of modern encryption systems [3/4]
Encryption frequently involves an operation known as the exclusive-or (XOR). The exclusive-or (XOR) takes two binary input bits and combines them to form an output bit. XOR is a logical operation, its truth table is given below: Arab Open University Truth table of an XOR operation

35 5. Building blocks of modern encryption systems [4/4]
Example: What would be the output of combining the 7-bit ASCII code for the letter ‘N’ (‘ ’) with the randomly generated coding data using the XOR process. Solution: What if we XOR the same random coding data with the output data? The result is the original data stream! Arab Open University

36 Session Outline Part 5: Encryption Breaking a Cipher
Building Stronger Ciphers Building Blocks of modern encryption systems Introduction Block Ciphers Stream Ciphers Symmetric Key System Arab Open University

37 5.1 Block ciphers [1/9] A block cipher breaks the plaintext into equal-sized blocks, usually of 64 or 128 bits, and encrypts each block separately to produce a ciphertext output exactly equal in length to the input. The next figure shows a simplified version for blocks of 8 bits. For plaintext inputs smaller than the block size: the empty spaces are padded with recognisable additional bits Those additional bits are stripped off during the decryption process. Arab Open University

38 5.1 Block ciphers [2/9] Arab Open University

39 5.1 Block ciphers [3/9] There are two basic approaches to block encryption: One is to encrypt each block independently of any other, The other is to encrypt each block so that its output ciphertext is dependent on the output of the previous block. Electronic Codebook (ECB): An independent encryption approach Arab Open University

40 5.1 Block ciphers [4/9] Electronic Codebook (ECB):
The same key will be used for each block. The encryption of each block is completely independent from the other blocks. Drawbacks of ECB: Two similar blocks of plaintext will result in similar blocks of ciphertext Since the position of the ciphertext blocks remains fixed relative to the plaintext blocks this introduces a vulnerability. ECB is not practical when data involves long repetitive strings of 1s and 0s, such as a picture data. Arab Open University

41 5.1 Block ciphers [5/9] Example: Consider the below penguin picture
The white color background pixels are all coded with the same binary number. Hence, the picture file involves long repetitive strings of 1s and 0s When coded with ECB, the data pattern in the plaintext can still be clearly discerned in the ciphertext. Arab Open University

42 5.1 Block ciphers [6/9] Cipher-block chaining (CBC): A dependent encryption approach Arab Open University

43 5.1 Block ciphers [7/9] Cipher-block chaining (CBC): An XOR process is used to combine the ciphertext output from one block with the plaintext input of the following block. Every ciphertext block is dependent on the ciphertext output from the preceding block as well as its own plaintext input An encryption of identical input blocks will produce different results. CBC mode requires an additional extra input, known as an initialisation vector (IV), to the first block. The initialisation vector (IV) is a pseudo-random binary sequence that is used in the XOR process for the first block only. Arab Open University What is the ciphertext of the previous penguin picture when encrypted with a CBC technique?

44 Penguin image of Figure 5.20, encrypted in CBC mode (Wikipedia, 2009)
5.1 Block ciphers [8/9] Penguin image of Figure 5.20, encrypted in CBC mode (Wikipedia, 2009) Arab Open University

45 5.1 Block ciphers [9/9] Drawbacks of CBC:
A single encryption error in one block is cascaded through to the following blocks. The decryption relies on knowledge of the previous block. Any error or loss of data in the previous block prevents that block and all following blocks from being decrypted! Arab Open University

46 Session Outline Part 5: Encryption Breaking a Cipher
Building Stronger Ciphers Building Blocks of modern encryption systems Introduction Block Ciphers Stream Ciphers Symmetric Key System Arab Open University

47 5.2 Stream ciphers [1/2] Unlike Block Ciphers, Stream ciphers operate on very small segments of data – usually at the bit level Whereas block ciphers have to wait to receive the whole block before they can start encrypting, stream ciphers can encrypt ‘on the fly’ one bit (or sometimes one byte) at a time. Stream ciphers use a short key that acts as a ‘seed’ to generate a much longer, apparently random, key stream. The key stream is then combined (usually by an XOR process) with the plaintext to produce ciphertext. Arab Open University

48 5.2 Stream ciphers [2/2] Decryption is also carried out ‘on the fly’ and using the same key stream as the encryption process. The sender and the receiver must be synchronised to ensure that the same key is used on each individual bit (or byte) of data. Stream ciphers are generally faster than block ciphers, and are less complex to implement in hardware. They are often used where the input stream length is unpredictable (such as in telecommunications). the input buffering is limited. Buffering means temporarily storing bits, as would be needed in block ciphers where the process has to wait until all the bits in the block have been received. Stream ciphers can be vulnerable if used incorrectly For example, if the input key is used more than once. Arab Open University

49 Session Outline Part 5: Encryption Breaking a Cipher
Building Stronger Ciphers Building Blocks of modern encryption systems Introduction Block Ciphers Stream Ciphers Symmetric Key System Arab Open University

50 5.3 Symmetric key systems [1/4]
In a symmetric key system: Encryption and decryption are performed using a single key or, two keys that are so closely related to each other mathematically. The inherent problem with all single key systems is secure key distribution. To protect a message, it could be encrypted using a private symmetric key and then sent over an insecure channel. But to decrypt the message the recipient must have a copy of the private key! Arab Open University How to distribute a private key over the same insecure channel?

51 5.3 Symmetric key systems [2/4]
If the shared key is sent over the same insecure channel it could be intercepted by an eavesdropper and copied. if the same eavesdropper previously intercepted the encrypted message, he can easily decrypt it using his copy of the shared key. A general solution to this, known as the double-locking protocol This protocol involves a three-way exchange before both parties (sender and recipient) are in possession of a secret shared key. The Diffie-Hellman key exchange protocol is a well-known protocol that is commonly used in modern electronic transactions. This protocol mathematically performs the same service as double-locking protocol. Arab Open University

52 5.3 Symmetric key systems [3/4]
Double-locking protocol: Suppose that you and I need to exchange an encryption key: We need a box and we each need a padlock. I put the encryption key in the box, lock the box with my padlock and send it to you over the insecure channel. The encryption key is safe because the box is locked with my padlock and I am the only one with the padlock key. Of course, when you receive the box you can’t unlock it either! Instead you lock the box with your own padlock and return it tome over the same insecure channel. The box is now double locked with your padlock and with mine. When I receive it, I unlock and remove my padlock and return the box to you. The encryption key is still safe because it is locked with your padlock, and you are the only one with your padlock key. On receipt, you unlock your padlock, open the box and retrieve the encryption key. Arab Open University

53 5.3 Symmetric key systems [4/4]
Arab Open University 1. Alice encrypts the message with her key and sends it to Bob 2. Bob encrypts the message he received with his key and sends it to Alice 3. Alice decrypts the message she received with her key and sends it to Bob Bob decrypts the message he received with his key and reads the message

54 Is there any other solution. Yes
Is there any other solution? Yes! An Asymmetric Key System To be discussed next week! Arab Open University


Download ppt "T215B Communication and information technologies (II) Session 4"

Similar presentations


Ads by Google