0% found this document useful (0 votes)
9 views127 pages

Unit II

The document discusses modern block ciphers, focusing on the Data Encryption Standard (DES) and its structure, including the differences between block and stream ciphers. It details the Simplified Data Encryption Standard (S-DES) algorithm, key generation, and the principles of confusion and diffusion introduced by Claude Shannon. Additionally, it covers the Feistel cipher structure and the design principles of DES, including its encryption process and the use of substitution and permutation boxes.

Uploaded by

rdharshini527
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views127 pages

Unit II

The document discusses modern block ciphers, focusing on the Data Encryption Standard (DES) and its structure, including the differences between block and stream ciphers. It details the Simplified Data Encryption Standard (S-DES) algorithm, key generation, and the principles of confusion and diffusion introduced by Claude Shannon. Additionally, it covers the Feistel cipher structure and the design principles of DES, including its encryption process and the use of substitution and permutation boxes.

Uploaded by

rdharshini527
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Cryptography and Network Security

Unit II
Modern Block Ciphers

 one of the most widely used types of cryptographic


algorithms
 provide secrecy /authentication services
 focus on DES (Data Encryption Standard)

2 CSE-AVCCE
Block vs Stream Ciphers
 Block ciphers process messages in blocks, each of which is
then en/decrypted
 like a substitution on very big characters 64-bits or more
 stream ciphers process messages a bit or byte at a time when
en/decrypting
 many current ciphers are block ciphers

3 CSE-AVCCE
Block vs Stream Ciphers

4 CSE-AVCCE
SIMPLIFIED DATA ENCRYPTION STANDARD (S-DES)

 The S-DES encryption algorithm takes an 8-bit block of plaintext


(example: 10111101) and a 10-bit key as input and produces an 8-bit
block of ciphertext as output.

 The S-DES decryption algorithm takes an 8-bit block of ciphertext


and the same 10-bit key used to produce that ciphertext as input
and produces the original 8-bit block of plaintext.

5 CSE-AVCCE
Encryption algorithm involves 5 functions
 Initial permutation (IP)
 A complex function (Round function) involves both permutation
and substitution operations (fk )
 Swapping ( SW )
 Complex function (fk )
 Inverse of initial permutation (IP-1)

6 CSE-AVCCE
7 CSE-AVCCE
S-DES key generation

8 CSE-AVCCE
S-DES
Encryption

9 CSE-AVCCE
Permutation Boxes – P Box

10 CSE-AVCCE
S-Box

00 01 10 11
S0 00 01 00 11 10

01 11 10 01 00

10 00 10 01 11

11 11 01 11 10
11 CSE-AVCCE
Example
 Plaintext : 10111101
 Key : 1010000010

 (Refer word document – Solved)

Assignment 2
Perform encryption using SDES
Plain text : 1 1 0 0 1 1 0 0
Key : 1 0 1 0 1 0 1 1 0 1

12 CSE-AVCCE
Claude Shannon and Substitution-
Permutation Ciphers
 Claude Shannon introduced idea of substitution-permutation
(S-P) networks in 1949 paper
 form basis of modern block ciphers
 S-P nets are based on the two primitive cryptographic
operations seen before:
 substitution (S-box)

 permutation (P-box)

 provide confusion & diffusion of message & key

13 CSE-AVCCE
Principles of Confusion and Diffusion
plaintext ciphertext plaintext
Encryption Decryption

Key KA Key KB
• Terms courtesy of Claude Shannon, father of
Information Theory
• “Confusion” = Substitution
• a -> b
• Caesar cipher
• “Diffusion” = Transposition or Permutation
• abcd -> dacb
14 • CSE-AVCCE
DES
Principles of Confusion and Diffusion
• “Confusion” : a classical Substitution Cipher

Courtesy:
Andreas
Steffen

• Modern substitution ciphers take in N bits and


substitute N bits using lookup table: called S-Boxes
15 CSE-AVCCE
Principles of Confusion and Diffusion
• “Diffusion” : a classical Transposition cipher

Courtesy:
Andreas
Steffen

• modern Transposition ciphers take in N bits and permute using


lookup table : called P-Boxes
16 CSE-AVCCE
Confusion and Diffusion

 Shannon suggested combining S & P elements to obtain:

 Diffusion – make the relationship between ciphertext and


