Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question is in the picture below. And I need it to be in Java as I do not know the other languages. Thanks. The first
Question is in the picture below. And I need it to be in Java as I do not know the other languages. Thanks.
The first step for you is to understand the steps involved in the Diffie-Hellman key exchange protocol. After, that you can start implementing your program as follows: (a). Your program should take the size of the prime number p (in bits) as an argument during execution. Based on the size of p, your program should be able to compute and print the values of p, the generator g, random numbers a, b Zp, and other intermediate results computed in the Diffie-Hellman protocol. Note that the values of p, g, a, and b have to be generated randomly by your program based on the input argument. Your program should finally output the shared key generated. (b). Suppose your program name is Assignment2.java. Here is a sample case of what your code is expected to output upon its execution >> java Assignment 5 The value of p selected: 23 The value of g selected: 5 The value of a selected by Alice: 6 The value of b selected by Bob: 15 The value of A sent to Bob by Alice: 8 The value of B sent to Alice by Bob: 19 The value of key shared between Alice and Bob: 2 In the above scenario, the program takes 5 as input meaning that the size of p should be 5 bits (i.e., the value of p should be selected in the range (16,31]). Note that since the values of p, g, a, b are assumed to be generated randomly as per the Diffie-Hellman protocol, their values and the shared key value can be very different during each exe cution. Please note that you can use any programming language (C, C++, Java, etc.) to implement this assignment as per your convenience. However, it is your responsibility to check whether the programming language you select supports proper crypto libraries that you may want to use in your program. C, C++, JAVA and many other programming languages provide support for various crypto libraries which you can directly use to compute generators and random numbers in a group. Also, note that your program should be able to handle large numbers (for example of size 1024 bits), therefore, you have to use large-number arithmetic built-in libraries depending on the language usedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started