Lab Example of Asymmetric Encryption
Lab Example of Asymmetric Encryption
In 1977, RSA cryptography was developed by Ron Rivest, Adi Shamir, and Leonard Adleman,
from MIT. This encryption algorithm uses prime numbers to create 2 keys (a public key and a
private key). This encryption technique is called PPK (Public-Private Key) cryptography or
asymmetric key cryptography. The 2 keys are mathematically related. The public key can be
known by all; however, the private key must be kept private. Let’s take a closer look at how
this works.
p = 5 and q = 11
n=p*q
n = 5 * 11
n = 55
3. select an odd number (e) that will be the second part of the PK
Let’s choose e = 3
4. The public key consists of 2 numbers – the modulus (n) and the selected odd number
(e). In this case the Public Key (n e) is (55 3)
Subtract one from each of the values (P, Q and E) and multiply those together. Add 1
to that sum, and divide by E. This is the second part of our private key (D), which must
be kept secure.
6. The Private Key also consists of 2 numbers - the modulus (n) and the calculated part (d)
In this case Private Key (n d) is (55 27)
7. Encrypt “HELLO” using the public key – convert letters to their numeric equivalent
that is which number are they in the alphabet w/ A = 1, B = 2, C = 3, etc. Then, using
the public key, encrypt the message.
8 5 12 12 15
H = (8**3) mod 55 = 512 mod 55 = 17 - 17 was the remainder and the text to send
E = (5**3) mod 55 = 125 mod 55 = 15
L = (12**3) mod 35 = 1728 mod 55 = 23
L = (12**3) mod 35 = 1728 mod 55 = 23
O = (15**3) mod 35 = 3375 mod 55 = 20
17 15 23 23 20
11. After the message is received, decipher the text using the private key. If you use the
public key, it will not decipher properly.
12. To decipher, raise the cipher to the power d which in this case is 27 and find the mod of
n which is 55
17**27 mod 55 = 8
15**27 mod 55 = 5
23**27 mod 55 = 12
23**27 mod 55 = 12
20**27 mod 55 = 15
8 is an H
5 is an E
12 is an L
12 is an L
15 is an O
The decrypted message is the same message that was sent and the private key was kept
private. The sender only needed the public key. Therefore, anyone can encrypt and send
a message but only the owner of the private key can reveal what the message is by
deciphering using the above algorithm. The reason this works is because the keys are
mathematically related. However, for this demonstration, simple numbers were chosen
to make the math as easy as possible. In reality, choosing large numbers for p and q
makes it extremely challenging to decipher and reveal the secret.
Now, go to the discussion forum to decipher the message given the private and public
keys.