summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Crypto/Handlers.hs
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2018-05-29 06:59:11 +0000
committerJames Crayne <jim.crayne@gmail.com>2018-05-29 06:59:11 +0000
commit24fc5b3077dc8ea810a7b1d6c685a29c26562ad7 (patch)
tree9f884aa3ddf2898bcc75684cb620e30e62dd3844 /src/Network/Tox/Crypto/Handlers.hs
parentbef702cf30f1386a5ad11abaee6f37f6e496138f (diff)
handshake nonce debug prints
Diffstat (limited to 'src/Network/Tox/Crypto/Handlers.hs')
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index d192e42e..485c5219 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -553,8 +553,20 @@ cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) non
553 (CookieData cookieTime remotePubkey remoteDhtkey) <- (decodePlain =<< decryptSymmetric symkey n24 ecookie) 553 (CookieData cookieTime remotePubkey remoteDhtkey) <- (decodePlain =<< decryptSymmetric symkey n24 ecookie)
554 Right $ do -- IO Monad 554 Right $ do -- IO Monad
555 decrypted <- anyRight seckeys $ \key -> do 555 decrypted <- anyRight seckeys $ \key -> do
556 dput XNetCrypto $ "cryptoNetHandler: remotePubkey = " ++ show (key2id $ remotePubkey)
557 dput XNetCrypto $ "cryptoNetHandler: nonce24 = " ++ show nonce24
556 secret <- lookupSharedSecret crypto key remotePubkey nonce24 558 secret <- lookupSharedSecret crypto key remotePubkey nonce24
557 return $ (key,) <$> (decodePlain =<< decrypt secret encrypted) 559 let step1 = decrypt secret encrypted
560 case step1 of
561 Left s -> do
562 dput XNetCrypto $ "cryptoNetHandler: (decrypt) " ++ s
563 return (Left s)
564 Right pln -> do
565 case decodePlain pln of
566 Left s -> do
567 dput XNetCrypto $ "cryptoNetHandler: (decodePlain) " ++ s
568 return (Left s)
569 Right x -> return (Right (key,x))
558 return $ do -- Either Monad 570 return $ do -- Either Monad
559 (key,HandshakeData { baseNonce, sessionKey, cookieHash, otherCookie }) <- decrypted 571 (key,HandshakeData { baseNonce, sessionKey, cookieHash, otherCookie }) <- decrypted
560 -- check cookie time < 15 seconds ago 572 -- check cookie time < 15 seconds ago