CMPE 471 BASIC ENCRYPTION AND DECRYPTION. TERMINOLOGY & BACKGROUND S R S T RT O O Suppose S (Sender)...
-
Upload
lesley-leonard -
Category
Documents
-
view
216 -
download
0
Transcript of CMPE 471 BASIC ENCRYPTION AND DECRYPTION. TERMINOLOGY & BACKGROUND S R S T RT O O Suppose S (Sender)...
CMPE 471
BASIC ENCRYPTION AND DECRYPTION
TERMINOLOGY & BACKGROUND
Suppose SS (Sender) wants to send a message to RR (Reciever). SS entrusts the message to TT, who will deliver it to RR; T T then becomes the transmission medium. If an outsider, OO, wants the message and tries to access it, we will call OO an interceptor or intruder.
TERMINOLOGY & BACKGROUND
• Any time after S S transmits via TT, the message is exposed, so O O might try to access the message:– Block it, by preventing it to reach to RR: availability
– Intercept it, by reading or listening to the message: secrecy
– Modify it, by seizing the message and changing it: integrity
– Fabricate an authentic looking message, arranging as if it came from SS: integrity.
TERMINOLOGY & BACKGROUND
• Encryption (encode/ encipher):Encryption (encode/ encipher):– Process of encoding a message so that its meaning is not so
obvious.
• Decryption (decode/ decipher):Decryption (decode/ decipher):– Is the reverse process: transforming an encrypted message back
into its normal form.
• Cryptosystem:Cryptosystem:– A system for encryption and decryption
• Plaintext: Plaintext: – The original form of the message
• Ciphertext:Ciphertext:– The encrypted form of the message.
TERMINOLOGY & BACKGROUND
• Encryption Algorithms:Encryption Algorithms:Some encryption algorithms use a key K, so that the ciphertext message
depends on both the original plaintext message and the key valueC = E(K,P)
E is a set of encryption algorithms, and the key K selects one specific algorithm.
Sometimes the encryption and decryption keys are the same; P = D(K, E(K,P)). This is called symmetric encryption since D and E are mirror-image processes.
Other times encryption and decryption keys come in pairs. Then a decryption key K inverts the encryption of key K so that P = D(K , E(K ,P)). Encryption algorithms of this form are called asymmetric, because converting C back to P is not just reversing the steps of E.
D
E D E
ENCRYPTION ALGORITHMS
PlaintextEncryption
CiphertextDecryption
OriginalPlaintext
ENCRYPTIONENCRYPTION
ENCRYPTION ALGORITHMS
PlaintextEncryption
CiphertextDecryption
OriginalPlaintext
Key
Symmetric Cryptosystem
PlaintextEncryption
CiphertextDecryption
OriginalPlaintext
Encryption KeyK
E
Encryption KeyK
D
Asymmetric Cryptosystem
ENCRYPTION ALGORITHMS
• Cryptograpghy:Cryptograpghy:– Hidden writing, the practice of using encryption to
conceal text.
• Cryptanalyst:Cryptanalyst:– Studies encryption and encrypted messages, with the
goal of finding the hidden meanings of the messages.
• Cryptology:Cryptology:– Is the research into and study of encryption and
decryption; it includes both cryptography and cryptanalysis.
ENCRYPTION ALGORITHMS
• Substitution:Substitution:– One letter is exchanged for another
• Transposition:Transposition:– The order of the letters is rearranged
MONOALPHABETIC CIPHERS (SUBSTITUTIONS)
• The Caesar Cipher:The Caesar Cipher:– Named after Julius Caeser. Each letter is translated to the
letter a fixed number of letters after it in the alphabet. Caesar used to shift 3, so that plaintext letter p was enciphered as ciphertext letter c by the rule
c = E(p ) = p +3
Plaintext A B C D E F G H I J K L M N O P Q R S T U V W Y Z
Chiphertext d e f g h i j k l m n o p q r s t u v w y z a b c
i
i
i i i
MONOALPHABETIC CIPHERS (SUBSTITUTIONS)
Using this encryption encode the below message
TREATY IMPOSSIBLE
Would be encoded as
TREATY IMPOSSIBLE
wu hd wb l p s r vv le o h
MONOALPHABETIC CIPHERS (SUBSTITUTIONS)
The pattern p + 3 is easy to memorise and it is a simple cipher.
That obvious pattern is also the major weakness of the Ceasar cipher.
A secure encryption should not allow an interceptor to use a little piece to predict the entire pattern of the encryption.
i
EXERCISE I
• Please decipher the following:
dh ey vdedk duded wdpluflvlqh jlwwlp vrqud eludc jhcphbh jlwwlp zh rnyod jhoglp eyudgd ghuvlp zdu
ANSWER
ben bu sabah araba tamircisine gittim sonra biraz gezmeye gittim ve okula geldim burada dersim var
EXERCISE II
• Please make the cryptanalysis of Caesar chipher.
ANSWER
• Suppose you were trying to break the following ciphertext message:Wklv phvvdjh lv qrw wrr kdug wr euhdn
• The message has been enciphered with a 27-symbol alphabet– Worst of all the blank has been translated to itself– It shows which are the small words– In encryption spaces between words often are deleted
under the assumption that a legitimate reciever can breakmostmessagesintowordsfairlyeasily.
ANSWER
• English has relatively few small words such as am, is, to, be, he, we, and, are, you, she...
• One attack is to substitute known short words at appropriate places in the ciphertext and try to substituting for matching characters other places in the ciphertext.
• A stronger clue is the repeated R in the word wrr: see, too, add, odd, off
ANSWER
• The cryptanalysis here is ad hoc– Uses deduction based on guesses instead of solid
principles.
• Another approach is to consider which letters commonly start words, which letters commonly end words, and which prefixes and suffixes are common.
Polyalphabetic Substitution Ciphers
• The weakness of monoalphabetic ciphers is that their frequency distribution reflects the distribution of the underlying alphabet.
• A cipher that is more cryptographicaly secure would display a rather flat distribution, which gives no information to cryptanalyst.
• One way to flatten the distribution is to combine distributions that are high with ones that are low:– If T is enciphered as a and b, and if X is also enciphered as a and b, the
high frequency of T mixes with the low frequency of X to produce a more moderate distribution for a and b.
Polyalphabetic Substitution Ciphers
• We can combine two distributions by using two separate encryption alphabets– All charaters in odd positions of the plaintext message
– All characters in even positions
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
a d g j m p s v y b e h k n q t w z c f i l o r u x
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
n s x c h m r w b g l q v a f k p u z e j o t y d i
Table for
odd positions
Table for
even positions
Polyalphabetic Substitution Ciphers
• The first table uses the permutation∏ı(λ) = (3*λ) mod 26
• The second uses the permutation∏2(λ) = ((5*λ) + 13) mod 26
• Encryption with these tables would beTREATY IMPOSSIBLE
TREAT YIMPO SSIBL E
f u m nf dyvtf czysh h
Polyalphabetic Substitution Ciphers
• Notice that the double S becomes cz and that the two Es are enciphered as m and h
• Polyalphabetic encryption flattens the frequency distribution of the plaintext considerably.
EXERCISE 3
• Please make the cryptanalysis of polyalphabetic substitutions
ANSWER
• With a little help from frequency distributions and letter patterns you can break monoalphabetic substitution by hand
• With the aid of computer programs and with an adequate amount of ciphertext, a good cryptanalyst can break such a cipher in an hour.
• In some applications the prospect of one day’s effort may not make sense and it may be enough to protect the message.
• There are two tools that can decrypt messages written even with a large number of alphabets– The Kasiski method for repeated patterns: the method relies on the regularity of
English. If a message is encoded with n alphabets in cyclic rotation, and if a particular word or letter group apperas k times in a plaintext message, it should be encoded approximately k/n times from the same alphabet.
– Index of Coincidence: to rate how well a particular distribution matches the distribution of letters in English. The index of coincidence is a measure of the variation between frequencies in a distribution.
Summary of Substitutions
• Substitutions are effective cryptographic devices used in diplomatic communications and appeared in the mysteries of– Arthur Conan Doyle, Allan Poe, Agatha Cristie...
• The presentation of substitution ciphers has also introduced several cryptoanalytic tools:– Frequency distribution– Index of coincidence– Consideration of highly likely letters and probable words– Repeated pattern analysis and the Kasiski approach– Persistence, organisation, ingenuity, and luck
Transpositions (Permutations)
• The goal of substitution is confusion, an attempt to make it difficult to determine how a message and key were transformed into ciphertext.
• A transposition is an encryption in which the letters of the message are rearranged.– The goal is diffusion, spreading the information from
the message or the key out widely across the ciphertext: permutation.
Transpositions (Permutations)
Cı C2 C3 C4 C5
C6 C7 C8 C9 C10
C11 C12 etc.
Cı C2 C3 C4 C5
C6 C7 C8 C9 C10
C11 C12 etc.
T H I S I
S A M E S
S A G E T
O S H O W
H O W A C
O L U M N
A R T R A
N S P O S
I T I O N
W O R K S
five-column transposition Plaintext message
Ciphertext is formed by traversing the columns
Transpositions (Permutations)
• The resulting ciphertext would then be read as
tssoh oaniw haaso lrsto imghw
utpir seeoa mrook istwc nasns
• The length of this message happened to be a multiple of five, so all columns came out the same length
• If the message length is not a multiple of the length of a row, the last columns will be a letter short.
Transpositions (Permutations)
Encipherment/ Decipherment Complexity• Involves no additional work beyond arranging the letters and
reading them off again.• The algorithm is constant in the amount of work per character,
and the time for the algorithm is proportional to the length of the message
• This algorithm requires storage for all characters of the message, so the space required is not constant but depends directly on the length of the message.
• Because of the storage space and the delay involved, it is not appropriate for long messages.
Transpositions (Permutations)
• Diagrams:Diagrams:– Characteristic patterns of pairs of adjacent letters.
– Such as –re, -th, -en, -ed, -on, -in, -an...
• Trigrams:Trigrams:– Groups of three letters in English
– Such as –ent, -ion, -ing, -ive, -for, -one...
EXERCISE 4
• Please make the cryptanalysis of transpositions
ANSWER
• The basic attack on columnar transpositions is not as precise as the attack on substitution ciphers.
• Transpositions look less secure since they leave the plaintext letters intact, the work for cryptanalyst is more exhausting, because it relies on a human judgement of what ‘looks right’.
• The process involves exhaustive comparison of strings of ciphertext.– Compares a block of ciphertext characters against
characters successively farther away in the ciphertext.
Fractionated Morse
• Morse Code:– Means of representing letters as sequences of dots and
dashes, used with telegraphs, and flashing lights.
A .- H .... O --- U ..-
B -... I .. P .--. V ...-
C -.-. J .--- Q --.- W .--
D -.. K -.- R .-. X -..-
E . L .-.. S ... Y -.--
F ..-. M -- T - Z --..
G --. N -.
Stream Ciphers
• They convert one symbol of plaintext immediately into a symbol of ciphertext (columnar transposition is the exception).
• The transformation depends only on the symbol, the key, and control information of the encipherment algorithm.
YPlaintext
ISSOPMI
Ciphertext
wdhuw...
Key(Optional)
Encryption
Stream Encryption
Stream Ciphers
• Advantages:Advantages:– Speed of transformation: each symbol is encrypted without
regard for any other plaintext symbols, each symbol can be encrypted as soon as it is read. Thus the time to encrypt each symbol depends only on the encryption algorithm itself, not on the time it takes to receive more plaintext.
– Low error propogation: since each symbol is separately encoded, an error in the encryption process affects only that character.
Stream Ciphers
• Disadvantages:Disadvantages:– Low diffusion:each symbol is separately enciphered. Therefore, all the
information of that symbol is contained in one symbol of the ciphertext. A cryptanalyst can attempt to break it by analaysing the characteristics of all individual symbols of the ciphertext, using tools such as frequency distribution counts, Kasiski method, etc.
– Susceptibility to malicious insertions and modifications: because each symbol is separately encipherde, an active interceptor who has broken the code can splice together pieces of previous messages and transmit a spurious new message that may look authentic.
Block Ciphers
• Encrypt a group of plaintext symbols as one block. • Columnar transpositions and other transpositions are
examples of block ciphers.
Key(Optional)
IHPlaintext Ciphertext
Encryption
XNOITPYRCNES
baqckdemmc
po
Block Cipher
Systems
Block Ciphers
• Advantages:Advantages:– Diffusion: information from plaintext is diffused into
several ciphertext symbols. One ciphertext block may depend on several plaintext letters.
– Immunity to insertions: because blocks of symbols are enciphered, it is impossible to insert a single symbol into one block. The length of the block would then be incorrect, and the decipherment would quickly reveal the insertion.
Block Ciphers
• Disadvantages:Disadvantages:– Slowness of encryption: block ciphers must wait until
an entire block of plaintext symbols has been received before starting the encryption process.
– Error propagation: an error will affect the transformation of all characters in the same block.
Good Ciphers
• Shannon Characteristics:Shannon Characteristics:– The amount of secrecy needed should determine the amount of labour
appropriate for the encryption and decryption
– The set of keys and the enciphering algorithm should be free from complexity
– The implementation of the process should be as simple as possible
– Errors in ciphering should not propogate and cause corruption of further information in the message
– The size of the enciphered text should be no longer than the text of the original message.