16 Network Security Cryptography 26-04-2022 (26 Apr 2022) Material - I - 26!04!2022 - ch30
16 Network Security Cryptography 26-04-2022 (26 Apr 2022) Material - I - 26!04!2022 - ch30
16 Network Security Cryptography 26-04-2022 (26 Apr 2022) Material - I - 26!04!2022 - ch30
Cryptography
30.1
30-1 INTRODUCTION
30.2
Figure 30.1 Cryptography components
30.3
Figure 30.2 Categories of cryptography
30.4
Figure 30.3 Symmetric-key cryptography
30.5
Note
30.6
Figure 30.4 Asymmetric-key cryptography
30.7
Figure 30.5 Keys used in cryptography
30.8
Figure 30.6 Comparison between two categories of cryptography
30.9
30-2 SYMMETRIC-KEY CRYPTOGRAPHY
30.10
Figure 30.7 Traditional ciphers
30.11
Note
30.12
Example 30.1
Solution
The cipher is probably monoalphabetic because both
occurrences of L’s are encrypted as O’s.
30.13
Example 30.2
Solution
The cipher is not monoalphabetic because each
occurrence of L is encrypted by a different character.
The first L is encrypted as N; the second as Z.
30.14
Note
30.15
Example 30.3
Solution
We encrypt one character at a time. Each character is
shifted 15 characters down. Letter H is encrypted to W.
Letter E is encrypted to T. The first L is encrypted to A.
The second L is also encrypted to A. And O is encrypted
to D. The cipher text is WTAAD.
30.16
Example 30.4
Solution
We decrypt one character at a time. Each character is
shifted 15 characters up. Letter W is decrypted to H.
Letter T is decrypted to E. The first A is decrypted to L.
The second A is decrypted to L. And, finally, D is
decrypted to O. The plaintext is HELLO.
30.17
Note
30.18
Figure 30.8 Transposition cipher
30.19
Example 30.5
Solution
We first remove the spaces in the message. We then divide
the text into blocks of four characters. We add a bogus
character Z at the end of the third block. The result is
HELL OMYD EARZ. We create a three-block ciphertext
ELHLMDOYAZER.
30.20
30-3 ASYMMETRIC-KEY CRYPTOGRAPHY
30.21
Figure 30.24 RSA
30.22
Note
30.23
Key Generation
Select p,q
Calculate n = P * q
Calculate Ф (n) = (p – 1) (q – 1)
Select integer e gcd(Ф(n) , e) = 1
Calculate d d e mod Ф (n) = 1
Public key KU = [ e, n]
Private key KR = [d, n]
30.24
Example 30.7
30.25
Example 30.7 (continued)
30.26
Example 30.8
30.27
Example 30.8 (continuted)
Solution
Suppose Ted wants to send the message “NO” to
Jennifer. He changes each character to a number (from
00 to 25) with each character coded as two digits. He then
concatenates the two coded characters and gets a four-
digit number. The plaintext is 1314. Ted then uses e and n
to encrypt the message. The ciphertext is 1314343 = 33,677
mod 159,197. Jennifer receives the message 33,677 and
uses the decryption key d to decipher it as 33,67712,007 =
1314 mod 159,197. Jennifer then decodes 1314 as the
message “NO”. Figure 30.25 shows the process.
30.28
Figure 30.25 Example 30.8
30.29
Note
30.30
Example 30.10
30.32
Figure 30.28 Man-in-the-middle attack
30.33