aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-01-20 08:23:10 +0800
committerFelix Lange <fjl@twurst.com>2015-02-06 07:00:35 +0800
commit2e868566d7f4c97bd4a92c4943919ed52a55e9b1 (patch)
treefacfe09540302e83172aa523939862b7edb42725
parente252c634cb40c8ef7f9bcd542f5418a937929620 (diff)
downloaddexon-2e868566d7f4c97bd4a92c4943919ed52a55e9b1.tar.gz
dexon-2e868566d7f4c97bd4a92c4943919ed52a55e9b1.tar.zst
dexon-2e868566d7f4c97bd4a92c4943919ed52a55e9b1.zip
add minor comments to the test
-rw-r--r--p2p/crypto_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/p2p/crypto_test.go b/p2p/crypto_test.go
index fb7df6b50..33cdb3f83 100644
--- a/p2p/crypto_test.go
+++ b/p2p/crypto_test.go
@@ -25,10 +25,14 @@ func TestCryptoHandshake(t *testing.T) {
}
// simulate handshake by feeding output to input
+ // initiator sends handshake 'auth'
auth, initNonce, randomPrivKey, _, _ := initiator.startHandshake(receiver.pubKeyDER, sessionToken)
+ // receiver reads auth and responds with response
response, remoteRecNonce, remoteInitNonce, remoteRandomPrivKey, _ := receiver.respondToHandshake(auth, crypto.FromECDSAPub(pub0), sessionToken)
+ // initiator reads receiver's response and the key exchange completes
recNonce, remoteRandomPubKey, _, _ := initiator.completeHandshake(response)
+ // now both parties should have the same session parameters
initSessionToken, initSecretRW, _ := initiator.newSession(initNonce, recNonce, auth, randomPrivKey, remoteRandomPubKey)
recSessionToken, recSecretRW, _ := receiver.newSession(remoteInitNonce, remoteRecNonce, auth, remoteRandomPrivKey, &randomPrivKey.PublicKey)