plaintext as complex as possible

 Confusion – makes relationship between ciphertext and key


as complex as possible

17 CSE-AVCCE
Feistel Cipher Structure
Horst Feistel devised the Feistel cipher
 The Feistel cipher structure is based on Shannon's proposal
of 1945, is the structure used by many significant symmetric
block ciphers currently in use.
 Feistel proposed the use of a cipher that alternates
substitutions and permutations

18 CSE-AVCCE
Feistel Cipher Structure
 Figure depicts the structure proposed by Feistel.

 The inputs to the encryption algorithm are a plaintext block of length


2w bits and a key K.
 The plaintext block is divided into two halves, L0 and R0.

 The two halves of the data pass through n rounds of processing and
then combine to produce the ciphertext block.
 Each round i has as inputs Li-1 and Ri-1, derived from the previous
round, as well as a subkey Ki, derived from the overall K.
 In general, the subkeys Ki are different from K and from each other

19 CSE-AVCCE
Feistel Cipher
Encryption

20 CSE-AVCCE
Fiestel
Encryption
and
Decryption

21 CSE-AVCCE
Feistel Cipher Design Principles
 Block size
 increasing size improves security, but slows cipher

 Key size
 increasing size improves security, makes exhaustive key searching
harder, but may slow cipher
 Number of rounds
 increasing number improves security, but slows cipher

 Sub key generation


 greater complexity can make analysis harder, but slows cipher

 Round function
 greater complexity can make analysis harder, but slows cipher

22 CSE-AVCCE
DATA ENCRYPTION STANDARD (DES)
History

In 1971, IBM developed an algorithm,


named LUCIFER which operates on a
block of 64 bits, using a 128-bit key

Walter Tuchman, an IBM researcher,


refined LUCIFER and reduced the key
size to 56-bit, to fit on a chip.
24 CSE-AVCCE
History

In 1977, the results of Tuchman’s


project of IBM was adopted as the Data
Encryption Standard by NSA (NIST).

25 CSE-AVCCE
Encryption

[1]
26 CSE-AVCCE
Initial Permutation IP
 First step of the data computation
 IP reorders the input data bits
 even bits to LH half, odd bits to RH half
 quite regular in structure

27 CSE-AVCCE
Encryption

64-bit plaintext (X)

Initial Permutation (IP)

64-bit key (K)


Key i
Round (i) Key Generation (KeyGen)

32-bit Switch (SW)

Inversion of Initial Permutation (IP-1)

64-bit ciphertext (Y)


28 CSE-AVCCE
Initial Permutation Inverse Initial Permutation
IP IP-1

29 CSE-AVCCE
30 CSE-AVCCE
DES Round Structure

 uses two 32-bit L & R halves


 as for any Feistel cipher can describe as:
Li = Ri–1
Ri = Li–1 F(Ri–1, Ki)
 F takes 32-bit R half and 48-bit subkey:
 expands R to 48-bits using perm E

 adds to subkey using XOR

 passes through 8 S-boxes to get 32-bit result

 finally permutes using 32-bit perm P

31 CSE-AVCCE
Encryption (Round)

(Key Generation)

32 CSE-AVCCE [1]
Substitution Boxes S

• 8 S-boxes
• Each S-Box maps 6 to 4 bits
• outer bits 1 & 6 (row bits) select the row
• inner bits 2-5 (col bits) select the column
• For example, in S1, for input 011001,
• the row is 01 (row 1)
• the column is 1100 (column 12).
• The value in row 1, column 12 is 9
• The output is 1001.
• result is 8 X 4 bits, or 32 bits

33 CSE-AVCCE
Substitution Boxes S

 each of the eight s-boxes is


different
 each s-box reduces 6 bits
input symbol to 4 bits
control

 so the 8 s-boxes
Si implement the 48-bit to
32-bit contraction
output symbol substitution

34 CSE-AVCCE
Encryption (Round) (cont.)

S-box

Example : 010001
1,6 th bit refers row – 01 – 1st row
Middle 4 bits refers column – 1000 – 8th
column

35 CSE-AVCCE [1]
Encryption (Round) (cont.)
 S-box

