diff options
author | James Crayne <jim.crayne@gmail.com> | 2018-05-31 08:51:12 +0000 |
---|---|---|
committer | James Crayne <jim.crayne@gmail.com> | 2018-05-31 08:53:36 +0000 |
commit | 7bd177b781ffcf80da7c7955e9fdc34781bc395d (patch) | |
tree | 7a1d7dbfbeafe5d4265b5cc32483b22cd0f4d88a /src | |
parent | bc8c61dd7933f1cacd91282c0476f7bc46795daf (diff) |
improve documentation on HandshakeData
Diffstat (limited to 'src')
-rw-r--r-- | src/Network/Tox/Crypto/Transport.hs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Network/Tox/Crypto/Transport.hs b/src/Network/Tox/Crypto/Transport.hs index e23d1865..22a1b795 100644 --- a/src/Network/Tox/Crypto/Transport.hs +++ b/src/Network/Tox/Crypto/Transport.hs | |||
@@ -113,10 +113,18 @@ instance Serialize (Handshake Encrypted) where | |||
113 | put (Handshake cookie n24 dta) = put cookie >> put n24 >> put dta | 113 | put (Handshake cookie n24 dta) = put cookie >> put n24 >> put dta |
114 | 114 | ||
115 | data HandshakeData = HandshakeData | 115 | data HandshakeData = HandshakeData |
116 | { baseNonce :: Nonce24 -- ^ [24 bytes base nonce] | 116 | { baseNonce :: Nonce24 |
117 | , sessionKey :: PublicKey -- ^ [session public key of the peer (32 bytes)] | 117 | -- ^ 24 bytes base nonce, recipient uses this to encrypt packets sent to the one who sent this handshake |
118 | , cookieHash :: Digest SHA512 -- ^ [sha512 hash of the entire Cookie sitting outside the encrypted part] | 118 | -- adding one each time, so it can double as something like an approximate packet number |
119 | , otherCookie :: Cookie Encrypted -- ^ [Other Cookie (used by the other to respond to the handshake packet)] | 119 | , sessionKey :: PublicKey |
120 | -- ^ session public key of the peer (32 bytes) | ||
121 | -- The recipient of the handshake encrypts using this public key when sending CryptoPackets | ||
122 | , cookieHash :: Digest SHA512 | ||
123 | -- ^ sha512 hash of the entire Cookie sitting outside the encrypted part | ||
124 | -- This prevents a replay attack where a new cookie is inserted into | ||
125 | -- an old valid handshake packet | ||
126 | , otherCookie :: Cookie Encrypted | ||
127 | -- ^ Other Cookie (used by the repient to respond to the handshake packet) | ||
120 | } | 128 | } |
121 | 129 | ||
122 | instance Sized HandshakeData where | 130 | instance Sized HandshakeData where |