Classical-Encryption-Techniques

advertisement
CLASSICAL ENCRYPTION
TECHNIQUES
www.applebuz.com
Encryption Techniques
• Symmetric Encryption
- Substitution Cipher
- Transposition Cipher
• Asymmetric Encryption
- RSA Cipher
www.applebuz.com
Basic Terminology
Encryption: Process of encoding a message so that its meaning
is not obvious.
Decryption: The reverse process of Encryption.
Transforming an encrypted message into its normal,
plaintext form.
Cryptosystem: A system for Encryption and Decryption.
• plaintext
• cipher text
• cipher
• key
- the original message
- the coded message
- algorithm for transforming plaintext to cipher text
- info used in cipher known only to sender/receiver
www.applebuz.com
Symmetric Encryption
 use the same (secret) key to encrypt and decrypt
a message( i.e. sender and recipient share a
common key )
 All classical encryption algorithms are private-key
Symmetric Encryption also called as conventional
/ private-key / single-key Encryption Techniques
www.applebuz.com
Cryptanalysis
•Cryptanalysis is the process of trying to find the
plaintext or key
•Two main approaches
– Brute Force ( try all possible keys)
– Exploit weaknesses in the algorithm or key
( e.g. key generated from password entered by
user, where user can enter bad password )
www.applebuz.com
Cryptanalysis: Types of Attack
• Cipher text only
– Just have cipher text to be decoded
• Known plaintext
– Also have one or more plaintext-cipher text pairs
• Chosen plaintext
– Cryptanalyst can choose plaintext and get corresponding
Cipher text
• Chosen cipher text
– Cryptanalyst can choose cipher text and get corresponding
plaintext
• Chosen text
– Combination of chosen plaintext and chosen cipher text
www.applebuz.com
Cryptanalysis: Brute Force Attack
(Exhaustive Search)
• Try all possible keys until code is broken
• On average, need to try half of all possible keys
• Infeasible if key length is sufficiently long
Key size No of Keys Time required at 1
Time required at 106
(bits)
encryptions per ?
s encryption per ? s
32
4.3 x 109
36 minutes
2 milliseconds
56
7.2 x 1016
1142 years
10 hours
128
3.4 x 1038
5.4 x 1024 years
5.4 x 1018 years
168
3.7 x 1050
5.9 x 1036 years
5.9 x 1030 years
Age of universe: 1010 years
Note: DES has a 56 bit key; AES key has 128+ bits
www.applebuz.com
Classical Encryption
Techniques
 Substitution techniques
The letters of the message are replaced by
other letters or by numbers or symbols.
 Transposition techniques
Performing some sort of permutation on the
messages letters
www.applebuz.com
More Definitions
• unconditional security
– no matter how much computer power is
available, the cipher cannot be broken since the
cipher text provides insufficient information to uniquely
determine the corresponding plaintext.
• computational security
– given limited computing resources (e.g. time
needed for calculations is greater than age of
universe), the cipher cannot be broken
www.applebuz.com
Substitution Ciphers
• where letters of plaintext are replaced by other
letters or by numbers or symbols
• if plaintext is viewed as a sequence of bits, then
substitution involves replacing plaintext bit
patterns with cipher text bit patterns
www.applebuz.com
Caesar Cipher
The caesar Cipher earliest known substitution
cipher, developed by Julius Caesar
• First attested use in military affairs
• Replaces each letter by 3rd letter.
Example
Text
: HELLO WORLD
Key
: Shift each ASCII character right by 3
Encrypted text: KHOOR#ZRUOG
To Decrypt
: Shift each character left by 3
www.applebuz.com
Caesar Cipher
• can define transformation as:
a bc de fghi j k l mn o pq r s t u vwxy z
DEFGHIJKLMNOPQRSTUVWXYZABC
• mathematically give each letter a number
abcdef gh i j k l m
0 1 2 3 4 5 6 7 8 9 10 11 12
n o p q r s t u v w x y Z
13 14 15 16 17 18 19 20 21 22 23 24 25
• then have Caesar cipher as:
C = E(p) = (p + k) mod (26)
p = D(C) = (C – k) mod (26)
www.applebuz.com
Attacking Caesar Cipher
Brute force
– Key is just one letter (or number between 1 and 25)
– Try all 25 keys
– Easy!
www.applebuz.com
One-Time Pad
• Unbreakable substitution cipher
• Uses random key that is as long as the message
• Can use key only once
www.applebuz.com
Mono alphabetic Cipher
• Use any permutation of the 26 alphabetic characters
abcdefghijklmnopqrstuvwxyz
qeryuiopasdfgwhjklzxcvbnmt
Example :
Plain text :under attack we need help
Cipher text :cwyul qxxqrd bu wuuy pufj
www.applebuz.com
Attacking Mono alphabetic
substitution
Brute force
– Very difficult; Key is 26 letters long
– No. of possible keys = 26! = 4 x 1026
• Algorithm weaknesses:
– Frequency of letters in English language is well known
• Can deduce plaintext->cipher text mapping by analyzing
frequency of occurrence
• e.g. on analyzing plenty of cipher text, most frequent letter
probably corresponds to ‘E’
– Can spot diagrams and trigrams
• Diagram: common 2-letter sequence; e.g. ‘th’, ‘an’, ‘ed’
• Trigram: common 3-letter sequence: e.g. ‘ing’, ‘the’, ‘est’
www.applebuz.com
Frequency of Letters in English
14
12.75
12
10
9.25
8.5
8
7.75
7.75
7.75 7.5
6
6
4.25
4
2
3.5
3.75
3.5
3
2.75
3
2.75
2
2.25
1.5 1.5
1.25
0.25 0.5
0.5
0.5
0.25
0
A B C D E F GH I J K L MN O P Q R S T U VWX Y Z
www.applebuz.com
Poly alphabetic Cipher
• Using different mono alphabetic substitution
message: wearediscoveredsaveyourself
key: deceptivedeceptivedeceptive
Ciphertext: ZICVTWQNGRZGVTWAVZHCQYGLMGJ
www.applebuz.com
Transposition Ciphers
• Classical Transposition or permutation
ciphers
• These hide the message by re arranging
the letter order without altering the actual
letters used.
• can recognize these since have the same
frequency distribution as the original text
www.applebuz.com
Rail Fence cipher
• Write message letters out diagonally over a
number of rows
• Then read off cipher row by row
• e.g.. Message : “ATTACK AT MIDNIGHT”
write message out as:
A T C A M D I H
T A K T I NG T
• Cipher text is
ATCAMDIHTAKTINGT
www.applebuz.com
Row Transposition Ciphers
• A more complex scheme
• 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 word
: NETWORK
Message
: ATTACKISPOSTPONED
N E T W O R K
Key
:3 1 6 7 4 5 2
Plaintext
:A T T A C K I
S P O S T P O
N E D A B C D
Cipher text: TPEIODASNCTBKPCTODASA
www.applebuz.com
Product Ciphers
• 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
• this is bridge from classical to modern ciphers
www.applebuz.com
Download