Example : 010001
1,6 th bit refers row – 01 – 1st row
[1]
36 CSE-AVCCE Middle 4 bits refers column – 1000 – 8th column
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
31 32
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 44 25
25

 P-box applied at end of each round


 Increases diffusion/avalanche effect

37 CSE-AVCCE
DES Round in Full
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

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

Left Half i-1

+
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

38 CSE-AVCCE
1
Right Half i

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
Key Generation

(Encryption)

39 CSE-AVCCE [1]
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

40 CSE-AVCCE
41 CSE-AVCCE
42 CSE-AVCCE
DES Example

43 CSE-AVCCE
Strength of DES
Avalanche effect
 A desirable property of any encryption algorithm is that a small
change in either the plaintext or the key should produce a
significant change in the ciphertext.
 In particular, a change in one bit of the plaintext or one bit of
the key should produce a change in many bits of the ciphertext.
Key Size
 56-bit keys have 256 , brute force search looks hard.

44 CSE-AVCCE
Strength of DES
 DES exhibits a strong avalanche
effect.

45 CSE-AVCCE
Avalanche in DES
K1
original
P2

46 CSE-AVCCE
Block Cipher design Principles
i) Design of function F
a) Design criteria for F
b) S-Box design
ii) Number of Rounds
iii) Key Schedule Algorithm

47 CSE-AVCCE
i) Design of function F
 The heart of a Fiestel block cipher is the function [Link] DES, the function
relies on the use of S-Boxes
a) Design Criteria for F
 Strict Avalanche Criterion(SAC) which states that any output bit j of an
S-Box should change with the probability ½ when any single input bit i
is inverted for all i,j
 Bit independence Criterion which states that output bit j and k should
change independently when any single input bit i is inverted for all i, j
and k

48 CSE-AVCCE
Each row of an S-box (determined by a fixed value of the leftmost
and rightmost input bits) should include all 16 possible output bit
combinations.
 If two inputs to an S-box differ in exactly one bit, the outputs must
differ in atleast two bits.
 If two inputs to an S- box differ in the two middle bits exactly,
the outputs must differ in at least two bits.
 If two inputs to an Sbox differ in their first two bits and are identical in
their last two bits, the two outputs must not be the same.

49 CSE-AVCCE
b) S-Box Design

Random: Use some pseudorandom number generation or some table of random


digits to generate the entries in the S-boxes. This may lead to boxes with undesir-
able characteristics for small sizes but should be acceptable for large S-
boxes (e.g., 8 * 32).
Random with testing: Choose S-box entries randomly, then test the results
against various criteria, and throw away those that do not pass
Human-made: This is a more or less manual approach with only simple
mathematics to support it. It is apparently the technique used in the DES design.
This approach is difficult to carry through for large S-boxes.
Math-made: Generate S-boxes according to mathematical principles. By using
mathematical Construction, S-boxes can be constructed that offer proven
security against linear and differential cryptanalysis together with good diffusion
50 CSE-AVCCE
ii) Number of Rounds
 The greater the number of rounds, the more difficult is to
perform cryptanalysis, even for a relatively weak F
iii) Key Schedule Algorithm
 The sub key generation process involves as much as
complex possible

51 CSE-AVCCE
Block Cipher modes of operation

52 CSE-AVCCE
Different modes of Operation

 Electronic Code Book (ECB)


 Cipher Block Chaining (CBC)
 Cipher FeedBack (CFB)
 Output FeedBack (OFB)
 Counter (CTR)

53 CSE-AVCCE
Electronic Code Book (ECB)
 Message is broken into independent blocks.

 For a given key ,there is a unique cipher text for every 64 bit
block of plain text
 In a gigantic code book there is an entry for every possible 64
bit plain text pattern, showing its corresponding cipher text
 Each block is encoded independently of the other blocks

Ci = DESK1 (Pi)
 uses: secure transmission of single values

54 CSE-AVCCE
Electronic Code Book (ECB)

55 CSE-AVCCE
Advantages and Limitations of ECB

 It is ideal for short amount of data such as Encryption key.

To transmit DES key securely ECB is appropriate mode to


use.
Limitation:
 For lengthy message, ECB mode may not be secure

 The same 64 bit block of plaintext, if it appears more than


once in the message, always produces the same cipher
text.

56 CSE-AVCCE
P blocks : 000000 011111 001111 000011 011111 000111 011111

