Upload
ada-bailey
View
220
Download
0
Embed Size (px)
Citation preview
1Chapter 2
Plain Text
• Also called as clear text
• Language that we normally use
• Easily understood by everybody
2Chapter 2
Plain text in other forms
• Digitalized form (ASCII or BIG-5 coded)– 0100 0001 A 0110 0001 a 00110000 0– 0100 0010 B 0110 0010 b
00110001 1
• Telegram form (Morse Code) — A — — — — 1 — B — — — 2SOS — — —
3Chapter 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
4Chapter 2
Techniques for Plain Text to Cipher Text Conversion
Fig 2.5
Transforming a plain text message into cipher text
Substitution techniques Transposition techniques
5Chapter 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.
6Chapter 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
7Chapter 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
8Chapter 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 fineCipher text: Krsh brx duh grlqj ilqh
9Chapter 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
10Chapter 2
Algorithm to Decrypt Caesar Cipher(解密 )
Fig 2.6
1. 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.
11Chapter 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.
12Chapter 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., 4x1026) times
13Chapter 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
14Chapter 2
How to break Mono-alphabetic Cipher
• Brute-force: need (26 x 25x24…x2, i.e., 4x1026) times
• Others:….
15Chapter 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)
16Chapter 2
Polygram Substitution Cipher
Fig 2.10
HELLO YUQQWPolygram Substitution
HELL TEUIPolygram Substitution
17Chapter 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,
20Chapter 2
Rail Fence Technique
• An example of transposition cipher
• Method:– Write plain text as sequence of diagonals– Read text as sequence of columns
21Chapter 2
Rail Fence Technique
Fig 2.11
1. 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.
22Chapter 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
23Chapter 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.
25Chapter 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 1.
4. Repeat steps 1 to 3 as many times as desired.
27Chapter 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.
28Chapter 2
Vernam Cipher
Fig 2.17
1. Treat each plain text alphabet as a number in an increasing sequence, i.e. A = 0, B = 1, … Z = 25.
2. 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.
30Chapter 2
Encryption and Decryption
• Encryption– Conversion of Plain Text to Cipher Text
• Decryption– Conversion of Cipher Text to Plain Text
31Chapter 2
Encryption and Decryption
Fig 2.19, 2.20
Hello John Ifmmp Kpio
EncryptPlain text Cipher text
Hello JohnIfmmp Kpio
Decrypt Plain textCipher text
34Chapter 2
Aspects of Encryption and Decryption
Fig 2.22
Inputs to encryption and decryption processes
Algorithm Key
35Chapter 2
Types of Cryptography
Fig 2.23
Cryptography techniques
Symmetric key cryptography
Asymmetric key cryptography
36Chapter 2
M
key
encryption
key
decryptionMC CInternet
Sender(Alice) receiver(Bob)
Symmetric key: sender’s key = receiver’s keyAsymmetric key: sender’s key receiver’s key (two keys are related)
Concept:
One key system Two key system
37Chapter 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
39Chapter 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 KeyAlice-KDC and KDC send back to both Alice and Bob the KeyAlice-
Bob encrypted with KeyAlice-KDC and KeyBob-KDC. .
40Chapter 2
KDC
Alice
Bob
2. (O.K.//KeyAlice-Bob )
Alice-KDC
1. (request)Alice-KDC
3. (Alic
e ask you.//K
ey Alice-B
ob) Bob-K
DC
41Chapter 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
42Chapter 2
Diffie-Hellman Key Exchange
Fig 2.27
1. 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 = gx 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 = gy mod n
5. Bob sends the number B to Alice.
6. A now computes the secret key K1 as follows:K1 = Bx mod n
7. B now computes the secret key K2 as follows:K2 = Ay mod n
43Chapter 2
Example of DH key exchange• Alice and Bob agree on two numbers n=11
and g=7• Alice chooses x=3,
– calculates A=gx mod 11 – send A to Bob
• Bob chooses y=6,– calculates B=gx mod 11 – send B to Alice
• Alice get B from Bob – Calculate Bx mod 11
44Chapter 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.
45Chapter 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
46Chapter 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
47Chapter 2
Key Range
Fig 2.38
A 2-bit binary number has four possible states:00011011
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:000001010011100101110111
In general, if an n bit binary number has k possible states, an n+1 bit binary number will have 2k possible states.
49Chapter 2
Key Sizes and Range
Fig 2.40
Key size = 40 bits
00 00 00 00 0000 00 00 00 01
…FF FF FF FF FF
Key size = 64 bits
00 00 00 00 00 00 00 0000 00 00 00 00 00 00 01
…FF FF FF FF FF FF FF FF
Key size = 128 bits
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
…FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF