2 Cryptography
2 Cryptography
2 Cryptography
SECURITY IN COMPUTING,
FIFTH EDITION
Cryptography
2
Encryption Terminology
• Sender
• Recipient
• Transmission medium
• Interceptor/intruder
• Encrypt, encode, or encipher
• Decrypt, decode, or decipher
• Cryptosystem
• Plaintext
• Ciphertext
4
A history of encryption
5
Encryption/Decryption Process
Key Key
(Optional) (Optional)
Original
Plaintext Encryption Ciphertext Decryption
Plaintext
6
Original
Plaintext Encryption Ciphertext Decryption
Plaintext
Encryption Decryption
Key Key
Original
Plaintext Encryption Ciphertext Decryption
Plaintext
From Security in Computing, Fifth Edition, by Charles P. Pfleeger, et al. (ISBN: 9780134085043). Copyright 2015 by Pearson Education, Inc. All rights reserved.
7
Stream Ciphers
Key
(Optional)
…ISSOPMI wdhuw…
Plaintext Encryption Ciphertext
8
Block Ciphers
Key
(Optional)
.. XN OI TP ES
Plaintext IH Ciphertext
Encryption
po
ba
qc
kd
em
..
Diffusion
• The idea of diffusion is to hide the relationship between
the ciphertext and the plaintext.
• In diffusion, the statistical structure of the plaintext is
dissipated into long range statistics of the ciphertext.
• Each plaintext digit affects the value of many ciphertext
digits
Note
Diffusion hides the relationship between the ciphertext
5.9
and the plaintext.
Confusion
• The idea of confusion is to hide the relationship
between the ciphertext and the key.
Stream Block
Advantages Speed of High diffusion
transformation Immunity to
Low error insertion of
propagation symbol
Triple DES
Figure Triple DES with two keys
6.15
Continue
Rounds
DES uses 16 rounds. Each round of DES is a Feistel cipher.
Figure
A round in DES
(encryption site)
6.19
Continued
DES Function
The heart of DES is the DES function. The DES function applies a 48-bit
key to the rightmost 32 bits to produce a 32-bit output.
Figure
DES function
6.20
Continue
Expansion P-box
Since RI−1 is a 32-bit input and KI is a 48-bit key, we first need to expand
RI−1 to 48 bits.
Although the relationship between the input and output can be defined
mathematically, DES uses Table 6.2 to define this P-box.
Whitener (XOR)
After the expansion permutation, DES uses the XOR operation on the
expanded right section and the round key. Note that both the right section
and the key are 48-bits in length. Also note that the round key is used only
in this operation.
6.23
Continue
S-Boxes
The S-boxes do the real mixing (confusion). DES uses 8 S-boxes, each with
a 6-bit input and a 4-bit output. See Figure 6.7.
Solution
If we write the first and the sixth bits together, we get 11 in binary, which is 3 in
decimal. The remaining bits are 0001 in binary, which is 1 in decimal. We look for the
value in row 3, column 1, in Table 6.3 (S-box 1). The result is 12 in decimal, which in
binary is 1100. So the input 100011 yields the output 1100.
6.27
Continued
Example 6.4
Solution
If we write the first and the sixth bits together, we get 00 in binary, which is 0 in
decimal. The remaining bits are 0000 in binary, which is 0 in decimal. We look for the
value in row 0, column 0, in Table 6.10 (S-box 8). The result is 13 in decimal, which is
1101 in binary. So the input 000000 yields the output 1101.
6.28
Continue
Straight Permutation
Using mixers and swappers, we can create the cipher and reverse cipher,
each having 16 rounds.
First Approach
To achieve this goal, one approach is to make the last round (round 16)
different from the others; it has only a mixer and no swapper.
Note
Alternative Approach
We can make all 16 rounds the same by including one swapper to the 16th
round and add an extra swapper after that (two swappers cancel the effect of
each other).
Key Generation
The round-key generator creates sixteen 48-bit keys out of a 56-bit cipher
key.
6.32
Continued
Figure 6.10
Key generation
6.33
Continued
We choose a random plaintext block and a random key, and determine what the
ciphertext block would be (all in hexadecimal):
Let us see how Bob, at the destination, can decipher the ciphertext received from Alice
using the same key. Table 6.16 shows some interesting points.
Strength of DES – Key Size
• 56-bit keys have 256 = 7.2 x 1016 values
• brute force search looks hard
• recent advances have shown is possible
• in 1997 on Internet in a few months
• in 1998 on dedicated h/w (EFF) in a few days
• in 1999 above combined in 22hrs!
• still must be able to recognize plaintext
• now considering alternatives to DES
Strength of DES – Timing Attacks
• attacks actual implementation of cipher
• use knowledge of consequences of implementation to derive knowledge of
some/all subkey bits
• specifically use fact that calculations can take varying times depending on
the value of the inputs to it
• particularly problematic on smartcards
Strength of DES – Analytic Attacks
• now have several analytic attacks on DES
• these utilise some deep structure of the cipher
• by gathering information about encryptions
• can eventually recover some/all of the sub-key bits
• if necessary then exhaustively search for the rest
• generally these are statistical attacks
• include
• differential cryptanalysis
• linear cryptanalysis
• related key attacks
6.41
Example 6.8
Let us try the first weak key in Table 6.18 to encrypt a block two times. After two
encryptions
with the same key the original plaintext block is created. Note that we have used the
encryption algorithm two times, not one encryption followed by another decryption.
6.42
Continued
Figure 6.11 Double encryption and decryption with a weak key
6.43
Continued
6.44
6.3.3 Continued
6.45
6.3.3 Continued
DES has a key domain of 256. The total number of the above keys are 64 (4 + 12 + 48).
The probability of choosing one of these keys is 8.8 × 10−16, almost impossible.
6.47
Continued
48
From Security in Computing, Fifth Edition, by Charles P. Pfleeger, et al. (ISBN: 9780134085043). Copyright 2015 by Pearson Education, Inc. All rights reserved.
Public-Key Cryptography
• probably most significant advance in the 3000 year history of cryptography
• uses two keys – a public & a private key
• asymmetric since parties are not equal
• uses clever application of number theoretic concepts to function
• complements rather than replaces private key crypto
Public-Key Cryptography
• public-key/two-key/asymmetric cryptography involves
the use of two keys:
• a public-key, which may be known by anybody, and can be
used to encrypt messages, and verify signatures
• a private-key, known only to the recipient, used to decrypt
messages, and sign (create) signatures
• is asymmetric because
• those who encrypt messages or verify signatures cannot
decrypt messages or create signatures
Public-Key Cryptography
10.55
Keys
Asymmetric key cryptography uses two separate keys: one
private and one public.
Figure Locking and unlocking in asymmetric-key cryptosystem
10.56
General Idea
1 .,
4. , 5
a bc 6de
f
4h
a
2
g
b
c
i
7r
pq
7
5k l
j
3d e f
8tu
s
pq r s
v
9
wxyz
8 uv
t
mn
6
o
w
x
9y
z
1 Bill, give me your public k ey
From Security in Computing, Fifth Edition, by Charles P. Pfleeger, et al. (ISBN: 9780134085043). Copyright 2015 by Pearson Education, Inc. All rights reserved.
62
1,
4
.
., 5
ab c 6de f
2c
4g
ab
h
i
7q
p
5j k l
3 de f
7
rs
pq r
s
8
t uv
w 9
8t u
xy z
m
6o
v
n
w
9x y
z
Bill, give me
1
your public key
1a No, give it to me
Man-in-the-middle attack
15.64
Parity Check
66
Authentic Unforgeable
Hash
function
Message
digest
67
Edward signs with his private key: Diana signs with her private key:
Name: Diana hash value Name: Delwyn hash value
Position: Division Manager 128C4 Position: Dept Manager 48CFA
Public key: 17EF83CA ... Public key: 3AB3882C ...
Summary
• Encryption helps prevent attackers from revealing, modifying, or fabricating
messages