Cipher : 000001 111111 110001 110011 111111 100010 111111

If same sequence repeated in cipher, easy for the hackers to attack

57 CSE-AVCCE
Cipher Block Chaining (CBC)

 Message is broken into blocks


 But these are linked together in the encryption operation
 Each previous cipher blocks is chained with current plaintext
block, hence name
 use Initial Vector (IV) to start process
 To produce the 1st block of cipher, an IV is XORed with 1st block
of plain text
 IV must be known to both sender and receiver
Cj = EK(Cj-1 XOR Pj)
Pj = Cj-1 XOR DK (Cj)
 uses: bulk data encryption, authentication

58 CSE-AVCCE
Cipher Block Chaining (CBC)

59 CSE-AVCCE
Advantages and Limitations of CBC

 Each ciphertext block depends on all message blocks

 thus a change in the message affects all ciphertext blocks


after the change as well as the original block
 need Initial Value (IV) known to sender & receiver

 however if IV is sent in the clear, an attacker can change


bits of the first block, and change IV to compensate
 hence it must be sent encrypted in ECB mode before
rest of message

60 CSE-AVCCE
Cipher Feed Back (CFB)

 Input to the encryption function is a 64 bit shift register that is initially


set to some Initial vector (IV)
 The leftmost (MSB) S bits of encryption function are XoRed with the I
segment of plain text P1 to produce the I unit of cipher C1 which is
then transmitted.
 The contents of shift register are shifted left by S bits and C1 is placed
in the rightmost (LSB) S bits of shift register
C1 = P1 XOR Ss( EK (IV) )
P1 = C1 XOR Ss( EK (IV) )

uses: stream data encryption, authentication

61 CSE-AVCCE
Cipher FeedBack (CFB)

62 CSE-AVCCE
Advantages and Limitations of CFB
 appropriate when data arrives in bits/bytes
 most common stream mode
 limitation is need to stall while do block encryption after
every n-bits
 note that the block cipher is used in encryption mode at
both ends
 errors propagate for several blocks after the error

63 CSE-AVCCE
Output FeedBack (OFB)
 Output of the encryption function is fedback to the shift register in
OFB

 uses: stream encryption over noisy channels

64 CSE-AVCCE
Output FeedBack (OFB)

65 CSE-AVCCE
Counter (CTR)
 a “new” mode, though proposed early on
 similar to OFB but encrypts counter value rather than
any feedback value
 must have a different key & counter value for every
plaintext block (never reused)
Ci = Pi XOR Oi

 uses: high-speed network encryptions

66 CSE-AVCCE
Counter (CTR)

67 CSE-AVCCE
Advantages of CTR

 Efficiency
 E and D can be done in parallel on multiple blocks
 Other cases depends on previous output
 Preprocessing
 the execution of Encryption algorithm doesn’t depend on
input of P / C
 If sufficient memory and security is available we can prepare
the output of Encryption boxes
 Hence if Plaintext is presented, the only computation is series
of XORS. Greatly enhances throughput

68 CSE-AVCCE
 random access
 if we need the Plaintext of 10th block – particular 10th
Cipher block is Decrypted and get the Plaintext
 provable security (good as other modes)

69 CSE-AVCCE
Double DES

C= EK2(EK1(P))
70 CSE-AVCCE
Triple DES ( 3 keys )

71 CSE-AVCCE
Triple DES with 2 keys

72 CSE-AVCCE
Advanced Encryption Standard
(AES)

73 CSE-AVCCE
Origins
 clear a replacement for DES was needed
 can use Triple-DES – but slow with small blocks
 US NIST issued call for ciphers in 1997
 15 candidates accepted in Jun 98
 5 were shortlisted in Aug-99
 Rijndael was selected as the AES in Oct-2000

74 CSE-AVCCE
AES Requirements
 private key symmetric block cipher
 128-bit data, 128/192/256-bit keys
 stronger & faster than Triple-DES
 provide full specification & design details
 NIST have released all submissions & unclassified
analyses

75 CSE-AVCCE
AES Evaluation Criteria
 initial criteria:

 security –> effort to practically cryptanalysis


 cost –> computational
 algorithm & implementation characteristics

