gsasl-0.3.6: Bindings for GNU libgsasl

Safe HaskellNone
LanguageHaskell98

Network.Protocol.SASL.GNU

Contents

Synopsis

Library Information

headerVersion :: (Integer, Integer, Integer) #

Which version of gsasl.h this module was compiled against

libraryVersion :: IO (Integer, Integer, Integer) #

Which version of libgsasl.so is loaded

checkVersion :: IO Bool #

Whether the header and library versions are compatible

SASL Contexts

data SASL a #

Instances

Monad SASL # 

Methods

(>>=) :: SASL a -> (a -> SASL b) -> SASL b #

(>>) :: SASL a -> SASL b -> SASL b #

return :: a -> SASL a #

fail :: String -> SASL a #

Functor SASL # 

Methods

fmap :: (a -> b) -> SASL a -> SASL b #

(<$) :: a -> SASL b -> SASL a #

Applicative SASL # 

Methods

pure :: a -> SASL a #

(<*>) :: SASL (a -> b) -> SASL a -> SASL b #

liftA2 :: (a -> b -> c) -> SASL a -> SASL b -> SASL c #

(*>) :: SASL a -> SASL b -> SASL b #

(<*) :: SASL a -> SASL b -> SASL a #

MonadIO SASL # 

Methods

liftIO :: IO a -> SASL a #

runSASL :: SASL a -> IO a #

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

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

runCallback :: Property -> Session Progress #

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

Mechanisms

clientMechanisms :: SASL [Mechanism] #

A list of Mechanisms supported by the libgsasl client.

clientSupports :: Mechanism -> SASL Bool #

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

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

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

serverMechanisms :: SASL [Mechanism] #

A list of Mechanisms supported by the libgsasl server.

serverSupports :: Mechanism -> SASL Bool #

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

SASL Sessions

data Session a #

Instances

Monad Session # 

Methods

(>>=) :: Session a -> (a -> Session b) -> Session b #

(>>) :: Session a -> Session b -> Session b #

return :: a -> Session a #

fail :: String -> Session a #

Functor Session # 

Methods

fmap :: (a -> b) -> Session a -> Session b #

(<$) :: a -> Session b -> Session a #

Applicative Session # 

Methods

pure :: a -> Session a #

(<*>) :: Session (a -> b) -> Session a -> Session b #

liftA2 :: (a -> b -> c) -> Session a -> Session b -> Session c #

(*>) :: Session a -> Session b -> Session b #

(<*) :: Session a -> Session b -> Session a #

MonadIO Session # 

Methods

liftIO :: IO a -> Session a #

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

Run a session using the libgsasl client.

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

Run a session using the libgsasl server.

mechanismName :: Session Mechanism #

The name of the session's SASL mechanism.

Session Properties

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

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

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

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) #

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

Session IO

data Progress #

Constructors

Complete 
NeedsMore 

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

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) #

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

encode :: ByteString -> Session ByteString #

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

decode :: ByteString -> Session ByteString #

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

Error handling

catch :: Session a -> (Error -> Session a) -> Session a #

handle :: (Error -> Session a) -> Session a -> Session a #

Bundled codecs

hmacMD5 #

Arguments

:: ByteString

Key

-> ByteString

Input data

-> ByteString 

hmacSHA1 #

Arguments

:: ByteString

Key

-> ByteString

Input data

-> ByteString 

nonce :: Integer -> IO ByteString #

Returns unpredictable data of a given size

random :: Integer -> IO ByteString #

Returns cryptographically strong random data of a given size