ECEG-6530 Computer (And Network) Security: Security Notions For Private-Key Encryption
ECEG-6530 Computer (And Network) Security: Security Notions For Private-Key Encryption
ECEG-6530 Computer (And Network) Security: Security Notions For Private-Key Encryption
4
The Shift Cipher
A B C D E F G H 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
5
The Shift Cipher
Example:
We will encrypt “julius” using the Shift Cipher with key k = 3.
6
The Substitution Cipher
Let P C. K consists of all possible permutations
of the 26 symbols 1,2,3,...,25. For each permutation
k K , define
ek ( p ) k ( p )
and
d k (c ) k 1( p )
where k 1 is the inverse permutation to k.
7
The Substitution Cipher
a b c d e f g h i j k l m
M I B A U P E G Z S C Y W
n o p q r s t u v w x y z
Q F D R T V X H O K J L N
8
The Substitution Cipher
A substitution cipher replaces one symbol with another.
Substitution ciphers can be categorized as either
monoalphabetic ciphers or poly alphabetic ciphers.
Note
1.Monoalphabetic Ciphres
2.Polyalphabetic Ciphers
9
1 Monoalphabetic Ciphers
Note
10
3.2.1 Continued
Additive Cipher
11
3.2.1 Continued
Figure 3.9 Additive cipher
Note
12
3.2.1 Continued
Example 3.3
Use the additive cipher with key = 15 to encrypt the
message “hello”.
Solution
We apply the encryption algorithm to the plaintext,
character by character:
13
3.2.1 Continued
Example 3.4
14
3.2.1 Continued
Shift Cipher and Caesar Cipher
Note
15
3.2.1 Continued
Example 3.5
Eve has intercepted the cipher text “UVACLYFZLJBYL”. Show how she
can use a brute-force attack to break the cipher.
Solution
Eve tries keys from 1 to 7. With a key of 7, the plaintext is
“not very secure”, which makes sense.
16
Caesar Cipher
The earliest known use of a substitution cipher, and the simplest, was by Julius
Caesar. The Caesar cipher involves replacing each letter of the alphabet with
the letter standing three places further down the alphabet. For example,
plain: meet me after the toga party
cipher: PHHW PH DIWHU WKH WRJD SDUWB
Note that the alphabet is wrapped around, so that the letter following Z is A.
We can define the transformation by listing all possibilities, as follows:
plain: 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
cipher: 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
Let us assign a numerical equivalent to each letter:
ab cdefghIjklmnopqrstuvwxyz
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Then the algorithm can be expressed as follows. For each plaintext letter p, substitute the
ciphertext letter C:[2]
[2] We define a mod n to be the remainder when a is divided by n.
For example, 11 mod 7 = 4
C = E(3, p) = (p + 3) mod 26
A shift may be of any amount, so that the general Caesar algorithm is
C = E(k, p) = (p + k) mod 26
where k takes on a value in the range 1 to 25. The decryption algorithm is simply
p = D(k, C) = (C k) mod 26
If it is known that a given ciphertext is a Caesar cipher, then a brute-force cryptanalysis
is easily performed:
Simply try all the 25 possible keys. Figure 2.3 shows the results of applying this strategy
to the example ciphertext. In this case, the plaintext leaps out as occupying the third line.
Three important characteristics of this problem enabled us
to use a brute-force cryptanalysis:
1.The encryption and decryption algorithms are known.
2.There are only 25 keys to try.
3.The language of the plaintext is known and easily
recognizable.
3.2.1 Continued
Multiplicative Ciphers
P c
Note
21
The Vigenère Cipher
Let m be a positive integer. Define P C K ( 26 )m .
For a key k (k1, k 2 ,..., k m ), we define
ek ( p1, p2 ,..., pm ) ( p1 k1, p2 k 2 ,..., pm k m )
and
d k (c1, c2 ,..., cm ) (c1 k1, c2 k 2 ,..., cm k m ),
where all operations are performed in 26 .
22
The Vigenère Cipher
A B C D E F G H 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
23
The Vigenère Cipher
A simple example:
The plaintext is “attackatdawn” and the keyword is “cipher”, thus m = 6.
Now we split the plaintext message in two blocks of six, and add the keyword modulo
26 to each of them
0 19 19 0 2 10 0 19 3 14 22 13
2 8 15 7 4 17 2 8 15 7 4 17
2 1 8 7 6 1 2 1 18 21 0 4
Thus the ciphertext is “CBIHGBCBSVAE”.
24
The Vigenere Cipher
A simple example (cont.):
To decrypt the ciphertext “CBIHGBCBSVAE”, we follow the same sequence of steps.
25
Attacks?
Shift cipher
– Key space is too small!
– Insecure against ciphertext-only attack
• Frequency analysis
• Index of coincidence
– If an attacker can recover they key, a scheme is
clearly insecure
Attacks?
Substitution cipher
– Much larger key space
– Still not secure against ciphertext-only attack
(frequency analysis, digrams, trial and error)
– Having a large key space is necessary, but not
sufficient, to guarantee security…
• (Note that adversary can still recover the key)
Attacks?
Vigenere cipher
– Index of coincidence
• Random text has index: (26)-2 = 0.038
• English text has index: (pi)2 = 0.065
– Can distinguish substitution and Vigenere
ciphers; if the latter, can determine key length
– Can further use this to determine key
Attacks
Ciphertext only
Known plaintext
Chosen plaintext
Chosen ciphertext (includes chosen
plaintext attacks)
Attacks…
A typical standard is security against
chosen-plaintext attacks
Security against chosen-ciphertext attacks is
increasingly required
Note that the one-time pad is insecure
against known-plaintext attack
Randomized encryption
To be secure against chosen-plaintext
attack, encryption must be randomized
Data Encryption Standard (DES)
Developed in 1977 by NBS
56-bit key, 64-bit input/output
– A 64-bit key is derived from 56 random bits
– One bit in each octet is a parity-check bit
– The “short” key length is a major concern…
DES: High-level description
Encryption proceeds in a sequence of 16
rounds
Each round uses a 48-bit key (derived from
the main key), acts on a 64-bit input, and
produces a 64-bit output
DES: High-level description
Each round proceeds as follows:
– Input is divided into (L, R)
– L’ = R
– R’ = L F(K, R), where K is the round key
– F is a non-invertible function!
• But we will see that decryption is still possible
– (L’, R’) is then permuted in some fixed way to
give the output at that round
3-DES
Expands the key length
Now, key K = (K1, K2); |K| = 112
The “new” block cipher is just:
– EK1,K2(m) = DESK1(DES-1K2(DESK1(m)))
This is a permutation, and invertible…
Concerns about DES
Short key length
– DES “cracker”, built for $250K, can break DES
in days
– Distributing the computation makes it faster
Some (theoretical) attacks have been found
Non-public design process
3-DES is fairly slow
DES
The 64-bit input is subjected to an initial permutation to obtain a 64-bit result
(which is just the input with the bits shuffled). The 56-bit key is used to
generate sixteen 48-bit per-round keys, by taking a different 48-bit subset of
the 56 bits for each of the keys. Each round takes as input the 64-bit output of
the previous round, and the 48-bit per-round key, and produces a 64-bit
output. After the 16th round, the 64-bit output has its halves swapped and is
then subjected to another permutation, which happens to be the inverse of the
initial permutation.
That is the overview of how encryption works. Decryption works by
essentially running DES backwards. To decrypt a block, you'd first run it
through the initial permutation to undo the final permutation (the initial and
final permutations are inverses of each other). You'd do the same key
generation, though you'd use the keys in the opposite order (first use K 16, the
key you generated last). Then you run 16 rounds just like for encryption. Why
this works will be explained when we explain what happens during a round.
After 16 rounds of decryption, the output has its halves swapped and is then
subjected to the final permutation (to undo the initial permutation).