You are on page 1of 11

Public Key Encryption

The RSA algorithm


Key Generation Alice:
1. Choose two large prime numbers P and Q (P≠ Q).
2. Calculate N = P x Q.
3. Select the public key (i.e. the encryption key) E such that it is not a factor
of (P – 1) and (Q – 1).
4. Select the private key (i.e. the decryption key) D such that the following
equation is true: (D x E) mod (P – 1) (Q – 1) = 1
5. Public key PU = {e, n} Private key PR = {d, n}
6. For encryption, calculate the cipher text CT from the plain text PT as
follows: CT = PT^E mod N
7. Send CT as the cipher text to the receiver.
8. For decryption, calculate the plain text PT from the cipher text CT as
follows: PT = CT^D mod N
For decryption, we calculate M = 11^23 mod 187:

• 11^23 mod 187 = [(11^1 mod 187) × (11^2 mod 187) × (11^4 mod 187) ×

(11^8 mod 187) × (11^8 mod 187)] mod 187

• 11^1 mod 187 = 11

• 11^2 mod 187 = 121

• 11^4 mod 187 = 14,641 mod 187 = 55

• 11^8 mod 187 = 214,358,881 mod 187 = 33


11^23 mod 187 = (11 × 121 × 55 × 33 × 33) mod 187 = 79,720,245 mod 187 = 88
The Security of RSA
Four possible approaches to attacking the RSA algorithm are

 Brute force: This involves trying all possible private keys.

 Mathematical attacks: There are several approaches, all equivalent in effort to


factoring the product of two primes.

 Timing attacks: These depend on the running time of the decryption


algorithm.

 Chosen ciphertext attacks: This type of attack exploits properties of the RSA
algorithm.
Diffie-Hellman key exchange
 A simple public-key algorithm is Diffie-Hellman key exchange.
 This protocol enables two users to establish a secret key using a
public-key scheme based on discrete logarithms.
 The protocol is secure only if the authenticity of the two participants
can be established.
 The algorithm itself is limited to the exchange of secret values.
 Diffie–Hellman key exchange algorithm can be used only for key
agreement, but not for encryption or decryption of messages.
 Diffie-Hellman key exchange algorithm is based on mathematical
principles
Problems with the Algorithm
• Diffie–Hellman key exchange algorithm can fall pray to the man-in-the-
middle attack (or to be politically correct, woman-in-the-middle attack),
also called as bucket brigade attack.
• Alice and Bob wish to exchange keys, and Darth is the adversary. The
attack proceeds as follows.
1. Darth prepares for the attack by generating two random private keys
and then computing the corresponding public keys.
2. Alice transmits Ya to Bob.
3. Darth intercepts Ya and transmits Yd1 to Bob. Darth also calculates K2 .
4. Bob receives Yd1 and K1 calculates .
5. Bob transmits Yb to Alice.
6. Darth intercepts Yb and transmits Yd2 to Alice. Darth calculates K1 .
7. Alice receives Yd2 and calculates K2.
Key Management
There are actually two distinct aspects to the use of public-key encryption
in this regard:
• The distribution of public keys.
• The use of public-key encryption to distribute secret keys.

Distribution of Public Keys:


Several techniques have been proposed for the distribution of public keys.
A. Public announcement
B. Publicly available directory
C. Public-key authority
D. Public-key certificates

You might also like