1 Chapter 2 Plain Text Also called as clear text Language that we normally use Easily understood by everybody
2 Chapter 2 Plain text in other forms Digitalized form (ASCII or BIG-5 coded) – A a – B b Telegram form (Morse Code) — A — — — — 1 — B — — — 2 SOS — — —
3 Chapter 2 Example of Plain Text Message Fig 2.1 Hi Amit, Hope you are doing fine. How about meeting at the train station this Friday at 5 pm? Please let me know if it is ok with you. Regards. Atul
4 Chapter 2 Techniques for Plain Text to Cipher Text Conversion Fig 2.5 Transforming a plain text message into cipher text Substitution techniques Transposition techniques
5 Chapter 2 Caesar Cipher Invented by Julius Caesar (Gallic Wars), 46 BC Replaces each alphabet with the one three places down (shift by 3) Example: Replace each A with D, B with E, etc.
6 Chapter 2 Caesar Cipher Fig 2.2 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
7 Chapter 2 Plain Text and Cipher Text Plain Text: Language that can be easily understood Cipher Text: Language that cannot be understood (Encrypted message) To achieve security, plain text is transformed into cipher text
8 Chapter 2 Algorithm to Encrypt Caesar Cipher( 加密 ) 1. Read each alphabet in the plain text, and plus the alphabet order by k=3 2. Repeat the process for all alphabets in the plain text message. And print out. E.g., Plain text: Hope you are doing fine Cipher text: Krsh brx duh grlqj ilqh
9 Chapter 2 Plain Text and Cipher Text Fig 2.4 Hi Amit, Hope you are doing fine. How about meeting at the train station this Friday at 5 pm? Please let me know if it is ok with you. Regards. Atul Kl Dplw, Krsh brx duh grlqj ilqh. Krz derxw phhwlqj dw wkh wudlq vwdwlrq wklv Iulgdb dw 5 sp? Sohdvh ohw ph nqrz li lw lv rn zlwk brx. Uhjdugv. Dwxo Plain text message Corresponding cipher text message
10 Chapter 2 Algorithm to Decrypt Caesar Cipher( 解密 ) Fig Read each alphabet in the cipher text message, and minus the alphabet order by k=3 2. Repeat the process for all alphabets in the cipher text message.
11 Chapter 2 Modified Version of Caesar Cipher In stead of A replaced by D, they can be replaced by other number of shifting. Assume a shift number K is known by encrypter and decrypter, Both use K value as the Key to encrypt/decrypt the message. However, if attacker find the cipher text, KWUM PMZN, what can he do to break the cipher.
12 Chapter 2 Mono-alphabetic Cipher Characters Order among the substitution in the Caesar Cipher is broken. Each character can be replaced by any other alphabet. E.g., A can be replaced by (A through Z),… Brute-force need (26 x 25x24…x2, i.e., 4x10 26 ) times
13 Chapter 2 One example Homework : Algorithms to encrypt/encrypt the message 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 VA G H I J K L M N O P Q R S T U E W X Y Z FB C
14 Chapter 2 How to break Mono-alphabetic Cipher Brute-force: need (26 x 25x24…x2, i.e., 4x10 26 ) times Others:….
15 Chapter 2 Polygram Substitution Cipher Block of plain text transformed into block of cipher text Similar text patterns can yield completely different cipher text patterns Block-by-block replacement (Word by word)
16 Chapter 2 Polygram Substitution Cipher Fig 2.10 HELLO YUQQW Polygram Substitution HELL TEUI Polygram Substitution
17 Chapter 2 Poly_alphabetic substitution cipher Vigenere Cipher is one of this type. Vigenere Cipher assume a Table called Vigenere Table Encryption: first define a key, read the plain text character one by one, mapping the read_in character and the corresponding key character by using the Vigenere Table,
18 Chapter 2 Encryption: Key:CRYTOGRAPHY Plaintext: STRIKEWHILETHEIRONISHOT
19 Chapter 2 The Vigenere Table
20 Chapter 2 Rail Fence Technique An example of transposition cipher Method: –Write plain text as sequence of diagonals –Read text as sequence of columns
21 Chapter 2 Rail Fence Technique Fig Write down the plain text message as a sequence of diagonals. 2. Read the plain text written in step 1 as a sequence of rows.
22 Chapter 2 Simple Columnar Transposition Concept: write text as row by row and then read the text column by column The read out Result is cipher text
23 Chapter 2 Simple Columnar Transposition Technique 1. Write the plain text message row-by-row in a rectangle of a pre-defined size. 2. Read the message column-by-column. However, it need not be in the order of columns 1, 2, 3 etc. It can be any random order such as 2, 3, 1, etc. 3. The message thus obtained is the cipher text message.
24 Chapter 2 Example
25 Chapter 2 Simple Columnar Transposition Technique with Multiple Rounds 1. Write the plain text message row-by-row in a rectangle of a pre- defined size. 2. Read the message column-by-column. However, it need not be in the order of columns 1, 2, 3 etc. It can be any random order such as 2, 3, 1, etc. 3. The message thus obtained is the cipher text message of round Repeat steps 1 to 3 as many times as desired.
26 Chapter 2 Fig 2.15
27 Chapter 2 Vernam Cipher Widely used Cipher: (mainly used on substitution) In usage: key length is longer than the message length. And the key is used one day and one time. So the key is called One Time Pad Basically is a modification to the Vigenere Cipher A piece of the Key is a number instead of character in Vigenere. And Modular operation is used on to number instead of table lookup in the vigenere table.
28 Chapter 2 Vernam Cipher Fig Treat each plain text alphabet as a number in an increasing sequence, i.e. A = 0, B = 1, … Z = Do the same for each character of the input cipher text. 3. Add each number corresponding to the plain text alphabet to the corresponding input cipher text alphabet number. 4. If the sum thus produced is greater than 26, subtract 26 from it. 5. Translate each number of the sum back to the corresponding alphabet. This gives the output cipher text.
29 Chapter 2 example
30 Chapter 2 Encryption and Decryption Encryption –Conversion of Plain Text to Cipher Text Decryption –Conversion of Cipher Text to Plain Text
31 Chapter 2 Encryption and Decryption Fig 2.19, 2.20 Hello John Ifmmp Kpio EncryptPlain textCipher text Hello John Ifmmp Kpio DecryptPlain text Cipher text
32 Chapter 2 Real world communication
33 Chapter 2 Encryption and Decryption Two aspects related to this process: –Algorithm –Key
34 Chapter 2 Aspects of Encryption and Decryption Fig 2.22 Inputs to encryption and decryption processes Algorithm Key
35 Chapter 2 Types of Cryptography Fig 2.23 Cryptography techniques Symmetric key cryptography Asymmetric key cryptography
36 Chapter 2 M key encryption key decryption M C C Internet Sender(Alice)receiver(Bob) Symmetric key: sender’s key = receiver’s key Asymmetric key: sender’s key receiver’s key (two keys are related) Concept: One key systemTwo key system
37 Chapter 2 Problems with symmetric key system Four main security functions? –Confidential, authentication, integrity, non- replication Keys among group users Key distribution –Key distribution center (KDC) –Diffie-Hellman key exchange
38 Chapter 2 Keys among group users
39 Chapter 2 Key distribution center (KDC) One centerized KDC which in charge of key distribution among group of users. Each user has one unique key between KDC and HE. If user Alice want to talk to user Bob, Alice send a request to KDC encrypted with Key Alice-KDC and KDC send back to both Alice and Bob the Key Alice-Bob encrypted with Key Alice-KDC and Key Bob-KDC..
40 Chapter 2 KDC Alice Bob 2. (O.K.//Key Alice-Bob ) Alice-KDC 1. (request) Alice-KDC 3. (Alice ask you.//Key Alice-Bob ) Bob-KDC
41 Chapter 2 Diffie-Hellman Key Exchange Solves the problem of Key Exchange Alice and Bob can decide upon a key without meeting No secrets are exchanged, and yet a secret key can be agreed upon
42 Chapter 2 Diffie-Hellman Key Exchange Fig Firstly, Alice and Bob agree on two large prime numbers, n and g. These two integers need not be kept secret. Alice and Bob can use an insecure channel to agree on them. 2. Alice chooses another large random number x, and calculates A such that: A = g x mod n 3. Alice sends the number A to Bob. 4. Bob independently chooses another large random integer y and calculates B such that: B = g y mod n 5. Bob sends the number B to Alice. 6. A now computes the secret key K1 as follows: K1 = B x mod n 7. B now computes the secret key K2 as follows: K2 = A y mod n
43 Chapter 2 Example of DH key exchange Alice and Bob agree on two numbers n=11 and g=7 Alice chooses x=3, – calculates A=g x mod 11 – send A to Bob Bob chooses y=6, – calculates B=g x mod 11 – send B to Alice Alice get B from Bob –Calculate B x mod 11
44 Chapter 2 Brute Force Attack Attacker tries all possible keys one by one Can be successful if key length is small Start with Key = 0, then Key = 1, etc.
45 Chapter 2 Brute Force Attack Fig 2.37 Cipher text R$9O0-=-P;. Decrypt Try with key = 0 Plain text V^510->o2 Cipher text R$9O0-=-P;. Decrypt Try with key = 1 Plain text 7/5vc_=;a1 Cipher text R$9O0-=-P;. Decrypt Try with key = 90,171,451,191 Plain text To: Payroll
46 Chapter 2 Key Range Specifies the number of possible keys Bigger the key range, more difficult is the attack In practice, at least 64, 128, 256 bit keys are used
47 Chapter 2 Key Range Fig 2.38 A 2-bit binary number has four possible states: If we have one more bit to make it a 3-bit binary number, the number of possible states also doubles to eight, as follows: In general, if an n bit binary number has k possible states, an n+1 bit binary number will have 2k possible states.
48 Chapter 2
49 Chapter 2 Key Sizes and Range Fig 2.40 Key size = 40 bits … FF FF FF FF FF Key size = 64 bits … FF FF FF FF Key size = 128 bits … FF FF FF FF FF FF FF FF