76 CSE-AVCCE
AES Shortlist
 after testing and evaluation, shortlist in Aug-99:
 MARS (IBM) - complex, fast, high security margin
 RC6 (USA) - v. simple, v. fast, low security margin
 Rijndael (Belgium) - clean, fast, good security margin
 Serpent (Euro) - slow, clean, v. high security margin
 Twofish (USA) - complex, v. fast, high security margin
 then subject to further analysis & comment
 saw contrast between algorithms with
 few complex rounds verses many simple rounds
 which refined existing ciphers verses new proposals

77 CSE-AVCCE
The AES Cipher - Rijndael
 designed by Rijmen-Daemen in Belgium
 has 128/192/256 bit keys, 128 bit data
 an iterative rather than feistel cipher
 treats data in 4 groups of 4 bytes
 operates an entire block in every round
 designed to be:
 resistant against known attacks
 speed and code compactness on many CPUs
 design simplicity

78 CSE-AVCCE
Rijndael
 processes data as 4 groups of 4 bytes (state)
 has 9/11/13 rounds in which state undergoes:
 byte substitution (1 S-box used on every byte)
 shift rows (permute bytes between groups/columns)
 mix columns (subs using matrix multipy of groups)
 add round key (XOR state with key material)
 initial XOR key material & incomplete last round
 all operations can be combined into XOR and table lookups -
hence very fast & efficient

79 CSE-AVCCE
Rijndael

80 CSE-AVCCE
Byte Substitution
 a simple substitution of each byte
 each byte of state is replaced by byte in row (left 4-
bits) & column (right 4-bits)
 eg. byte {95} is replaced by row 9 col 5 byte
 which is the value {2A}

81 CSE-AVCCE
Shift Rows
 a circular byte shift in each row
 1st row is unchanged
 2nd row does 1 byte circular shift to left
 3rd row does 2 byte circular shift to left
 4th row does 3 byte circular shift to left
 decrypt does shifts to right

82 CSE-AVCCE
Mix Columns
 each column is processed separately
 each byte is replaced by a value dependent on all 4
bytes in the column

83 CSE-AVCCE
Add Round Key
 XOR state with 128-bits of the round key
 again processed by column (though effectively a series
of byte operations)
 inverse for decryption is identical since XOR is own
inverse, just with correct round key
 designed to be as simple as possible

84 CSE-AVCCE
AES Round

85 CSE-AVCCE
AES Key Expansion
 takes 128-bit (16-byte) key
 start by copying key into first 4 words
 then loop creating words that depend on values in
previous & 4 places back
 in 3 of 4 cases just XOR these together
 every 4th has S-box + rotate + XOR constant of previous
before XOR together
 designed to resist known attacks

86 CSE-AVCCE
AES Decryption
 AES decryption is not identical to encryption since
steps done in reverse

87 CSE-AVCCE
RC4 algorithm

88 CSE-AVCCE
RC4 – Stream Cipher Diagram

89 CSE-AVCCE
RC4
 It is a stream cipher designed by Ronald Rivest
 It is a byte oriented stream cipher
 Here a byte of plain text is XORed with a byte of key to
produce a byte of cipher text
State
 RC4 is based on the concept of a state
 At each moment a state of 256 byte is active from
which one of the byte is randomly selected to serve as
the key for encryption

90 CSE-AVCCE
Initialization
 It is done in 2 steps
 In the first step, the state is initialized to the values
s[0]=0, s[1]=1, s[2]=2,……s[255]=255
 A key array k[0], k[1],k[2]……..k[255] is also created
 If the secret key has exactly 256 bytes, the bytes are copied to
the k array
 Otherwise the bytes are repeated until the k array is filled

for (i=0 to 255)


{ s[i] = i
k[i]=key[i mod key length]
}

91 CSE-AVCCE
92 CSE-AVCCE
 In the second step ,the initialized step goes through a
permutation ( swapping the elements ) based on the values
of the bytes in k[i].
 After this step, the state bytes are completely shuffled

93 CSE-AVCCE
Key stream generation
First the state is permuted based on the values of state
elements and values of 2 variables i and j
The following code is repeated for each byte of plain text to
create a new key element in the key stream

94 CSE-AVCCE
Encryption and Decryption
After K has been created the plain text byte is encrypted with
k to create the cipher text byte

