Steps in Using The Rsa
Steps in Using The Rsa
Steps in Using The Rsa
1. Key Generation:
Choose two prime numbers, p and q. For this example, let's use p = 61 and q = 53.
Calculate the Euler's Totient Function, φ(n), which is the number of positive integers less
than n that are coprime to n. φ(n) = (p - 1) * (q - 1) = 60 * 52 = 3120.
The public key consists of (n, e), which you can freely share with anyone who wants to
send you encrypted messages.
The private key consists of (n, d), which you must keep secret to decrypt messages.
3. Encryption:
To encrypt a message M, convert it to an integer. For example, let's encrypt the letter
'H', which has an ASCII value of 72.
Use the recipient's public key (n, e) to encrypt the message. The encrypted message, C,
is calculated as: C = M^e mod n. In this case, C = 72^17 mod 3233 ≈ 1096.
4. Decryption:
To decrypt the message, the recipient uses their private key (n, d).
Use the private key to decrypt the message: M = C^d mod n. In this case, M =
1096^2753 mod 3233 ≈ 72.
Convert the integer back to the original message, which is 'H' (ASCII value 72).
So, in this example, the message 'H' is encrypted with the recipient's public key and decrypted with their
private key to reveal the original message.
Scenario-Based Question:
Imagine you want to securely send a sensitive document to your colleague. Explain the step-by-step
process of how you would use RSA encryption to protect the document and ensure that only your
colleague can decrypt it.
EXAMPLE 1
1. Key Generation:
You generate an RSA key pair consisting of a public key and a private key.
You keep your private key (n, d) secret and share your public key (n, e) with your
colleague.
2. Encryption:
You have a sensitive document that you want to send to your colleague. For simplicity,
let's represent the document as a single number, D = 123.
Using your colleague's provided public key (n, e), you apply the RSA encryption
algorithm to encrypt the document:
You securely send the ciphertext (C = 176) to your colleague through a secure channel.
4. Decryption:
Your colleague, upon receiving the ciphertext (C = 176), uses their private key (n, d) to
decrypt the document.
As a result, your colleague successfully decrypts the cipher text to obtain the original sensitive
document, which in this case is represented by the number 123.
EXAMPLE 2
1. Key Generation:
Keep your private key (n, d) secret and share your public key (n, e) with your colleague.
2. Encryption:
You have a sensitive document, and you convert it into a numerical representation. For
simplicity, let's represent the document as a single number, D = 200.
Using your colleague's provided public key (n, e), apply the RSA encryption algorithm:
You securely send the ciphertext (C = 38) to your colleague through a secure channel.
4. Decryption:
Your colleague, upon receiving the ciphertext (C = 38), uses their private key (n, d) to
decrypt the document.
Your colleague successfully decrypts the ciphertext to obtain the original sensitive document, which in
this case is represented by the number 200. This process ensures that only your colleague, with the
corresponding private key, can decrypt and access the sensitive document, maintaining its
confidentiality during transmission.