You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ArrayList<BigInteger> bobKeyFromServerToAlice = server.requestKey(bob); //Server sends back Bobs public key encrypted with its private key to Alice
72
+
ArrayList<BigInteger> aliceDecryptsBobsPublicKey = alice.decryptKeyFromServer(bobKeyFromServerToAlice, server); //Alice decrypts the servers message by using its public key to get Bobs key
73
+
BigIntegeralicesEncryptedNonce = alice.sendEncryptedNonce(bob, aliceDecryptsBobsPublicKey, alice.getNonce()); //Alice prepares to send her nonce to Bob encrypted with his public key
74
+
75
+
System.out.println("1) Alices requests Bob public key from the server");
76
+
System.out.println("2) Server sends back Bobs public key encrypted with the Servers private key " + bobKeyFromServerToAlice);
77
+
System.out.println("---> Alice knows the servers public key so can decrypt the message to get Bobs public key " + aliceDecryptsBobsPublicKey + "\n");
78
+
79
+
System.out.println("3) Alice sends her nonce encrypted with Bobs public key to Bob: " + alicesEncryptedNonce);
80
+
81
+
BigIntegeralicesNonceDecryptedByBob = bob.decryptNonce(alicesEncryptedNonce); //Bob decrypts Alices nonce using his private key
82
+
System.out.println("---> On receipt, Bob decrypts Alices nonce with his private key: " + alicesNonceDecryptedByBob + "\n");
83
+
System.out.println("4) Bob requests Alices public key from the server");
84
+
ArrayList<BigInteger> alicesKeyFromServerToBob = server.requestKey(alice); //Server sends back Alices public key encrypted with its private key to Bob
85
+
86
+
System.out.println("5) Server sends back Alices public key encrypted with the Servers private key " + alicesKeyFromServerToBob);
87
+
ArrayList<BigInteger> bobDecryptsAlicesPublicKey = bob.decryptKeyFromServer(alicesKeyFromServerToBob, server); //Bob decrypts the servers message by using its public key to get Alices key
88
+
System.out.println("---> Bob knows the servers public key so can decrypt the message to get Alices public key " + bobDecryptsAlicesPublicKey + "\n");
89
+
BigIntegerbobsEncryptedNonce = bob.sendEncryptedNonce(alice, bobDecryptsAlicesPublicKey, bob.getNonce()); //Bob prepares to send his nonce to Alice encrypted with her public key
90
+
System.out.println("---> Bobs encrypts his nonce with Alices public key, so only she can decrypt it " + bobsEncryptedNonce);
91
+
92
+
System.out.println("6) Bob sends one final message to Alice with her nonce and his encrypted nonce");
System.out.println("---> Alices opens the message and finds her orignal nonce (which was decrypted by Bob) and she decrypts Bobs nonce using her private key " + bobSendsBothNoncesToAlice + "\n");
95
+
96
+
System.out.println("7) Alice sends one final message to Bob containing his decrypted nonce encrypted with his public key, proving that she decrypted it");
0 commit comments