summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/Crypto.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/docs/Crypto.txt b/docs/Crypto.txt
index 0f7d42da..817c1472 100644
--- a/docs/Crypto.txt
+++ b/docs/Crypto.txt
@@ -40,14 +40,18 @@ only crypto_box() is used for encryption and only crypto_box_open() for decrypti
40 40
41Connecting to an already added friend: 41Connecting to an already added friend:
42 Alice and Bob are friends. 42 Alice and Bob are friends.
43 As soon as they connect they each send themselves the following packet (the crypto handshake) (encrypted part encrypted with the public nonce in the packet 43 As soon as they connect they each generate a new keypair which will only be used for the current connection (The session keys).
44 They then send themselves the following packet (the crypto handshake) (encrypted part encrypted with the public nonce in the packet
44 the public key of the receiver and private key of the sender) 45 the public key of the receiver and private key of the sender)
45 [char with a value of 02][Senders Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted message containing a random 24 bytes base nonce] 46 [char with a value of 02][Senders Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted message containing a random 24 bytes base nonce and the session public key of the peer]
47
46 If the packet is decrypted successfully: 48 If the packet is decrypted successfully:
47 Each start using the secret nonce provided by the other to encrypt data packets (adding to it + 1 for each packet.) 49 Each start using the secret nonce, the public key provided by the other and their own session private key to encrypt data packets (adding to it + 1 for each packet.)
48 Each node sends themselves an empty data packet (data packet with 4 encrypted zero bytes) 50 Each node sends themselves an empty data packet (data packet with 4 encrypted zero bytes)
49 Data packet: 51 Data packet:
50 [char with a value of 03][Encrypted data] 52 [char with a value of 03][Encrypted data]
51 Each data packet received it is decrypted using the secret nonce sent to the other(with +1 added for the first packet +2 for the second, etc...) 53 Each data packet received it is decrypted using the secret nonce sent to the other(with +1 added for the first packet +2 for the second, etc...)
54 along with the private session key of the reciever.
52 Every data packet sent is encrypted using the secret nonce we received (with +1 added for the first packet +2 for the second, etc...) 55 Every data packet sent is encrypted using the secret nonce we received (with +1 added for the first packet +2 for the second, etc...)
56 the session public key of the reciever and the session private key of the sender.
53 The encrypted connection is only deemed successful when a data packet is received and decrypted successfully. 57 The encrypted connection is only deemed successful when a data packet is received and decrypted successfully.