Chapter 30
Cryptography
30.1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
30-1 INTRODUCTION
Cryptography is a technique of securing
communication by converting plain text into
ciphertext. It involves various algorithms and
protocols to ensure data confidentiality, integrity,
authentication, and non-repudiation.
Terminologies:
A message is plaintext. The process of disguising a
message in such a way as to hide its substance is
encryption. An encrypted message is ciphertext. The
process of turning ciphertext back into plaintext is
decryption.
30.2
30- 1 INTRODUCTION
Features Of Cryptography
◼ Confidentiality: Information can only be accessed
by the person for whom it is intended and no other
person except him can access it.
◼ Integrity: Information cannot be modified in storage
or transition between sender and intended receiver
without any addition to information being detected.
◼ Non-repudiation: The creator/sender of information
cannot deny his intention to send information at a
later stage.
30.3
Figure 30.1 Cryptography components
30.4
Figure 30.2 Categories of cryptography
30.5
30-2 SYMMETRIC-KEY CRYPTOGRAPHY
Symmetric-key cryptography started thousands of years
ago when people needed to exchange secrets (for
example, in a war). We still mainly use symmetric-key
cryptography in our network security.
Topics discussed in this section:
Traditional Ciphers
Simple Modern Ciphers
Modern Round Ciphers
Mode of Operation
30.6
Figure 30.3 Symmetric-key cryptography
30.7
Note
In symmetric-key cryptography, the
same key is used by the sender
(for encryption)
and the receiver (for decryption).
The key is shared.
30.8
30-3 ASYMMETRIC-KEY CRYPTOGRAPHY
An asymmetric-key (or public-key) cipher uses two
keys: one private and one public. We discuss two
algorithms: RSA and Diffie-Hellman.
Topics discussed in this section:
RSA
30.9
Figure 30.4 Asymmetric-key cryptography
30.10
Figure 30.6 Comparison between two categories of cryptography
30.11
Figure 30.24 RSA
30.12
RSA: Choosing keys
1. Choose two large prime numbers p, q.
(e.g., 1024 bits each)
2. Compute n = pq, = (p-1)(q-1)
3. Choose e (with e<n) that has no common factors
with . (e, are “relatively prime”).
4. Choose d such that ed-1 is exactly divisible by .
(in other words: ed mod = 1 ).
5. Public key is (n,e). Private key is (n,d).
+ -
KB KB
RSA: Encryption, decryption
0. Given (n,e) and (n,d) as computed above
1. To encrypt bit pattern, m, compute
c = m e mod n
e
(i.e., remainder when m is divided by n)
2. To decrypt received bit pattern, c, compute
m = c d mod n
d
(i.e., remainder when c is divided by n)
Magic m = (m e mod n)
d
mod n
happens! c
RSA example:
Bob chooses p=5, q=7. Then n=35, =24.
e=5 (so e, relatively prime).
d=29 (so ed-1 exactly divisible by ).
letter m me c = me mod n
encrypt:
l 12 1524832 17
decrypt: c cd m = cd mod n letter
17 481968572106750915091411825223071697
12 l
Computational very extensive
Note
In RSA, e and n are announced to the
public; d and are kept secret.
Public cryptography is very
computational expensive.
30.16