diff options
Diffstat (limited to 'src/Network/Tox')
-rw-r--r-- | src/Network/Tox/Handshake.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Network/Tox/Handshake.hs b/src/Network/Tox/Handshake.hs index c51f6369..0ca99fe2 100644 --- a/src/Network/Tox/Handshake.hs +++ b/src/Network/Tox/Handshake.hs | |||
@@ -34,25 +34,25 @@ decryptHandshake crypto hshake@(Handshake (Cookie n24 ecookie) nonce24 encrypted | |||
34 | (ukeys,symkey) <- atomically $ (,) <$> userKeys crypto | 34 | (ukeys,symkey) <- atomically $ (,) <$> userKeys crypto |
35 | <*> transportSymmetric crypto | 35 | <*> transportSymmetric crypto |
36 | let seckeys = map fst ukeys | 36 | let seckeys = map fst ukeys |
37 | dput XNetCrypto "decryptHandshake: trying the following keys:" | ||
38 | now <- getPOSIXTime | 37 | now <- getPOSIXTime |
39 | forM_ seckeys $ \k -> dput XNetCrypto $ " " ++ show (key2id . toPublic $ k) | 38 | -- dput XNetCrypto "decryptHandshake: trying the following keys:" |
39 | -- forM_ seckeys $ \k -> dput XNetCrypto $ " " ++ show (key2id . toPublic $ k) | ||
40 | fmap join . sequence $ do -- Either Monad | 40 | fmap join . sequence $ do -- Either Monad |
41 | cd@(CookieData cookieTime remotePubkey remoteDhtkey) <- decodePlain =<< decryptSymmetric symkey n24 ecookie | 41 | cd@(CookieData cookieTime remotePubkey remoteDhtkey) <- decodePlain =<< decryptSymmetric symkey n24 ecookie |
42 | Right $ do -- IO Monad | 42 | Right $ do -- IO Monad |
43 | decrypted <- anyRight "missing key" seckeys $ \key -> do | 43 | decrypted <- anyRight "missing key" seckeys $ \key -> do |
44 | dput XNetCrypto $ "(NetCrypto)handshakeH: remotePubkey = " ++ show (key2id $ remotePubkey) | 44 | -- dput XNetCrypto $ "(NetCrypto)handshakeH: remotePubkey = " ++ show (key2id $ remotePubkey) |
45 | dput XNetCrypto $ "(NetCrypto)handshakeH: nonce24 = " ++ show nonce24 | 45 | -- dput XNetCrypto $ "(NetCrypto)handshakeH: nonce24 = " ++ show nonce24 |
46 | secret <- lookupSharedSecret crypto key remotePubkey nonce24 | 46 | secret <- lookupSharedSecret crypto key remotePubkey nonce24 |
47 | let step1 = decrypt secret encrypted | 47 | let step1 = decrypt secret encrypted |
48 | case step1 of | 48 | case step1 of |
49 | Left s -> do | 49 | Left s -> do |
50 | dput XNetCrypto $ "(NetCrypto)handshakeH: (decrypt) " ++ s | 50 | -- dput XNetCrypto $ "(NetCrypto)handshakeH: (decrypt) " ++ s |
51 | return (Left s) | 51 | return (Left s) |
52 | Right pln -> do | 52 | Right pln -> do |
53 | case decodePlain pln of | 53 | case decodePlain pln of |
54 | Left s -> do | 54 | Left s -> do |
55 | dput XNetCrypto $ "(NetCrypto)handshakeH: (decodePlain) " ++ s | 55 | -- dput XNetCrypto $ "(NetCrypto)handshakeH: (decodePlain) " ++ s |
56 | return (Left s) | 56 | return (Left s) |
57 | Right x -> return (Right (key,x)) | 57 | Right x -> return (Right (key,x)) |
58 | return $ do -- Either Monad | 58 | return $ do -- Either Monad |