Professional Documents
Culture Documents
4
C.N. Security lec 4 ENG. AHMED K. DARAJ
The first use of public key cryptography is for encrypting messages to Bob. Anyone who
wishes to send an encrypted message to Bob will use Bob’s public key. To decrypt the
message, Bob’s private key is needed, and only Bob knows it.
The second use of public key cryptography is for message signing by Bob. Bob’s private
key is used by Bob to generate a signature. Any one is able to verify Bob’s signature
using Bob’s public key. Denote the signature of the message M by (M).
Message, Message,
Message
Yes/No Verification (M) Authentication
The encryption (or verification) algorithm and the decryption (or authentication)
algorithms may or may not be the same.
The table below summarizes some of the important aspects of symmetric (Private-Key
Cryptography) and public-key encryption. To discriminate between the two, we refer
to the key used in symmetric encryption as a secret key (Private-Key Cryptography)
and asymmetric (Public-Key Cryptography)
RSA Algorithm
The algorithm was developed 1977 by Ron Rivest, Adi Shamir, and Len Adleman at
MIT and first published in 1978. The RSA scheme has since that time reigned supreme as
the most widely accepted and implemented general-purpose approach to public-key
encryption.
It is a block cipher in which the plaintext and ciphertext are integers between 0 and n 1
for some n.
Example:
Suppose p=17, q=11. Using RSA to encrypt the message M=88
Solution:
- n=p*q → 17*11 =𝟏𝟖𝟕
- φ (n) = (p-1)(q-1) = 16*10
=𝟏𝟔𝟎
- choose 𝑒 verifies 𝑔𝑐𝑑 ((𝜑 (𝑛), 𝑒) = 1 ; 1 < 𝑒 < 𝜑(𝑛)
then 𝒆 = 𝟕
- choose 𝑑 verifies 𝑒. 𝑑 ≡ 1 𝑚𝑜𝑑 𝜑 (𝑛), then 𝒅 = 𝟐𝟑
7.23 ≡ 1 𝑚𝑜𝑑 160
- PU={7, 187}
- PR={23,17,11}
The decryption:
𝑀 = 𝐶 𝑑 𝑚𝑜𝑑 𝑛
𝑀 = 1123 𝑚𝑜𝑑 187 = 88
Example: what is the Result of the Fast Modular Exponentiation Algorithm for ab mod n,
where a = 7, b = 560, n = 561.
Solution:
Note that the variable c is not needed; it is included for explanatory purposes. The final
value of c is the value of the exponent. Note: The integer b is expressed as a binary
number bk bk-1 ... b0. The value of b should convert to binary scheme, so b=
1000110000. Table below shows the result of algorithm application
Assignment:
1. If p=61, q= 53, e=17 and the encrypted message C= 855. What is the original
message m?
2. The ciphertext C =10 sent to a user whose public key is e=5, n=35. What is the
plaintext M?