Browse Source

started using the latest version of the tls package

master
Jon Kristensen 15 years ago
parent
commit
9107b5a411
  1. 18
      Network/XMPP/TLS.hs
  2. 6
      pontarius-xmpp.cabal

18
Network/XMPP/TLS.hs

@ -17,7 +17,9 @@ getTLSParams,
handshake' handshake'
) where ) where
import Crypto.Random (newGenIO, SystemRandom)
import Network.TLS import Network.TLS
import Network.TLS.Extra (cipher_AES128_SHA1)
import Network.TLS.Cipher import Network.TLS.Cipher
import GHC.IO.Handle (Handle, hPutStr, hFlush, hSetBuffering, hWaitForInput) import GHC.IO.Handle (Handle, hPutStr, hFlush, hSetBuffering, hWaitForInput)
@ -25,23 +27,19 @@ import GHC.IO.Handle (Handle, hPutStr, hFlush, hSetBuffering, hWaitForInput)
getTLSParams :: TLSParams getTLSParams :: TLSParams
getTLSParams = TLSParams { pConnectVersion = TLS10 getTLSParams = TLSParams { pConnectVersion = TLS10
, pAllowedVersions = [TLS10,TLS11] , pAllowedVersions = [TLS10,TLS11]
, pCiphers = [cipher_AES256_SHA1] -- Check the rest , pCiphers = [cipher_AES128_SHA1] -- Check the rest
, pCompressions = [nullCompression] , pCompressions = [nullCompression]
, pWantClientCert = False , pWantClientCert = False
, pUseSecureRenegotiation = False -- TODO: No renegotiation
, pCertificates = [] , pCertificates = []
, onCertificatesRecv = \_ -> return True } -- Verify cert chain , pLogging = defaultLogging
, onCertificatesRecv = \_ -> return CertificateUsageAccept } -- Verify cert chain
handshake' :: Handle -> String -> IO (Maybe TLSCtx) handshake' :: Handle -> String -> IO (Maybe TLSCtx)
handshake' h s = do handshake' h s = do
let t = getTLSParams let t = getTLSParams
r <- makeSRandomGen r <- newGenIO :: IO SystemRandom -- Investigate limitations
case r of c <- client t r h
Right sr -> do
putStrLn $ show sr
c <- client t sr h
handshake c handshake c
putStrLn ">>>>TLS data sended<<<<" putStrLn ">>>>TLS data sended<<<<"
return (Just c) return (Just c)
Left ge -> do
putStrLn $ show ge
return Nothing

6
pontarius-xmpp.cabal

@ -1,5 +1,5 @@
Name: pontarius-xmpp Name: pontarius-xmpp
Version: 0.0.6.0 Version: 0.0.7.0
Cabal-Version: >= 1.6 Cabal-Version: >= 1.6
Build-Type: Simple Build-Type: Simple
License: LGPL-3 License: LGPL-3
@ -33,7 +33,7 @@ Library
Build-Depends: base >= 2 && < 5, parsec, enumerator, crypto-api, Build-Depends: base >= 2 && < 5, parsec, enumerator, crypto-api,
base64-string, pureMD5, utf8-string, network, xml-types, base64-string, pureMD5, utf8-string, network, xml-types,
text, transformers, bytestring, binary, random, 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 stringprep, idna2008 ==0.0.1.0
-- Other-Modules: -- Other-Modules:
-- HS-Source-Dirs: -- HS-Source-Dirs:
@ -65,5 +65,5 @@ Source-Repository this
Type: darcs Type: darcs
-- Module: -- Module:
Location: https://patch-tag.com/r/jonkri/pontarius-xmpp Location: https://patch-tag.com/r/jonkri/pontarius-xmpp
Tag: 0.0.6.0 Tag: 0.0.7.0
-- Subdir: -- Subdir:

Loading…
Cancel
Save