diff --git a/Network/XMPP/TLS.hs b/Network/XMPP/TLS.hs index ec301f8..7dfee6a 100644 --- a/Network/XMPP/TLS.hs +++ b/Network/XMPP/TLS.hs @@ -17,31 +17,29 @@ getTLSParams, handshake' ) where +import Crypto.Random (newGenIO, SystemRandom) import Network.TLS +import Network.TLS.Extra (cipher_AES128_SHA1) import Network.TLS.Cipher import GHC.IO.Handle (Handle, hPutStr, hFlush, hSetBuffering, hWaitForInput) getTLSParams :: TLSParams getTLSParams = TLSParams { pConnectVersion = TLS10 - , pAllowedVersions = [TLS10,TLS11] - , pCiphers = [cipher_AES256_SHA1] -- Check the rest - , pCompressions = [nullCompression] - , pWantClientCert = False - , pCertificates = [] - , onCertificatesRecv = \_ -> return True } -- Verify cert chain + , pAllowedVersions = [TLS10,TLS11] + , pCiphers = [cipher_AES128_SHA1] -- Check the rest + , pCompressions = [nullCompression] + , pWantClientCert = False + , pUseSecureRenegotiation = False -- TODO: No renegotiation + , pCertificates = [] + , pLogging = defaultLogging + , onCertificatesRecv = \_ -> return CertificateUsageAccept } -- Verify cert chain handshake' :: Handle -> String -> IO (Maybe TLSCtx) handshake' h s = do let t = getTLSParams - r <- makeSRandomGen - case r of - Right sr -> do - putStrLn $ show sr - c <- client t sr h - handshake c - putStrLn ">>>>TLS data sended<<<<" - return (Just c) - Left ge -> do - putStrLn $ show ge - return Nothing + r <- newGenIO :: IO SystemRandom -- Investigate limitations + c <- client t r h + handshake c + putStrLn ">>>>TLS data sended<<<<" + return (Just c) diff --git a/pontarius-xmpp.cabal b/pontarius-xmpp.cabal index e8e11fb..9ed3863 100644 --- a/pontarius-xmpp.cabal +++ b/pontarius-xmpp.cabal @@ -1,5 +1,5 @@ Name: pontarius-xmpp -Version: 0.0.6.0 +Version: 0.0.7.0 Cabal-Version: >= 1.6 Build-Type: Simple License: LGPL-3 @@ -33,7 +33,7 @@ Library Build-Depends: base >= 2 && < 5, parsec, enumerator, crypto-api, base64-string, pureMD5, utf8-string, network, xml-types, text, transformers, bytestring, binary, random, - xml-enumerator, tls ==0.4.1, containers, mtl, text-icu, + xml-enumerator, tls, tls-extra, containers, mtl, text-icu, stringprep, idna2008 ==0.0.1.0 -- Other-Modules: -- HS-Source-Dirs: @@ -65,5 +65,5 @@ Source-Repository this Type: darcs -- Module: Location: https://patch-tag.com/r/jonkri/pontarius-xmpp - Tag: 0.0.6.0 + Tag: 0.0.7.0 -- Subdir: