commsec-0.2.1: Provide communications security using symmetric ephemeral keys description: This package provides confidentiallity, integrity and replay detection. Users must provide ephemeral keys for one time use (reuse will compromise the security guarentees). Starting with shared secret, this package builds bi-directional channels for datagram based communication.

Safe HaskellNone

Network.CommSec

Contents

Synopsis

Types

data Connection Source

A connection is a secure bidirectional communication channel.

Constructors

Conn 

Fields

inCtx :: MVar InContext
 
outCtx :: MVar OutContext
 
socket :: Socket
 

data CommSecError Source

Errors that can be returned by the decoding/receicing operations.

Send and receive operations

sendPtr :: Connection -> Ptr Word8 -> Int -> IO ()Source

Sends a message over the connection.

recvPtr :: Connection -> Ptr Word8 -> Int -> IO IntSource

Blocks till it receives a valid message, placing the resulting plaintext in the provided buffer. If the incoming message is larger that the provided buffer then the message is truncated. This process also incurs an additional copy.

Establishing a connection from a shared secret

accept :: ByteString -> PortNumber -> IO ConnectionSource

Expands the provided 128 (or more) bit secret into two keys to create a connection.

ex: accept ent 3134

connect :: ByteString -> HostName -> PortNumber -> IO ConnectionSource

Expands the provided 128 (or more) bit secret into two keys to create a connection.

Establishing a connection from a public identity (PKI)