Unit II
Unit II
• Advantages:
– Simple
– Faster
• Disadvantages:
– Key must exchanges in secure way
– Easy for hacker to get a key as it is passed in
unsecure way.
Asymmetric-key cryptography
Note
Advantages
1. More Secured
2. Authentication
Disadvantages
1. Relatively Complex
Figure 30.6 Comparison between two categories of cryptography
• Asymmetric encryption use two keys, one to encrypt the data,
and another key to decrypt the data.
•These keys are generated together
•. One is named as Public key and is distributed freely. The
other is named as Private Key and it is kept hidden.
•Both Sender & Recipient has to share their Public Keys for
Encryption and has to use their Private Keys for Decryption.
Asymmetric encryption use two keys:
The Public key(s) is distributed freely between the sender and receiver.
The Private Key is only used for Decryption and will not be shared
between the sender and receiver.
RSA(Rivert Shamir Algorithm)
Digital Signature Algorithm
Diffie-Helman
ECC(Elliptic Curve cryptography)
Merits:
Two parties don't need to have their private keys already shared in order to
communicate using encryption.
Authentication and Non-Repudiation are possible. (Authentication means that you can
encrypt the message with my public key and only I can decrypt it with my private key.
Non-repudiation means that you can "sign" the message with your private key and I can
verify that it came from you with your public key.)
De-Merits:
Asymmetric Encryption algorithms are comparatively complex.
Time consuming process for Encryption and Decryption.
Modern Block Ciphers
permutation
Claude Shannon introduced idea of substitution-permutation (S-
P) networks called modern substitution-transposition product
cipher these form the basis of modern block ciphers
22
S-P Network
substitution (S-box)
permutation (P-box)
Permutation X= (IP(M)),
28 28
Expansion Permutation
Contraction Permutation
(permuted choice 2)
48
48
48
Round Key i
48
32
Transposition (P-Box)
32
Mangler
Function
F
32
32
32
Left Half i Right Half i Left Half Key i-1 Right Half Key i-1
DES Expansion Permutation
Right Half i-1 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 26 27 28 29 30 31 32
32 1 2 3 4 5 4 5 6 7 8 9 8 9 10 11 12 13 12 13 14 15 16 17 16 17 18 19 20 21 20 21 22 23 24 25 24 25 26 27 28 29 28 29 30 31 32 1
Si so the 8 s-boxes
implement the 48-bit
output symbol to 32-bit contraction
substitution
Permutation Box P
S1 S2 S3 S4 S5 S6 S7 S8
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 26 27 28 29 30 31 32
16 7 20 21 29 12 28 17 1 15 23 26 5 18 31 10 2 8 24 14 32 27 3 9 19 13 30 6 22 11 4 25
32 1 2 3 4 5 4 5 6 7 8 9 8 9 10 11 12 13 12 13 14 15 16 17 16 17 18 19 20 21 20 21 22 23 24 25 24 25 26 27 28 29 28 29 30 31 32 1
Round Key i
+
O 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
input symbol input symbol input symbol input symbol input symbol input symbol input symbol input symbol
control
control
control
control
control
control
control
control
S1 S2 S3 S4 S5 S6 S7 S8
output symbol output symbol output symbol output symbol output symbol output symbol output symbol output symbol
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 26 27 28 29 30 31 32
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 26 27 28 29 30 31 32
16 7 20 21 29 12 28 17 1 15 23 26 5 18 31 10 2 8 24 14 32 27 3 9 19 13 30 6 22 11 4 25
+
O 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 26 27 28 29 30 31 32
Right Half i
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 26 27 28 29 30 31 32
DES Key Schedule
forms subkeys used in each round
initial permutation of the key (PC1) which
selects 56-bits in two 28-bit halves
16 stages consisting of:
•rotating each half separately either 1 or 2 places
depending on the key rotation schedule K
•selecting 24-bits from each half & permuting them
by PC2 for use in round function F
note practical use issues in h/w vs s/w
DES Key Schedule
64-bit key with parity bits
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
permuted
choice 1
57 49 41 33 25 17 9 1 58 50 42 34 26 18 10 2 59 51 43 35 27 19 11 3 60 52 44 36 63 55 47 39 31 23 15 7 62 54 46 38 30 22 14 6 61 53 45 37 29 21 13 5 28 20 12 4
56-bit key 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
Left
Shift
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 1 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 29
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
permuted
choice 2
14 17 11 24 1 5 3 28 15 6 21 10 23 19 12 4 26 8 16 7 27 20 13 2 41 52 31 37 47 55 30 40 51 45 33 48 44 49 39 56 34 53 46 42 50 36 29 32
48-bit subkey 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
DES Decryption
decrypt must unwind steps of data computation
with Feistel design, do encryption steps again
using subkeys in reverse order (SK16 … SK1)
IP undoes final FP step of encryption
1st round with SK16 undoes 16th encrypt round
….
16th round with SK1 undoes 1st encrypt round
then final FP undoes initial encryption IP
thus recovering original data value
DES Round Decryption
Left half i-1 Right half i-1
Mangler
Function Round key i
F
+
O
Decryption
DES Example
Avalanche Effect
key desirable property of encryption alg
where a change of one input or key bit
results in changing approx half output bits
making attempts to “home-in” by guessing
keys impossible
DES exhibits strong avalanche
Avalanche in DES
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
must now consider alternatives to DES
Strength of DES – Nature of
DES and Timing attacks
Substitution box S-Box is used in each iteration to make the encryption
strong.
Timing Attacks:
A timing attack is one in which information about the key or the plaintext is
obtained by observing how long it takes a given implementation to perform
decryptions on various ciphertexts.
A timing attack exploits the fact that an encryption or decryption algorithm
often takes slightly different amounts of time on different inputs.
Confidentiality
Using Symmetric
Encryption
Confidentiality
• Ensures the receiver only receive the sender’s
information. It wont be accessed by the unauthorised
users.
• Providing confidentiality through the use of secret-key
encryption has historically been the focus of cryptology.
• This topic remains important in itself, though other
considerations have emerged in the last few decades.
• An understanding of the issues involved here
• clarifies those in other applications of encryption and
helps to motivate the development of public-key
encryption.
1
Placement of Encryption Function
Issues involved:
What should be encrypted?
Where should encryption be done?
Two approaches: Link encryption
End-to-end encryption
To make the decisions, one should first examine
the potential locations of security attacks.
2
Points of Vulnerability
Telco
Wiring Central
Closet Office
Comms
Server
LAN
Workstation
Frame Relay
or ATM
Network
3
Locations for Confidentiality
Attacks
Consider a user workstation in a typical business
organization. The points of vulnerability include:
4
N
PS
Packet-switching
PS
N network PS
N
N
PS
= end-to-end encryption device
5
End-to-End Encryption
The encryption process is carried out at the two end
systems. The source and the destination share a key.
This plan seems to secure the transmission against
attacks on the network links or switches. There is,
however, still a weak spot.
The source may encrypt only the user data portion, but
must leave the header in the clear.
With end-to-end encryption, the user data are secure,
but the traffic pattern is not. A certain degree of
authentication is also provided.
Layer used in OSI as 3,4,6,7
6
Deploying End-to-End Encryption
Possible choices:
The network layer or the transport layer one key for
each pair of end systems cannot cross
internetwork boundaries
The application layer
many keys needed: one key for each pair of users
can cross internetwork boundaries
8
Link vs. End-to-End Encryptions
Link Encryption End-to-End Encryption
Security within End Systems and Intermediate Systems
Message exposed in sending host Message encrypted in sending host
Message exposed in intermediate nodes Message encrypted in intermediate nodes
Role of User
Applied by sending host Applied by sending process User applies
Transparent to user encryption
Host maintains encryption facility User must determine algorithm Users selects
One facility for all users encryption scheme
Can be done in hardware Software implementation
All or no messages encrypted User chooses to encrypt, or not, for each message
Implementation Concerns
Requires one key per (host-intermediate Requires one key per user pair
node) pair and (intermediate node-
intermediate node) pair
Provides host authentication Provides user authentication
Traffic Confidentiality
Types of information that can be derived from a traffic
analysis attack:
Identities of partners
How frequently the partners are communicating
Message pattern, message length, or quantity of
messages
Events correlated with conversations between particular
partners
Messages of a covert channel
9
Traffic Padding
Key
Continuous
random-data
generator
Countering Traffic Analysis
Link encryption approach
Packet headers already encrypted further strength
via traffic padding
End-to-end encryption approach
11
The Key Distribution Problem
For symmetric encryption to work, the two parties of an
exchange must share the same key and that key must
be protected.
Frequent key changes may be desirable to limit the
amount of data compromised.
The strength of a cryptographic system rests with the
technique for solving the key distribution problem—
delivering a key to the two parties of an exchange.
The scale of the problem depends on the number of
communication pairs.
12
Approaches to Key Distribution
Let A (Alice) and B (Bob) be the two parties.
A key can be selected by A and physically delivered to
B.
A third party can select the key and physically deliver it
to A and B.
If A and B have previously and recently used a key, one
party can transmit the new key to the other, encrypted
using the old key.
If A and B each has an encrypted connection to a third
party C, C can deliver a key on the encrypted links to A
and B.
Number of Keys for Endpoints
9
10
8
10
7
10
6
10
Key distribution (2) E(Ka, [Ks || IDA || IDB || N1]) || E(Kb, [Ks, IDA])
steps
Initiator Responder
A B
(4) E(Ks, N2)
Application Application
2
1
Security Security
service service
4
HOST HOST
Network
Decentralized Key Distribution
(1) IDA || N1
Initiator Responder
A B
(2) E(MKm, [Ks || IDA || IDB || f(N1) || N2 ])
C+1
Master Key
Encryption
Km Algorithm
ANSI X9.17 PRNG
K 1, K 2
DTi EDE
EDE Vi+1
Vi EDE
The Blum Blum Shub (BBS) Generator
Choose two large prime numbers p and q such that
p≡q≡3 (mod 4). Let n = p × q.
Choose a random number s relatively prime to n.
Bit sequence generating algorithm:
X0 = s2 mod n
for i = 1 to ∞
Xi = (Xi−1)2 mod n Bi = Xi mod 2