tls-0.6.0: TLS/SSL protocol native implementation (Server and Client)

Portabilityunknown
Stabilityexperimental
MaintainerVincent Hanquez <vincent@snarc.org>

Network.TLS

Contents

Description

 

Synopsis

Context configuration

data TLSParams Source

Constructors

TLSParams 

Fields

pConnectVersion :: Version

version to use on client connection.

pAllowedVersions :: [Version]

allowed versions that we can use.

pCiphers :: [Cipher]

all ciphers supported ordered by priority.

pCompressions :: [Compression]

all compression supported ordered by priority.

pWantClientCert :: Bool

request a certificate from client. use by server only.

pCertificates :: [(X509, Maybe PrivateKey)]

the cert chain for this context with the associated keys if any.

onCertificatesRecv :: [X509] -> IO Bool

callback to verify received cert chain.

Instances

Context object

data TLSCtx Source

A TLS Context is a handle augmented by tls specific state and parameters

ctxHandle :: TLSCtx -> HandleSource

return the handle associated with this context

Creating a context

client :: (MonadIO m, CryptoRandomGen g) => TLSParams -> g -> Handle -> m TLSCtxSource

Create a new Client context with a configuration, a RNG, and a Handle. It reconfigures the handle buffermode to noBuffering

server :: (MonadIO m, CryptoRandomGen g) => TLSParams -> g -> Handle -> m TLSCtxSource

Create a new Server context with a configuration, a RNG, and a Handle. It reconfigures the handle buffermode to noBuffering

Initialisation and Termination of context

bye :: MonadIO m => TLSCtx -> m ()Source

notify the context that this side wants to close connection. this is important that it is called before closing the handle, otherwise the session might not be resumable (for version < TLS1.2).

this doesn't actually close the handle

handshake :: MonadIO m => TLSCtx -> m ()Source

Handshake for a new TLS connection This is to be called at the beginning of a connection, and during renegociation

High level API

sendData :: MonadIO m => TLSCtx -> ByteString -> m ()Source

sendData sends a bunch of data. It will automatically chunk data to acceptable packet size

recvData :: MonadIO m => TLSCtx -> m ByteStringSource

recvData get data out of Data packet, and automatically renegociate if a Handshake ClientHello is received

Crypto Key

data PrivateKey Source

Constructors

PrivRSA PrivateKey 

Instances

Compressions & Predefined compressions

data Compression Source

Compression algorithm

Instances

nullCompression :: CompressionSource

default null compression

Ciphers & Predefined ciphers

data Cipher Source

Cipher algorithm

Instances

Versions

data Version Source

Versions known to TLS

SSL2 is just defined, but this version is and will not be supported.

TLS12 is not yet supported

Constructors

SSL2 
SSL3 
TLS10 
TLS11 
TLS12 

Errors