summaryrefslogtreecommitdiff
path: root/docs/Tox_middle_level_network_protocol.txt
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-04-29 20:45:32 -0400
committerirungentoo <irungentoo@gmail.com>2014-04-29 20:45:32 -0400
commit3863e01e2207198c20bf278c107f24a8cfbf1a73 (patch)
treea49a417a68d9ccff7dd30824021bc6e1b408795f /docs/Tox_middle_level_network_protocol.txt
parent94545c3b50c6f87af702692ba171cacc577c669a (diff)
Some more work done on the middle network protocol.
Handshake most likely has no more possible flaws to it, next thing to do is to do the same with the data packets. Wrote a couple more functions.
Diffstat (limited to 'docs/Tox_middle_level_network_protocol.txt')
-rw-r--r--docs/Tox_middle_level_network_protocol.txt17
1 files changed, 10 insertions, 7 deletions
diff --git a/docs/Tox_middle_level_network_protocol.txt b/docs/Tox_middle_level_network_protocol.txt
index 49ad330c..39b275d2 100644
--- a/docs/Tox_middle_level_network_protocol.txt
+++ b/docs/Tox_middle_level_network_protocol.txt
@@ -56,10 +56,12 @@ bytes)][Recievers real public key (32 bytes)]]
56 56
57Handshake packet: 57Handshake packet:
58[uint8_t 26][Cookie][nonce][Encrypted message containing: [random 24 bytes base 58[uint8_t 26][Cookie][nonce][Encrypted message containing: [random 24 bytes base
59nonce][session public key of the peer (32 bytes)]] 59nonce][session public key of the peer (32 bytes)][sha512 hash of the entire
60Cookie sitting outside the encrypted part][Other Cookie (used by the other to
61respond to the handshake packet)]]
60 62
61The handshake packet is encrypted using the real private key of the sender, the 63The handshake packet is encrypted using the real private key of the sender, the
62real private key of the reciever and the nonce. 64real private key of the receiver and the nonce.
63 65
64 66
65Alice wants to connect to bob. 67Alice wants to connect to bob.
@@ -68,15 +70,16 @@ Alice sends a cookie request packet to bob and gets a cookie response back.
68 70
69Alice then generates a nonce and a temporary public/private keypair. 71Alice then generates a nonce and a temporary public/private keypair.
70 72
71Alice then takes that nonce and just generated private key and the obtained 73Alice then takes that nonce and just generated private key, the obtained
72cookie and puts them in a handshake packet which she sends to bob. 74cookie, creates a new cookie and puts them in a handshake packet which she
75sends to bob.
73 76
74Bob gets the handshake packet, accepts the connection request, then generates a 77Bob gets the handshake packet, accepts the connection request, then generates a
75nonce and a temporary public/private keypair and sends a handshake packet back 78nonce and a temporary public/private keypair and sends a handshake packet back
76with this just generated information and with the cookie field being random 79with this just generated information and with the cookie field being the Other
77data/zeros. 80Cookie contained in the received handshake.
78 81
79Both then use these temporary keys to generate the session key with which every 82Both then use these temporary keys to generate the session key with which every
80data packet sent and recieved will be encrypted and decrypted. The nonce sent 83data packet sent and received will be encrypted and decrypted. The nonce sent
81in the handshake will be used to encrypt the first data packet sent, the nonce 84in the handshake will be used to encrypt the first data packet sent, the nonce
82+ 1 the second, the nonce + 2 the third and so on. 85+ 1 the second, the nonce + 2 the third and so on.