95 CSE-AVCCE
96 CSE-AVCCE
Example contd.

97 CSE-AVCCE
Example contd.

98 CSE-AVCCE
Example contd.

99 CSE-AVCCE
Example contd.

100 CSE-AVCCE
Example contd.

101 CSE-AVCCE
Example contd.

102 CSE-AVCCE
103 CSE-AVCCE
Key Generation
Key - 1 0 1 0 0 0 0 0 1 0
1 2 3 4 5 6 7 8 9 10

Step : 1 Permute P10

According to P10 – rearrange the positions of bits in key

1 0 0 0 0 0 1 1 0 0

Step – 2 ( Split into 5 bits – 2 halves) - Left Shift one time

1 0 0 0 0 0 1 1 0 0

LS-1 : 0 0 0 0 1 1 1 0 0 0
1 2 3 4 5 6 7 8 9 10

Step – 3 Permute P8
(Rearrange the bits in LS-1)

1 0 1 0 0 1 0 0 --------------------K1

CSE - AVCCE
Step-4 Left shift 2 times
LS-1 0 0 0 0 1 1 1 0 0 0

1st time 0 0 0 1 0 1 0 0 0 1

2nd time 0 0 1 0 0 0 0 0 1 1
1 2 3 4 5 6 7 8 9 10

Step-5 Permute P8

0 1 0 0 0 0 1 1 -----------------------------------------K2

ENCRYPTION

Plain text : 1 0 1 1 1 1 0 1
1 2 3 4 5 6 7 8

Step 1 : Initial Permutation ( IP)

IP 0 1 1 1 1 1 1 0

Step 2 : Divide IP into 2 halves

0 1 1 1 1 1 1 0
LH RH

Take the right half bits and proceed next


CSE - AVCCE
RH : 1 1 1 0
1 2 3 4

Step 3 : Expansion / Permutation

E/P: 0 1 1 1 1 1 0 1

Step 4 : XOR operation

E/P - 0 1 1 1 1 1 0 1

K1 - 1 0 1 0 0 1 0 0

XOR - 1 1 0 1 1 0 0 1

Step 5: S-BOX

1 1 0 1 1 0 0 1
XOR

S0 S1

Check in S0 matrix

1 1 0 1

1, 4 th bit refers row in S0 (11)


2, 3 rd bit refers column in S0 ( 1 0 )

1 1 convert binary to decimal ----- 3 (row)


1 0 convert binary to decimal ----- 2 (Column)
CSE - AVCCE
See 3rd row and 2nd Column in S0 Box ----Intersection is

Intersection is 3 --- convert to binary---- 11 ( Output of S0)

Check in S1 matrix
1 0 0 1

1 1 ----refers row (3)


0 0 ----refers column ( 0 )

Check 3rd row and 0th column in S1 Box --------Intersection is 2

Convert 2 in binary ---- 1 0 ( output of S1 )

Output of S – Boxes

1 1 1 0
1 2 3 4

Step 6 : Permute P4

P4 - 1 0 1 1

CSE - AVCCE
Step 7: XOR with LH

P4 - 1 0 1 1
LH - 0 1 1 1
XOR- 1 1 0 0

SWAPPING

1 1 0 0 1 1 1 0
LH RH

1 1 1 0 1 1 0 0
LH RH

ROUND – 2 Proceed with RH

RH - 1 1 0 0

CSE - AVCCE
Cryptography and Network Security

Unit II – Key Distribution


Key Distribution
 symmetric schemes require both parties to
share a common secret key
 issue is how to securely distribute this key
 whilst protecting it from others
 frequent key changes can be desirable
 often secure system failure due to a break
in the key distribution scheme
Key Distribution
 given parties A and B have various key
distribution alternatives:
1. A can select key and physically deliver to B
2. third party can select & deliver key to A & B
3. if A & B have communicated previously can
use previous key to encrypt a new key
4. if A & B have secure communications with a
third party C, C can relay key between A & B
Symmetric Key Management
 Each pair of communicating entities needs a shared key
 Why?
 For a n-party system, there are n(n-1)/2 distinct keys in the system and
each party needs to maintain n-1 distinct keys.

K1 K4
K2 K3
K5

K6
K8
K7

K9

K10

