Question: Write a program to encrypt and decrypt your full name using RSA encryption. Use the parameters provided in the example given in the course notes.

Write a program to encrypt and decrypt your full name using RSA encryption. Use the parameters provided in the example given in the course notes.

RSA.pdf( COurse Notes)

Write a program to encrypt and decrypt your full name using RSA

RSA Encryption Algorithm RSA algorithm is named after its inventors (Rivest, Shamir and Adleman). It is a pubic key cryptographic scheme. The public and private keys in this scheme are generated as follows Stepl: Choose two large prime numbers "p" and "q" so that the product is equal to the integer "n", i.e., n-pq. The plaintext to be encrypted, say, "P" is represented as an integer less than "n." (This means "n" must be a large number) Step2: Find a number "e" that is relatively prime to the produce (p-)(q-l). Note that two numbers are said to be relatively prime if they have no common factors except 1. The public key is then given by e,n Step3: Find a number "d" such that the product de = 1 mod ((p-1 )(q-l )). That is, "d" and "e" are multiplicative inverses of each other modulo (p-l)(q-1). The private key is then \d.n). Why does RSA work? From the above steps we see that for any integer Pn, de (mod n P (mod n) RSA uses large binary keys, typically 512 bits long. It takes binary blocks of plaintext of length smaller than the key length and produces a ciphertext that is the same length of the key. If the integer "P" represents a block of plaintext then RSA encrypts "P" as follows: Encryption: Ciphertext, C P(mod n) Note that the ciphertext, C is an integer between 0 and "n." To decrypt, the following procedure is used Decryption: C(mod n)- (Pe) (mod n)-ed (mod n) P (mod n) - P. Example: Suppose we want to encrypt the plaintext "RSA" using RSA encryption. Convert this to integers, "R"-18 (its position in the English alphabet), "S" 19, and "A"-1. Let us choose p-5 and q 11. Then n 55 and (p-l)(q-1) 40. Let e 7 (it is relatively prime to 40). Then, d 23. Therefore, public key is 7,55 and private key is 23,55} Plaintexts, P1 18, P2- 19, P31 ("RSA"). Then, C 18 mod 55 17; C2-19mod 55 24; C 17mod 55 Therefore, the ciphertext is 17,24,1; Decryption: 175 mod 55 18; 2425 mod 55 19; 125 mod 551 Note: To compute mod for large numbers, use this result: (ab) mod n-((a mod n)(b mod n)) mod n Example: 1723 mod 55- 1716+4+2-1 mod 55 ((1716 mod 55 17mod 55X 172 mod 55 17mod 55)) mod 55 18

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!