Question: Part A: Key Generation, Encryption and Decryption Implement RSA encryption and decryption using BigInteger class. (You may see Assignment 3 Description Video to know more.)The

Part A: Key Generation, Encryption and Decryption

Implement RSA encryption and decryption using BigInteger class. (You may see Assignment 3 Description Video to know more.)The following variables may be used:

m = plaintext message

c = ciphertext message

d = private key

e= public key

n = a large special number

At the sender's end the program should do encryption and print the ciphertext. At the receiver's end the program should perform decryption and print the plaintext.

Generate your own RSA keys. i.e., generate values of n, d, and e using the key generator (sample code below):

Random rg = new SecureRandom();

BigInteger p = BigInteger.probablePrime(bitSize, rg);

BigInteger q = BigInteger.probablePrime(bitSize, rg);

BigInteger n = p.multiply(q); //p*q

BigInteger phi_n = p.subtract(BigInteger.ONE).multiply(q.subtract(BigInteger.ONE)); //(p-1) * (q-1)

BigInteger e = new BigInteger("65537"); //BigInteger(phi_n.bitLength(), rg); //generate public key

//while (e.compareTo(BigInteger.ONE) <= 0 || //e.compareTo(phi_n) >= 0)

// if (e.gcd(phi_n).equals(BigInteger.ONE))

// break;

// else

// e = new BigInteger(phi_n.bitLength(), rg); //got an e with gcd(e, phi_n) == 1

BigInteger d = e.modInverse(phi_n); //generate d

(Uncomment the code if you want to generate a random e)

Part B: Crypt Analysis

For cryptanalysis, the ciphertext intercepted was:

c=52977484004674107084596166554939773238427226218717904047100839999329454670292979362436972593366221243824465482808700243230128076848263437296917733264673144604061137520761508560363250742367421862553744961532855896929526313416123115257362920850341863295446400912663756417652062898456596149710403153779485739044

e=89489425009274444368228545921773093919669586065884257445497854456487674839629818390934941973262879616797970608917283679875499331574161113854088813275488110588247193077582527278437906504015680623423550067240042466665654232383502922215493623289472138866445818789127946123407807725702626644091036502372545139713 n=145906768007583323230186939349070635292401872375357164399581871019873438799005358938369571402670149802121818086292467422828157022922076746906543401224889672472407926969987100581290103199317858753663710862357656510507883714297115637342788911463535102712032765166518411726859837988672111837205085526346618740053

Research various methods for cryptanalyzing RSA encryption. Explain and implement a method to cryptanalyze and print the plaintext.

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!