gsasl-0.3.1: Bindings for GNU SASL

Network.Protocol.SASL.GNU

Contents

Synopsis

Library Information

headerVersion :: (Integer, Integer, Integer)Source

Which version of gsasl.h this module was compiled against

libraryVersion :: IO (Integer, Integer, Integer)Source

Which version of libgsasl.so is loaded

checkVersion :: IO BoolSource

Whether the header and library versions are compatible

SASL Contexts

setCallback :: (Property -> Session Progress) -> SASL ()Source

Set the current SASL callback. The callback will be used by mechanisms to discover various parameters, such as usernames and passwords.

runCallback :: Property -> Session ProgressSource

Run the current callback; the property indicates what action the callback is expected to perform.

Mechanisms

clientMechanisms :: SASL [Mechanism]Source

A list of Mechanisms supported by the libgsasl client.

clientSupports :: Mechanism -> SASL BoolSource

Whether there is client-side support for a specified Mechanism.

clientSuggestMechanism :: [Mechanism] -> SASL (Maybe Mechanism)Source

Given a list of Mechanisms, suggest which to use (or Nothing if no supported Mechanism is found).

serverMechanisms :: SASL [Mechanism]Source

A list of Mechanisms supported by the libgsasl server.

serverSupports :: Mechanism -> SASL BoolSource

Whether there is server-side support for a specified Mechanism.

SASL Sessions

runClient :: Mechanism -> Session a -> SASL (Either Error a)Source

Run a session using the libgsasl client.

runServer :: Mechanism -> Session a -> SASL (Either Error a)Source

Run a session using the libgsasl server.

mechanismName :: Session MechanismSource

The name of the session's SASL mechanism.

Session Properties

setProperty :: Property -> ByteString -> Session ()Source

Store some data in the session for the given property. The data must be NULL-terminated.

getProperty :: Property -> Session (Maybe ByteString)Source

Retrieve the data stored in the session for the given property, possibly invoking the current callback to get the value.

getPropertyFast :: Property -> Session (Maybe ByteString)Source

Retrieve the data stored in the session for the given property, without invoking the current callback.

Session IO

data Progress Source

Constructors

Complete 
NeedsMore 

Instances

step :: ByteString -> Session (ByteString, Progress)Source

Perform one step of SASL authentication. This reads data from the other end, processes it (potentially running the callback), and returns data to be sent back.

Also returns NeedsMore if authentication is not yet complete.

step64 :: ByteString -> Session (ByteString, Progress)Source

A simple wrapper around step which uses base64 to decode the input and encode the output.

encode :: ByteString -> Session ByteStringSource

Encode data according to the negotiated SASL mechanism. This might mean the data is integrity or privacy protected.

decode :: ByteString -> Session ByteStringSource

Decode data according to the negotiated SASL mechanism. This might mean the data is integrity or privacy protected.

Error handling

Bundled codecs

hmacMD5Source

Arguments

:: ByteString

Key

-> ByteString

Input data

-> ByteString 

hmacSHA1Source

Arguments

:: ByteString

Key

-> ByteString

Input data

-> ByteString 

nonce :: Integer -> IO ByteStringSource

Returns unpredictable data of a given size

random :: Integer -> IO ByteStringSource

Returns cryptographically strong random data of a given size