| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
System.IO.Streams.SSL
Description
This module provides convenience functions for interfacing io-streams
with HsOpenSSL. It is intended to be imported qualified, e.g.:
import qualified OpenSSL as SSL import qualified OpenSSL.Session as SSL import qualified System.IO.Streams.SSL as SSLStreams example :: IO (InputStreamByteString,OutputStreamByteString) example = SSL.withOpenSSL$ do ctx <- SSL.contextSSL.contextSetDefaultCiphersctx -- Note: the location of the system certificates is system-dependent, -- on Linux systems this is usually "/etc/ssl/certs". This -- step is optional if you choose to disable certificate verification -- (not recommended!). SSL.contextSetCADirectoryctx "/etc/ssl/certs" SSL.contextSetVerificationModectx $ SSL.VerifyPeerTrue True Nothing SSLStreams.connectctx "foo.com" 4444
Synopsis
- connect :: SSLContext -> HostName -> PortNumber -> IO (InputStream ByteString, OutputStream ByteString, SSL)
- withConnection :: SSLContext -> HostName -> PortNumber -> (InputStream ByteString -> OutputStream ByteString -> SSL -> IO a) -> IO a
- sslToStreams :: SSL -> IO (InputStream ByteString, OutputStream ByteString)
Documentation
Arguments
| :: SSLContext | SSL context. See the |
| -> HostName | hostname to connect to |
| -> PortNumber | port number to connect to |
| -> IO (InputStream ByteString, OutputStream ByteString, SSL) |
Convenience function for initiating an SSL connection to the given
( combination.HostName, PortNumber)
Note that sending an end-of-file to the returned OutputStream will not
close the underlying SSL connection; to do that, call:
SSL.shutdownssl SSL.Unidirectionalmaybe (return ())close$ SSL.sslSocketssl
on the returned SSL object.
Arguments
| :: SSLContext | SSL context. See the |
| -> HostName | hostname to connect to |
| -> PortNumber | port number to connect to |
| -> (InputStream ByteString -> OutputStream ByteString -> SSL -> IO a) | Action to run with the new connection |
| -> IO a |
Convenience function for initiating an SSL connection to the given
( combination. The socket and SSL connection are
closed and deleted after the user handler runs.HostName, PortNumber)
Since: 1.2.0.0.
Arguments
| :: SSL | SSL connection object |
| -> IO (InputStream ByteString, OutputStream ByteString) |
Given an existing HsOpenSSL SSL connection, produces an InputStream /
OutputStream pair.