4 CSE-AVCCE
Key Hierarchy
 typically
have a hierarchy of keys
 session key
 temporary key
 used for encryption of data between users
 for one logical session then discarded
 master key
 used to encrypt session keys
 shared by user & key distribution center
Key Hierarchy
I. Key Distribution Scenario
A Key Distribution Scenario
 User A wishes to establish a logical connection with B

 Also requires a one-time session key to protect the data


transmitted over the connection.
 A has a master key Ka, known only to A and KDC

 B shares the master key Kb known only to B and KDC

8 CSE-AVCCE
Steps inolved
1. A issues a request to the KDC for a session key to protect a logical
connection to B.
[The message includes the identity of A and B and a unique identifier,
N1, for this transaction, which we refer to
as a nonce- random number identifying each transaction]
2. The KDC responds with a message encrypted using Ka
 The one-time session key, Ks, to be used for the session
 original request message, including the nonce, to enable A to match
this response
 In addition, the message includes two items intended for B:
● The one-time session key, Ks to be used for the session
● An identifier of A (e.g., its network address), IDA
 These items are encrypted with Kb

9 CSE-AVCCE
3. A stores the session key for use in the upcoming session
and forwards to B the information EKb, [Ks || IDA]).
- B now stores the session key (Ks),
- knows that the other party is A (from IDA), and
- knows that the information originated at the KDC
(because it is encrypted using Kb).
 At this point, a session key has been securely delivered to
A and B, and they may begin their protected exchange.
 However, two additional steps are desirable:

10 CSE-AVCCE
4. Using the new session key, B sends a nonce, N2, to A.
5. Also using Ks, A responds with f(N2), where f is a function
that performs some transformation on N2 (e.g., adding
one).
 These steps assure B that the original message it received
(step 3) was not a replay.
Steps 1,2,3 performs key distribution
steps 4 and 5 perform an authentication function.

11 CSE-AVCCE
II. Hierarchical Key Control
 For very large networks, single KDC is not enough

 a hierarchy of KDCs can be established.

 For example, there can be local KDCs, each responsible for a


small domain such as single LAN or a single building.
 For communication among entities within the same local
domain, the local KDC is responsible for key distribution.
 If two entities in different domains wants to share key, then the
corresponding local KDCs can communicate through a global
KDC.
 The hierarchical concept can be extended to three or even
more layers, depending on the size of the user population

12 CSE-AVCCE
III. A Transparent Key Control Scheme

13 CSE-AVCCE
 This scheme is useful for providing end-to-end encryption
at a network level to the end users.
 The approach assumes that communication makes use of a

connection-oriented end-to-end protocol, such as TCP.


 The noteworthy element of this approach is a session
security module (SSM), performs end-to-end encryption
and obtains session keys on behalf of its host or terminal

14 CSE-AVCCE
Steps Involved
1. Host A wishes to set up a connection to host B, it transmits a connection-
request packet
2. The SSM saves that packet and applies to the KDC for permission to establish
the connection
The communication between the SSM and the KDC is encrypted using a master
key shared only by this SSM and the KDC.
3. If the KDC approves the connection request, it generates the session key and
delivers it to the two appropriate SSMs
4. The requesting SSM can now release the connection request packet, and a
connection is set up between the two end systems
All user data exchanged between the two end systems are encrypted by their
respective SSMs using the one-time session key.

15 CSE-AVCCE
IV. Decentralized key Control

 The use of a key distribution center imposes the requirement


that the KDC be trusted and be protected from subversion

16 CSE-AVCCE
Steps Involved
Session key may be established in the following way

1. A issues a request to B for a session key and includes a


nonce, N1
2. B responds with a message that is encrypted using the
shared master key.
 The response includes the session key selected by B, an
identifier of B, the value f(N1), and another nonce,
N2.
3. Using the new session key, A returns f(N2) to B.

17 CSE-AVCCE
V. Controlling the Key Usage

 Different types of session keys on the basis of use, such as

● Data-encrypting key, for general communication across a


network
● PIN-encrypting key, for personal identification numbers
(PINs) used in electronic funds transfer
● File-encrypting key, for encrypting files stored in publicly
accessible locations

18 CSE-AVCCE
Control Vector Encryption and Decryption

19 CSE-AVCCE

You might also like