Created
August 21, 2012 06:50
-
-
Save nullren/3412792 to your computer and use it in GitHub Desktop.
Network.TLS failed handshake on irc.oftc.net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.IO | |
import Network.TLS | |
import Network.TLS.Extra | |
import Crypto.Random | |
import Text.Printf | |
import qualified Control.Exception as E | |
import qualified Data.ByteString.Lazy.Char8 as L | |
import qualified Data.ByteString.Char8 as B | |
import Control.Monad | |
host = "irc.oftc.net" | |
port = "6697" | |
params = defaultParams {pCiphers = ciphersuite_all} | |
-- | Makes a SSL connection to the server. | |
connect_ssl :: IO () | |
connect_ssl = do | |
gen <- newGenIO :: IO SystemRandom | |
ctx <- connectionClient host port params gen | |
handshake ctx | |
let setnick = L.pack "NICK testderp\r\nUSER testderp 0 * :Testing the derp\r\n" | |
sendData ctx setnick | |
listen ctx | |
listen :: TLSCtx a -> IO () | |
listen ctx = forever $ do | |
out <- recvData ctx | |
B.putStr out | |
main :: IO () | |
main = connect_ssl | |
{- | |
$ runhaskell ssltest.hs | |
ssltest.hs: HandshakeFailed (Error_Packet_Parsing "Failed reading: certrequest distinguishname not of the correct size\nFrom:\thandshake\n\n") | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment