|
|
|
@ -1,14 +1,16 @@ |
|
|
|
{-# OPTIONS_HADDOCK hide #-} |
|
|
|
{-# OPTIONS_HADDOCK hide #-} |
|
|
|
{-# LANGUAGE DeriveDataTypeable #-} |
|
|
|
{-# LANGUAGE DeriveDataTypeable #-} |
|
|
|
{-# LANGUAGE OverloadedStrings #-} |
|
|
|
{-# LANGUAGE OverloadedStrings #-} |
|
|
|
|
|
|
|
{-# LANGUAGE PackageImports #-} |
|
|
|
|
|
|
|
|
|
|
|
module Network.Xmpp.Tls where |
|
|
|
module Network.Xmpp.Tls where |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import Control.Applicative ((<$>)) |
|
|
|
import qualified Control.Exception.Lifted as Ex |
|
|
|
import qualified Control.Exception.Lifted as Ex |
|
|
|
import Control.Monad |
|
|
|
import Control.Monad |
|
|
|
import Control.Monad.Error |
|
|
|
import Control.Monad.Error |
|
|
|
import Control.Monad.State.Strict |
|
|
|
import Control.Monad.State.Strict |
|
|
|
import Crypto.Random.API |
|
|
|
import "crypto-random" Crypto.Random |
|
|
|
import qualified Data.ByteString as BS |
|
|
|
import qualified Data.ByteString as BS |
|
|
|
import qualified Data.ByteString.Char8 as BSC8 |
|
|
|
import qualified Data.ByteString.Char8 as BSC8 |
|
|
|
import qualified Data.ByteString.Lazy as BL |
|
|
|
import qualified Data.ByteString.Lazy as BL |
|
|
|
@ -121,7 +123,7 @@ tlsinit :: (MonadIO m, MonadIO m1) => |
|
|
|
) |
|
|
|
) |
|
|
|
tlsinit params backend = do |
|
|
|
tlsinit params backend = do |
|
|
|
liftIO $ debugM "Pontarius.Xmpp.Tls" "TLS with debug mode enabled." |
|
|
|
liftIO $ debugM "Pontarius.Xmpp.Tls" "TLS with debug mode enabled." |
|
|
|
gen <- liftIO $ getSystemRandomGen -- TODO: Find better random source? |
|
|
|
gen <- liftIO (cprgCreate <$> createEntropyPool :: IO SystemRNG) |
|
|
|
con <- client params gen backend |
|
|
|
con <- client params gen backend |
|
|
|
handshake con |
|
|
|
handshake con |
|
|
|
let src = forever $ do |
|
|
|
let src = forever $ do |
|
|
|
|