Question: [ Protocol ] Simulate the protocol in the file Driver.java. To help you with this problem, here is a sample session: > java Driver Usage:

[Protocol] Simulate the protocol in the file Driver.java. To help you with this problem, here is
a sample session:
> java Driver
Usage: java Driver BBS_p BBS_q RSA_Alice_p RSA_Alice_q RSA_Bob_p RSA_Bob_q DH_q
>
> java Driver 7199127131137139149
Setting up BBS with p =7 and q =199
n =1393
s =696
Setting up DH with q =149
alpha =147
***** Alices side *****
p=127 q=131 n=16637 phi(n)=16380 e=181 d=181
Ra =591
Xa =49
Ya =83
****** Bobs side ******
p=137 q=139 n=19043 phi(n)=18768 e=137 d=137
Rb =84
Xb =74
Yb =148
E(PUa,Ra)=8117
E(PRb,E(PUa,Ra))=5651
E(PUa,Yb)=6137
E(PRb,E(PUa,Yb))=3945
***** Alices side *****
Decrypted Ra =591
Decrypted Yb =148
K =148
E(PUb,Rb)=2550
E(PRa,E(PUb,Rb))=11851
E(PUb,Ya)=1179
E(PRa,E(PUb,Ya))=2358
****** Bobs side ******
Decrypted Rb =84
Decrypted Ya =83
K =148
class Driver
{
/* complete the following method to simulate the protocol given in
* the handout and match the output listed in the handout. You
* must modify ALL and ONLY the lines marked with a "modify"
* comment.
*/
public static void main(String[] args) throws Exception
{
if (args.length !=7)
{
System.out.println("Usage: java Driver BBS_p BBS_q RSA_Alice_p "+
"RSA_Alice_q RSA_Bob_p RSA_Bob_q DH_q");
System.exit(1);
}
Primes.loadPrimes();
/* inputs for BBS computations */
/*(in this simulation, the BBS instance is shared by Alice and Bob)*/
int BBS_p = Integer.parseInt(args[0]);
int BBS_q = Integer.parseInt(args[1]);
BBS bbs = new BBS(BBS_p,BBS_q);
/* inputs for public-private key pair computations */
int RSAa_p = Integer.parseInt(args[2]);
int RSAa_q = Integer.parseInt(args[3]);
int RSAb_p = Integer.parseInt(args[4]);
int RSAb_q = Integer.parseInt(args[5]);
/* input for Diffie-Hellman computations */
int DH_q = Integer.parseInt(args[6]);
System.out.println("Setting up DH with q ="+ DH_q);
int alpha = Primes.pickAlpha(DH_q);
System.out.println("alpha ="+ alpha);
System.out.println("***** Alice's side *****");
RSA RSAa = new RSA(RSAa_p, RSAa_q);
int Ra =-1; /* modify: random integer */
System.out.println("Ra ="+ Ra);
int Xa = DH_q /3;
System.out.println("Xa ="+ Xa);
int Ya =-1; /* modify: first step in Diffie Hellman */
System.out.println("Ya ="+ Ya);
System.out.println("****** Bob's side ******");
RSA RSAb = new RSA(RSAb_p, RSAb_q);
int Rb =-1; /* modify: random integer */
System.out.println("Rb ="+ Rb);
int Xb = DH_q /2;
System.out.println("Xb ="+ Xb);
int Yb =-1; /* modify: second step in Diffie Hellman */
System.out.println("Yb ="+ Yb);
/* encrypt and sign Ra */
int EPUa_Ra =-1; /* modify: encrypt step */
int EPRb_Ra =-1; /* modify: sign step */
System.out.println("E(PUa,Ra)="+ EPUa_Ra);
System.out.println("E(PRb,E(PUa,Ra))="+ EPRb_Ra);
/* encrypt and sign Yb */
int EPUa_Yb =-1; /* modify: encrypt step */
int EPRb_Yb =-1; /* modify: sign step */
System.out.println("E(PUa,Yb)="+ EPUa_Yb);
System.out.println("E(PRb,E(PUa,Yb))="+ EPRb_Yb);
System.out.println("***** Alice's side *****");
int RaDec =-1; /* modify: value decrypted by Alice */
System.out.println("Decrypted Ra ="+ RaDec);
int YbDec =-1; /* modify: value decrypted by Alice */
System.out.println("Decrypted Yb ="+ YbDec);
int K =-1; /* modify: compute session key with Diffie Hellman */
System.out.println("K ="+ K);
/* encrypt and sign RB */
int EPUb_Rb =-1; /* modify: encrypt step */
int EPRa_Rb =-1; /* modify: sign step */
System.out.println("E(PUb,Rb)="+ EPUb_Rb);
System.out.println("E(PRa,E(PUb,Rb))="+ EPRa_Rb);
/* encrypt and sign Yb */
int EPUb_Ya =-1; /* modify: encrypt step */
int EPRa_Ya =-1; /* modify: sign step */
System.out.println("E(PUb,Ya)="+ EPUb_Ya);
System.out.println("E(PRa,E(PUb,Ya))="+ EPRa_Ya);
System.out.println("****** Bob's side ******");
int RbDec =-1; /* modify: value decrypted by Bob */
System.out.println("Decrypted Rb ="+ RbDec);
int YaDec =-1; /* modify: value decrypted by Bob */
System.out.println("Decrypted Ya ="+ YaDec);
K =-1; /* modify: compute session key with Diffie Hellman */
System.out.println("K ="+ K);
}// main method
}// Driver class

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 Programming Questions!