Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1: In the following programs there are 5 errors. Find those errors and fix it. import java.io.; import java.math.Biglnteger: class DiffieHellman I public static void

image text in transcribed
Q1: In the following programs there are 5 errors. Find those errors and fix it. import java.io."; import java.math.Biglnteger: class DiffieHellman I public static void main(String[largs)throw IOException I BufferedReader brmew BufferedReader(new InputStreamReader(System.in)); System.out println("Enter prime number:"): BigInteger penew Biginteger(br readline0)): System.out.print("Enter primitive root of " +p+n: :"); BigInteger genew Biginteger(br readLine(O): System.outiprintln( "Enter value for XQless than "+p+":"): Sy stem.out printinl E Biglnteger x=nW Biginteger(br.readLine()); X= vew Biglnteger RI=gmodPow(x,p); System.out.println("Public key for Alice YA= "R1); system.out.print " Enter value for X8 less than " +p+"+7; Biglnteger y= new Biglnteger(br.readLineO); Biginteger R2=g.modPow(y.p); System.out.println("Public key For BOBYB=+R2 ): Biginteger kl=R2.modPow(x,p) : System.out.printin("Key calculated at Alice's side:" +k1 ); BigInteger 2K=R1.modPow(y/p) : System.out.println("Key calculated at Bob's side:" +k2 ), System.out.println("deffichellman secret key Encryption has Taken")

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