iterIO-0.1: Iteratee-based IO with pipe operators

Data.IterIO.SSL

Synopsis

Documentation

newtype SslConnection Source

A wrapper around the type SSL to make it an instance of the Typeable class.

Constructors

SslConnection 

Fields

unSslConnection :: SSL
 

data SslC Source

Control request to fetch the SSL object associated with an enumerator.

Constructors

SslC 

enumSsl :: MonadIO m => SSL -> Onum ByteString m aSource

Simple OpenSSL Onum.

sslI :: MonadIO m => SSL -> Iter ByteString m ()Source

Simple OpenSSL Iter. Does a uni-directional SSL shutdown when it receives a Chunk with the EOF bit True.

iterSSLSource

Arguments

:: MonadIO m 
=> SSLContext

OpenSSL context

-> Socket

The socket

-> Bool

True for server handshake, False for client

-> IO (Iter ByteString m (), Onum ByteString m a) 

Turn a socket into an Iter and Onum that use OpenSSL to write to and read from the socket, respectively. Does an SSL bi-directional shutdown and closes the socket when both a) the enum completes and b) the iter has received an EOF chunk.

If the SSL handshake fails, then iterSSL closes the socket before throwing an exception.

This funciton must only be invoked from within a call to withOpenSSL.

simpleContext :: FilePath -> IO SSLContextSource

Simplest possible SSL context, loads cert and unencrypted private key from a single file.

genSelfSignedSource

Arguments

:: FilePath

Filename in which to output key

-> String

Common Name (usually domain name)

-> IO () 

Quick and dirty funciton to generate a self signed certificate for testing and stick it in a file. E.g.:

 genSelfSigned "testkey.pem" "localhost"