|
|
|
@ -110,9 +110,8 @@ tls con = fmap join -- We can have Left values both from exceptions and the |
|
|
|
modify (\s -> s{streamConnectionState = Secured}) |
|
|
|
modify (\s -> s{streamConnectionState = Secured}) |
|
|
|
return () |
|
|
|
return () |
|
|
|
|
|
|
|
|
|
|
|
client :: (MonadIO m, CPRG rng) => ClientParams -> rng -> Backend -> m Context |
|
|
|
client :: MonadIO m => ClientParams -> Backend -> m Context |
|
|
|
client params gen backend = do |
|
|
|
client params backend = contextNew backend params |
|
|
|
contextNew backend params gen |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tlsinit :: (MonadIO m, MonadIO m1) => |
|
|
|
tlsinit :: (MonadIO m, MonadIO m1) => |
|
|
|
ClientParams |
|
|
|
ClientParams |
|
|
|
@ -125,12 +124,12 @@ 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 (cprgCreate <$> createEntropyPool :: IO SystemRNG) |
|
|
|
-- gen <- liftIO (cprgCreate <$> createEntropyPool :: IO SystemRNG) |
|
|
|
sysCStore <- liftIO getSystemCertificateStore |
|
|
|
sysCStore <- liftIO getSystemCertificateStore |
|
|
|
let params' = params{clientShared = |
|
|
|
let params' = params{clientShared = |
|
|
|
(clientShared params){ sharedCAStore = |
|
|
|
(clientShared params){ sharedCAStore = |
|
|
|
sysCStore <> sharedCAStore (clientShared params)}} |
|
|
|
sysCStore <> sharedCAStore (clientShared params)}} |
|
|
|
con <- client params' gen backend |
|
|
|
con <- client params' backend |
|
|
|
handshake con |
|
|
|
handshake con |
|
|
|
let src = forever $ do |
|
|
|
let src = forever $ do |
|
|
|
dt <- liftIO $ recvData con |
|
|
|
dt <- liftIO $ recvData con |
|
|
|
|