Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions Modify the attached program to add RSA encryption and decryption. The following variables are used m- plaintext message c-ciphertext message d- private key e-

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Instructions Modify the attached program to add RSA encryption and decryption. The following variables are used m- plaintext message c-ciphertext message d- private key e- public key n-a large special number For encryption: me mod n The program does encryption and prints the ciphertext. Now add the code for decryption. For decryption the computation to be done: cd mod n The above computation returns a Biglnteger. So you have to convert that to a String by calling convertBigIntegerString) method. Finally, print the string after decryption. A block diagram for public key encryption for PDF format is also attached for your reference. Submit .java file before the deadline. B public-key-encryption-diagram.... (94.98 KB) B SimpleRSA.java (2.55 KB) Public Key Encryption Diagram Hello Hello Decryption Box rldEncryption Network Box Alice Bob Public Key Private Key Public Key Private Key Bob's Key Alice's Key Key Generator Key Generator Binto George 2014 import java.io.BufferedReader import java.io.InputStreamReader; import java.math.BigInteger; public class SimpleRSA public static void main (Stringl] args) try f BigInteger e= new BigInteger ("65537"); BigInteger d- new BigInteger ("8948942500927444436822854592177309391966958606588425 7445497854456487674839629818390934941973262879616797970608917283 6798754993315741611138540888132754881105882471930775825272784379 0650401568062342355006724004246666565423238350292221549362328947 2138866445818789127946123407807725702626644091036502372545139713 BigInteger n- new BigInteger ("1459067680075833232301869393490706352924018723753571 6439958187101987343879900535893836957140267014980212181808629246 7422828157022922076746906543401224889672472407926969987100581290 1031993178587536637108623576565105078837142971156373427889114635 351027120327651665184117268598 379886721118 3720508552634661874005 //Read a string from the keyboard BufferedReader in new BufferedReader (new InputStreamReader (System.in)) System.out.println ("Enter the message to encrypt") string mstring in.readLine; BigInteger m convertStringToBigInteger (mstring) BigInteger c m.modPow (e, n); //Encryption String cstringconvertBigIntegerToString (c); System.out.println (cstring): //print the encrypted text catch (Exception e) ( System.out.println ("One or more of the assigned numbers were unable to compute, ending the program"): //This is a method to convert a String to Biginteger by //packing each character into a BigInteger //Input: string //Output: BigInteger public static BigInteger convertstringToBigInteger (String s) BigInteger b new BigInteger("O"); for (int i 0: i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Does it exceed two pages in length?

Answered: 1 week ago

Question

Does it avoid typos and grammatical errors?

Answered: 1 week ago