hsgnutls-0.2.3.2: Library wrapping the GnuTLS API.

Network.GnuTLS

Contents

Synopsis

Documentation

Enumerations

data ConnectionEnd Source

Constructors

Server 
Client 

Instances

data AlertLevel Source

Constructors

AlWarning 
AlFatal 

Instances

data CloseRequest Source

Constructors

ShutRdwr 
ShutWr 

Instances

Types

data DH Source

Instances

data RSA Source

Instances

class Datum a whereSource

Methods

withDatum :: a -> (Ptr () -> IO b) -> IO bSource

Priority

class SetPriority a whereSource

Set the priority of the specified category. On servers this means the set of acceptable values, on clients it sets the priorities.

Methods

setPriority :: Session t -> [a] -> IO ()Source

setDefaultPriority :: Session t -> IO ()Source

Set default priorities. This is called whenever a new Session is created to ensure sensible defaults.

setDefaultExportPriority :: Session t -> IO ()Source

Set default priorities conforming with various export regulations. Includes weak algorithms.

Credentials

data Clear Source

Used to clear all credentials associated with a session.

Constructors

Clear 

Instances

Creating connections

Session Accessors

clientCert :: WriteAttr (Session Server) CertificateRequestSource

Set whether we want to do client authentication.

Managing connection

handshake :: Session t -> IO ()Source

Perform a handshake with the peer and initialize a TLS/SSL connection. Note that after the handshake completes applications must check whether a high enough level of confidentiality was established.

rehandshake :: Session Server -> IO ()Source

Tells the client that we want to renogotiate the handshake. If the function succeeds then handshake can be called again on the connection.

bye :: Session t -> CloseRequest -> IO ()Source

Terminates the current TLS connection, which has been succesfully established with handshake. Notifies the peer with an alert that the connection is closing.

setMaxHandshakePacketLength :: Session t -> Int -> IO ()Source

Set the maximum size of a handshake request. Larger requests are ignored. Defaults to 16kb which should be large enough.

Querying connection attributes

isResumed :: Session t -> IO BoolSource

Test whether this session is a resumed one.

getAlert :: Session t -> IO AlertDescriptionSource

Return the value of the last alert received - undefined if no alert has been received.

getCipher :: Session t -> IO CipherAlgorithmSource

Return the currently used cipher.

getKx :: Session t -> IO KxAlgorithmSource

Return the key exchange algorithm used in the last handshake.

getMac :: Session t -> IO MacAlgorithmSource

Return the mac algorithm currently used.

getCompression :: Session t -> IO CompressionMethodSource

Return the compression method currently used.

getCertificateType :: Session t -> IO CertificateTypeSource

Return the currently used certificate type.

getProtocol :: Session t -> IO ProtocolSource

Return the currently used protocol version.

getCredentialsType :: Session t -> IO CredentialsTypeSource

Return type of credentials for the current authentication schema.

getServerCredentialsType :: Session t -> IO CredentialsTypeSource

Return the type of credentials used for authenticating the server. Available with GnuTLS 1.2.

getClientCredentialsType :: Session t -> IO CredentialsTypeSource

Return the type of credentials used for authenticating the client. Available with GnuTLS 1.2.

getPeersCertificatesRaw :: Session t -> IO [(Ptr CChar, Int)]Source

Get the certificate chain of the peer. In the case of X509 will return DER encoded certificate list beginning with the peers key and continuing in the issuer chain. With OpenPGP a single key will be returned in the raw format.

Sending and receiving data

tlsSend :: Session t -> Ptr a -> Int -> IO IntSource

tlsRecv :: Session t -> Ptr a -> Int -> IO IntSource

Certificate functions

Miscellaneous

class CredParameter a whereSource

Methods

generate :: a -> Int -> IO ()Source

Generate a new key with the given number of bits.

cipherKeySize :: CipherAlgorithm -> IntSource

Return the cipher's key size in bytes.

cipherSuiteName :: KxAlgorithm -> CipherAlgorithm -> MacAlgorithm -> StringSource

Return the name of the ciphersuite.