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

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell98

Network.TLS

Contents

Description

 
Synopsis

Context configuration

data ClientParams Source #

Constructors

ClientParams 

Fields

Instances
Show ClientParams Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

showsPrec :: Int -> ClientParams -> ShowS

show :: ClientParams -> String

showList :: [ClientParams] -> ShowS

TLSParams ClientParams Source # 
Instance details

Defined in Network.TLS.Context

type HostName = String #

type Bytes = ByteString Source #

Deprecated: Use Data.ByteString.Bytestring instead of Bytes.

data ServerParams Source #

Constructors

ServerParams 

Fields

Instances
Show ServerParams Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

showsPrec :: Int -> ServerParams -> ShowS

show :: ServerParams -> String

showList :: [ServerParams] -> ShowS

Default ServerParams Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

def :: ServerParams

TLSParams ServerParams Source # 
Instance details

Defined in Network.TLS.Context

data DebugParams Source #

All settings should not be used in production

Constructors

DebugParams 

Fields

  • debugSeed :: Maybe Seed

    Disable the true randomness in favor of deterministic seed that will produce a deterministic random from. This is useful for tests and debugging purpose. Do not use in production

  • debugPrintSeed :: Seed -> IO ()

    Add a way to print the seed that was randomly generated. re-using the same seed will reproduce the same randomness with debugSeed

Instances
Show DebugParams Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

showsPrec :: Int -> DebugParams -> ShowS

show :: DebugParams -> String

showList :: [DebugParams] -> ShowS

Default DebugParams Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

def :: DebugParams

type DHParams = Params Source #

type DHPublic = PublicNumber Source #

data ClientHooks Source #

A set of callbacks run by the clients for various corners of TLS establishment

Constructors

ClientHooks 

Fields

  • onCertificateRequest :: ([CertificateType], Maybe [HashAndSignatureAlgorithm], [DistinguishedName]) -> IO (Maybe (CertificateChain, PrivKey))

    This action is called when the server sends a certificate request. The parameter is the information from the request. The action should select a certificate chain of one of the given certificate types where the last certificate in the chain should be signed by one of the given distinguished names. Each certificate should be signed by the following one, except for the last. At least the first of the certificates in the chain must have a corresponding private key, because that is used for signing the certificate verify message.

    Note that is is the responsibility of this action to select a certificate matching one of the requested certificate types. Returning a non-matching one will lead to handshake failure later.

    Returning a certificate chain not matching the distinguished names may lead to problems or not, depending whether the server accepts it.

  • onServerCertificate :: CertificateStore -> ValidationCache -> ServiceID -> CertificateChain -> IO [FailedReason]

    Used by the client to validate the server certificate. The default implementation calls validateDefault which validates according to the default hooks and checks provided by Data.X509.Validation. This can be replaced with a custom validation function using different settings.

  • onSuggestALPN :: IO (Maybe [ByteString])

    This action is called when the client sends ClientHello to determine ALPN values such as '["h2", "http/1.1"]'.

  • onCustomFFDHEGroup :: DHParams -> DHPublic -> IO GroupUsage

    This action is called to validate DHE parameters when the server selected a finite-field group not part of the "Supported Groups Registry". See RFC 7919 section 3.1 for recommandations.

Instances
Show ClientHooks Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

showsPrec :: Int -> ClientHooks -> ShowS

show :: ClientHooks -> String

showList :: [ClientHooks] -> ShowS

Default ClientHooks Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

def :: ClientHooks

data ServerHooks Source #

A set of callbacks run by the server for various corners of the TLS establishment

Constructors

ServerHooks 

Fields

  • onClientCertificate :: CertificateChain -> IO CertificateUsage

    This action is called when a client certificate chain is received from the client. When it returns a CertificateUsageReject value, the handshake is aborted.

  • onUnverifiedClientCert :: IO Bool

    This action is called when the client certificate cannot be verified. Return True to accept the certificate anyway, or False to fail verification.

  • onCipherChoosing :: Version -> [Cipher] -> Cipher

    Allow the server to choose the cipher relative to the the client version and the client list of ciphers.

    This could be useful with old clients and as a workaround to the BEAST (where RC4 is sometimes prefered with TLS < 1.1)

    The client cipher list cannot be empty.

  • onServerNameIndication :: Maybe HostName -> IO Credentials

    Allow the server to indicate additional credentials to be used depending on the host name indicated by the client.

    This is most useful for transparent proxies where credentials must be generated on the fly according to the host the client is trying to connect to.

    Returned credentials may be ignored if a client does not support the signature algorithms used in the certificate chain.

  • onNewHandshake :: Measurement -> IO Bool

    at each new handshake, we call this hook to see if we allow handshake to happens.

  • onALPNClientSuggest :: Maybe ([ByteString] -> IO ByteString)

    Allow the server to choose an application layer protocol suggested from the client through the ALPN (Application Layer Protocol Negotiation) extensions.

Instances
Show ServerHooks Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

showsPrec :: Int -> ServerHooks -> ShowS

show :: ServerHooks -> String

showList :: [ServerHooks] -> ShowS

Default ServerHooks Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

def :: ServerHooks

data Supported Source #

List all the supported algorithms, versions, ciphers, etc supported.

Constructors

Supported 

Fields

  • supportedVersions :: [Version]

    Supported Versions by this context On the client side, the highest version will be used to establish the connection. On the server side, the highest version that is less or equal than the client version will be chosed.

  • supportedCiphers :: [Cipher]

    Supported cipher methods. The default is empty, specify a suitable cipher list. ciphersuite_default is often a good choice.

  • supportedCompressions :: [Compression]

    supported compressions methods

  • supportedHashSignatures :: [HashAndSignatureAlgorithm]

    All supported hash/signature algorithms pair for client certificate verification and server signature in (EC)DHE, ordered by decreasing priority.

    This list is sent to the peer as part of the signature_algorithms extension. It is also used to restrict the choice of server credential, signature and hash algorithm, but only when the TLS version is 1.2 or above. In order to disable SHA-1 one must then also disable earlier protocol versions in supportedVersions.

  • supportedSecureRenegotiation :: Bool

    Secure renegotiation defined in RFC5746. If True, clients send the renegotiation_info extension. If True, servers handle the extension or the renegotiation SCSV then send the renegotiation_info extension.

  • supportedClientInitiatedRenegotiation :: Bool

    If True, renegotiation is allowed from the client side. This is vulnerable to DOS attacks. If False, renegotiation is allowed only from the server side via HelloRequest.

  • supportedSession :: Bool

    Set if we support session.

  • supportedFallbackScsv :: Bool

    Support for fallback SCSV defined in RFC7507. If True, servers reject handshakes which suggest a lower protocol than the highest protocol supported.

  • supportedEmptyPacket :: Bool

    In ver <= TLS1.0, block ciphers using CBC are using CBC residue as IV, which can be guessed by an attacker. Hence, an empty packet is normally sent before a normal data packet, to prevent guessability. Some Microsoft TLS-based protocol implementations, however, consider these empty packets as a protocol violation and disconnect. If this parameter is False, empty packets will never be added, which is less secure, but might help in rare cases.

  • supportedGroups :: [Group]

    A list of supported elliptic curves and finite-field groups in the preferred order. The default value is [X25519,P256,P384,P521]. X25519 and P256 provide 128-bit security which is strong enough until 2030. Both curves are fast because their backends are written in C.

Instances
Eq Supported Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

(==) :: Supported -> Supported -> Bool

(/=) :: Supported -> Supported -> Bool

Show Supported Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

showsPrec :: Int -> Supported -> ShowS

show :: Supported -> String

showList :: [Supported] -> ShowS

Default Supported Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

def :: Supported

data Shared Source #

Instances
Show Shared Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

showsPrec :: Int -> Shared -> ShowS

show :: Shared -> String

showList :: [Shared] -> ShowS

Default Shared Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

def :: Shared

data Hooks Source #

A collection of hooks actions.

Constructors

Hooks 

Fields

Instances
Default Hooks Source # 
Instance details

Defined in Network.TLS.Hooks

Methods

def :: Hooks

data Handshake Source #

Instances
Eq Handshake Source # 
Instance details

Defined in Network.TLS.Struct

Methods

(==) :: Handshake -> Handshake -> Bool

(/=) :: Handshake -> Handshake -> Bool

Show Handshake Source # 
Instance details

Defined in Network.TLS.Struct

Methods

showsPrec :: Int -> Handshake -> ShowS

show :: Handshake -> String

showList :: [Handshake] -> ShowS

data Logging Source #

Hooks for logging

This is called when sending and receiving packets and IO

Constructors

Logging 

Fields

Instances
Default Logging Source # 
Instance details

Defined in Network.TLS.Hooks

Methods

def :: Logging

data Measurement Source #

record some data about this connection.

Constructors

Measurement 

Fields

Instances
Eq Measurement Source # 
Instance details

Defined in Network.TLS.Measurement

Methods

(==) :: Measurement -> Measurement -> Bool

(/=) :: Measurement -> Measurement -> Bool

Show Measurement Source # 
Instance details

Defined in Network.TLS.Measurement

Methods

showsPrec :: Int -> Measurement -> ShowS

show :: Measurement -> String

showList :: [Measurement] -> ShowS

data GroupUsage Source #

Group usage callback possible return values.

Constructors

GroupUsageValid

usage of group accepted

GroupUsageInsecure

usage of group provides insufficient security

GroupUsageUnsupported String

usage of group rejected for other reason (specified as string)

GroupUsageInvalidPublic

usage of group with an invalid public value

Instances
Eq GroupUsage Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

(==) :: GroupUsage -> GroupUsage -> Bool

(/=) :: GroupUsage -> GroupUsage -> Bool

Show GroupUsage Source # 
Instance details

Defined in Network.TLS.Parameters

Methods

showsPrec :: Int -> GroupUsage -> ShowS

show :: GroupUsage -> String

showList :: [GroupUsage] -> ShowS

data CertificateUsage Source #

Certificate Usage callback possible returns values.

Constructors

CertificateUsageAccept

usage of certificate accepted

CertificateUsageReject CertificateRejectReason

usage of certificate rejected

Instances
Eq CertificateUsage Source # 
Instance details

Defined in Network.TLS.X509

Show CertificateUsage Source # 
Instance details

Defined in Network.TLS.X509

Methods

showsPrec :: Int -> CertificateUsage -> ShowS

show :: CertificateUsage -> String

showList :: [CertificateUsage] -> ShowS

defaultParamsClient :: HostName -> ByteString -> ClientParams Source #

data MaxFragmentEnum Source #

Instances
Eq MaxFragmentEnum Source # 
Instance details

Defined in Network.TLS.Extension

Show MaxFragmentEnum Source # 
Instance details

Defined in Network.TLS.Extension

Methods

showsPrec :: Int -> MaxFragmentEnum -> ShowS

show :: MaxFragmentEnum -> String

showList :: [MaxFragmentEnum] -> ShowS

data HashAlgorithm Source #

Instances
Eq HashAlgorithm Source # 
Instance details

Defined in Network.TLS.Struct

Show HashAlgorithm Source # 
Instance details

Defined in Network.TLS.Struct

Methods

showsPrec :: Int -> HashAlgorithm -> ShowS

show :: HashAlgorithm -> String

showList :: [HashAlgorithm] -> ShowS

raw types

data Header Source #

Constructors

Header ProtocolType Version Word16 
Instances
Eq Header Source # 
Instance details

Defined in Network.TLS.Struct

Methods

(==) :: Header -> Header -> Bool

(/=) :: Header -> Header -> Bool

Show Header Source # 
Instance details

Defined in Network.TLS.Struct

Methods

showsPrec :: Int -> Header -> ShowS

show :: Header -> String

showList :: [Header] -> ShowS

Session

type SessionID = ByteString Source #

A session ID

data SessionData Source #

Session data to resume

Constructors

SessionData 

Fields

Instances
Eq SessionData Source # 
Instance details

Defined in Network.TLS.Types

Methods

(==) :: SessionData -> SessionData -> Bool

(/=) :: SessionData -> SessionData -> Bool

Show SessionData Source # 
Instance details

Defined in Network.TLS.Types

Methods

showsPrec :: Int -> SessionData -> ShowS

show :: SessionData -> String

showList :: [SessionData] -> ShowS

data SessionManager Source #

A session manager

Constructors

SessionManager 

Fields

Backend abstraction

data Backend Source #

Connection IO backend

Constructors

Backend 

Fields

  • backendFlush :: IO ()

    Flush the connection sending buffer, if any.

  • backendClose :: IO ()

    Close the connection.

  • backendSend :: ByteString -> IO ()

    Send a bytestring through the connection.

  • backendRecv :: Int -> IO ByteString

    Receive specified number of bytes from the connection.

Instances
HasBackend Backend Source # 
Instance details

Defined in Network.TLS.Backend

Context object

data Context Source #

A TLS Context keep tls specific state, parameters and backend information.

ctxConnection :: Context -> Backend Source #

return the backend object associated with this context

class TLSParams a Source #

Minimal complete definition

getTLSCommonParams, getTLSRole, doHandshake, doHandshakeWith

Instances
TLSParams ServerParams Source # 
Instance details

Defined in Network.TLS.Context

TLSParams ClientParams Source # 
Instance details

Defined in Network.TLS.Context

class HasBackend a where Source #

Methods

initializeBackend :: a -> IO () Source #

getBackend :: a -> Backend Source #

Instances
HasBackend Handle Source # 
Instance details

Defined in Network.TLS.Backend

Methods

initializeBackend :: Handle -> IO () Source #

getBackend :: Handle -> Backend Source #

HasBackend Socket Source # 
Instance details

Defined in Network.TLS.Backend

Methods

initializeBackend :: Socket -> IO () Source #

getBackend :: Socket -> Backend Source #

HasBackend Backend Source # 
Instance details

Defined in Network.TLS.Backend

Creating a context

contextNew Source #

Arguments

:: (MonadIO m, HasBackend backend, TLSParams params) 
=> backend

Backend abstraction with specific method to interact with the connection type.

-> params

Parameters of the context.

-> m Context 

create a new context using the backend and parameters specified.

contextNewOnHandle Source #

Arguments

:: (MonadIO m, TLSParams params) 
=> Handle

Handle of the connection.

-> params

Parameters of the context.

-> m Context 

Deprecated: use contextNew

create a new context on an handle.

contextNewOnSocket Source #

Arguments

:: (MonadIO m, TLSParams params) 
=> Socket

Socket of the connection.

-> params

Parameters of the context.

-> m Context 

Deprecated: use contextNew

create a new context on a socket.

contextHookSetCertificateRecv :: Context -> (CertificateChain -> IO ()) -> IO () Source #

Information gathering

data Information Source #

Information related to a running context, e.g. current cipher

Instances
Eq Information Source # 
Instance details

Defined in Network.TLS.Context.Internal

Methods

(==) :: Information -> Information -> Bool

(/=) :: Information -> Information -> Bool

Show Information Source # 
Instance details

Defined in Network.TLS.Context.Internal

Methods

showsPrec :: Int -> Information -> ShowS

show :: Information -> String

showList :: [Information] -> ShowS

data ClientRandom Source #

Instances
Eq ClientRandom Source # 
Instance details

Defined in Network.TLS.Struct

Methods

(==) :: ClientRandom -> ClientRandom -> Bool

(/=) :: ClientRandom -> ClientRandom -> Bool

Show ClientRandom Source # 
Instance details

Defined in Network.TLS.Struct

Methods

showsPrec :: Int -> ClientRandom -> ShowS

show :: ClientRandom -> String

showList :: [ClientRandom] -> ShowS

data ServerRandom Source #

Instances
Eq ServerRandom Source # 
Instance details

Defined in Network.TLS.Struct

Methods

(==) :: ServerRandom -> ServerRandom -> Bool

(/=) :: ServerRandom -> ServerRandom -> Bool

Show ServerRandom Source # 
Instance details

Defined in Network.TLS.Struct

Methods

showsPrec :: Int -> ServerRandom -> ShowS

show :: ServerRandom -> String

showList :: [ServerRandom] -> ShowS

contextGetInformation :: Context -> IO (Maybe Information) Source #

Information about the current context

Credentials

newtype Credentials Source #

Constructors

Credentials [Credential] 
Instances
Semigroup Credentials Source # 
Instance details

Defined in Network.TLS.Credentials

Methods

(<>) :: Credentials -> Credentials -> Credentials

sconcat :: NonEmpty Credentials -> Credentials

stimes :: Integral b => b -> Credentials -> Credentials

Monoid Credentials Source # 
Instance details

Defined in Network.TLS.Credentials

type Credential = (CertificateChain, PrivKey) Source #

credentialLoadX509 Source #

Arguments

:: FilePath

public certificate (X.509 format)

-> FilePath

private key associated

-> IO (Either String Credential) 

try to create a new credential object from a public certificate and the associated private key that are stored on the filesystem in PEM format.

credentialLoadX509FromMemory :: ByteString -> ByteString -> Either String Credential Source #

similar to credentialLoadX509 but take the certificate and private key from memory instead of from the filesystem.

credentialLoadX509Chain Source #

Arguments

:: FilePath

public certificate (X.509 format)

-> [FilePath]

chain certificates (X.509 format)

-> FilePath

private key associated

-> IO (Either String Credential) 

similar to credentialLoadX509 but also allow specifying chain certificates.

credentialLoadX509ChainFromMemory :: ByteString -> [ByteString] -> ByteString -> Either String Credential Source #

similar to credentialLoadX509FromMemory but also allow specifying chain certificates.

Initialisation and Termination of context

bye :: MonadIO m => Context -> 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 => Context -> m () Source #

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

Application Layer Protocol Negotiation

getNegotiatedProtocol :: MonadIO m => Context -> m (Maybe ByteString) Source #

If the ALPN extensions have been used, this will return get the protocol agreed upon.

Server Name Indication

getClientSNI :: MonadIO m => Context -> m (Maybe HostName) Source #

If the Server Name Indication extension has been used, return the hostname specified by the client.

High level API

sendData :: MonadIO m => Context -> ByteString -> m () Source #

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

recvData :: MonadIO m => Context -> m ByteString Source #

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

recvData' :: MonadIO m => Context -> m ByteString Source #

Deprecated: use recvData that returns strict bytestring

same as recvData but returns a lazy bytestring.

Crypto Key

data PubKey #

Constructors

PubKeyRSA PublicKey 
PubKeyDSA PublicKey 
PubKeyDH (Integer, Integer, Integer, Maybe Integer, ([Word8], Integer)) 
PubKeyEC PubKeyEC 
PubKeyX25519 PublicKey 
PubKeyX448 PublicKey 
PubKeyEd25519 PublicKey 
PubKeyEd448 PublicKey 
PubKeyUnknown OID ByteString 
Instances
Eq PubKey 
Instance details

Defined in Data.X509.PublicKey

Methods

(==) :: PubKey -> PubKey -> Bool

(/=) :: PubKey -> PubKey -> Bool

Show PubKey 
Instance details

Defined in Data.X509.PublicKey

Methods

showsPrec :: Int -> PubKey -> ShowS

show :: PubKey -> String

showList :: [PubKey] -> ShowS

ASN1Object PubKey 
Instance details

Defined in Data.X509.PublicKey

Methods

toASN1 :: PubKey -> ASN1S

fromASN1 :: [ASN1] -> Either String (PubKey, [ASN1])

data PrivKey #

Constructors

PrivKeyRSA PrivateKey 
PrivKeyDSA PrivateKey 
PrivKeyEC PrivKeyEC 
PrivKeyX25519 SecretKey 
PrivKeyX448 SecretKey 
PrivKeyEd25519 SecretKey 
PrivKeyEd448 SecretKey 
Instances
Eq PrivKey 
Instance details

Defined in Data.X509.PrivateKey

Methods

(==) :: PrivKey -> PrivKey -> Bool

(/=) :: PrivKey -> PrivKey -> Bool

Show PrivKey 
Instance details

Defined in Data.X509.PrivateKey

Methods

showsPrec :: Int -> PrivKey -> ShowS

show :: PrivKey -> String

showList :: [PrivKey] -> ShowS

ASN1Object PrivKey 
Instance details

Defined in Data.X509.PrivateKey

Methods

toASN1 :: PrivKey -> ASN1S

fromASN1 :: [ASN1] -> Either String (PrivKey, [ASN1])

Compressions & Predefined compressions

data Compression Source #

every compression need to be wrapped in this, to fit in structure

Constructors

CompressionC a => Compression a 
Instances
Eq Compression Source # 
Instance details

Defined in Network.TLS.Compression

Methods

(==) :: Compression -> Compression -> Bool

(/=) :: Compression -> Compression -> Bool

Show Compression Source # 
Instance details

Defined in Network.TLS.Compression

Methods

showsPrec :: Int -> Compression -> ShowS

show :: Compression -> String

showList :: [Compression] -> ShowS

class CompressionC a where Source #

supported compression algorithms need to be part of this class

Methods

compressionCID :: a -> CompressionID Source #

compressionCDeflate :: a -> ByteString -> (a, ByteString) Source #

compressionCInflate :: a -> ByteString -> (a, ByteString) Source #

nullCompression :: Compression Source #

default null compression

Ciphers & Predefined ciphers

data Bulk Source #

Constructors

Bulk 

Fields

Instances
Eq Bulk Source # 
Instance details

Defined in Network.TLS.Cipher

Methods

(==) :: Bulk -> Bulk -> Bool

(/=) :: Bulk -> Bulk -> Bool

Show Bulk Source # 
Instance details

Defined in Network.TLS.Cipher

Methods

showsPrec :: Int -> Bulk -> ShowS

show :: Bulk -> String

showList :: [Bulk] -> ShowS

data BulkDirection Source #

Constructors

BulkEncrypt 
BulkDecrypt 
Instances
Eq BulkDirection Source # 
Instance details

Defined in Network.TLS.Cipher

Show BulkDirection Source # 
Instance details

Defined in Network.TLS.Cipher

Methods

showsPrec :: Int -> BulkDirection -> ShowS

show :: BulkDirection -> String

showList :: [BulkDirection] -> ShowS

data BulkState Source #

Instances
Show BulkState Source # 
Instance details

Defined in Network.TLS.Cipher

Methods

showsPrec :: Int -> BulkState -> ShowS

show :: BulkState -> String

showList :: [BulkState] -> ShowS

newtype BulkStream Source #

Constructors

BulkStream (ByteString -> (ByteString, BulkStream)) 

type BulkBlock = BulkIV -> ByteString -> (ByteString, BulkIV) Source #

type BulkAEAD = BulkNonce -> ByteString -> BulkAdditionalData -> (ByteString, AuthTag) Source #

data Hash Source #

Constructors

MD5 
SHA1 
SHA224 
SHA256 
SHA384 
SHA512 
SHA1_MD5 
Instances
Eq Hash Source # 
Instance details

Defined in Network.TLS.Crypto

Methods

(==) :: Hash -> Hash -> Bool

(/=) :: Hash -> Hash -> Bool

Show Hash Source # 
Instance details

Defined in Network.TLS.Crypto

Methods

showsPrec :: Int -> Hash -> ShowS

show :: Hash -> String

showList :: [Hash] -> ShowS

data Cipher Source #

Cipher algorithm

Instances
Eq Cipher Source # 
Instance details

Defined in Network.TLS.Cipher

Methods

(==) :: Cipher -> Cipher -> Bool

(/=) :: Cipher -> Cipher -> Bool

Show Cipher Source # 
Instance details

Defined in Network.TLS.Cipher

Methods

showsPrec :: Int -> Cipher -> ShowS

show :: Cipher -> String

showList :: [Cipher] -> ShowS

type CipherID = Word16 Source #

Cipher identification

type BulkKey = ByteString Source #

type BulkIV = ByteString Source #

type BulkNonce = ByteString Source #

type BulkAdditionalData = ByteString Source #

cipherAllowedForVersion :: Version -> Cipher -> Bool Source #

Check if a specific Cipher is allowed to be used with the version specified

Versions

data Version Source #

Versions known to TLS

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

Constructors

SSL2 
SSL3 
TLS10 
TLS11 
TLS12 
Instances
Bounded Version Source # 
Instance details

Defined in Network.TLS.Types

Eq Version Source # 
Instance details

Defined in Network.TLS.Types

Methods

(==) :: Version -> Version -> Bool

(/=) :: Version -> Version -> Bool

Ord Version Source # 
Instance details

Defined in Network.TLS.Types

Methods

compare :: Version -> Version -> Ordering

(<) :: Version -> Version -> Bool

(<=) :: Version -> Version -> Bool

(>) :: Version -> Version -> Bool

(>=) :: Version -> Version -> Bool

max :: Version -> Version -> Version

min :: Version -> Version -> Version

Show Version Source # 
Instance details

Defined in Network.TLS.Types

Methods

showsPrec :: Int -> Version -> ShowS

show :: Version -> String

showList :: [Version] -> ShowS

Errors

data TLSError Source #

TLSError that might be returned through the TLS stack

Constructors

Error_Misc String

mainly for instance of Error

Error_Protocol (String, Bool, AlertDescription) 
Error_Certificate String 
Error_HandshakePolicy String

handshake policy failed.

Error_EOF 
Error_Packet String 
Error_Packet_unexpected String String 
Error_Packet_Parsing String 
Instances
Eq TLSError Source # 
Instance details

Defined in Network.TLS.Struct

Methods

(==) :: TLSError -> TLSError -> Bool

(/=) :: TLSError -> TLSError -> Bool

Show TLSError Source # 
Instance details

Defined in Network.TLS.Struct

Methods

showsPrec :: Int -> TLSError -> ShowS

show :: TLSError -> String

showList :: [TLSError] -> ShowS

Exception TLSError Source # 
Instance details

Defined in Network.TLS.Struct

Methods

toException :: TLSError -> SomeException

fromException :: SomeException -> Maybe TLSError

displayException :: TLSError -> String

data KxError Source #

Constructors

RSAError Error 
KxUnsupported 
Instances
Show KxError Source # 
Instance details

Defined in Network.TLS.Crypto

Methods

showsPrec :: Int -> KxError -> ShowS

show :: KxError -> String

showList :: [KxError] -> ShowS

Exceptions

data TLSException Source #

TLS Exceptions related to bad user usage or asynchronous errors

Constructors

Terminated Bool String TLSError

Early termination exception with the reason and the error associated

HandshakeFailed TLSError

Handshake failed for the reason attached

ConnectionNotEstablished

Usage error when the connection has not been established and the user is trying to send or receive data

Instances
Eq TLSException Source # 
Instance details

Defined in Network.TLS.Struct

Methods

(==) :: TLSException -> TLSException -> Bool

(/=) :: TLSException -> TLSException -> Bool

Show TLSException Source # 
Instance details

Defined in Network.TLS.Struct

Methods

showsPrec :: Int -> TLSException -> ShowS

show :: TLSException -> String

showList :: [TLSException] -> ShowS

Exception TLSException Source # 
Instance details

Defined in Network.TLS.Struct

Methods

toException :: TLSException -> SomeException

fromException :: SomeException -> Maybe TLSException

displayException :: TLSException -> String

X509 Validation

data ValidationChecks #

Constructors

ValidationChecks 

Fields

Instances
Eq ValidationChecks 
Instance details

Defined in Data.X509.Validation

Show ValidationChecks 
Instance details

Defined in Data.X509.Validation

Methods

showsPrec :: Int -> ValidationChecks -> ShowS

show :: ValidationChecks -> String

showList :: [ValidationChecks] -> ShowS

Default ValidationChecks 
Instance details

Defined in Data.X509.Validation

data ValidationHooks #

Constructors

ValidationHooks 

Fields

Instances
Default ValidationHooks 
Instance details

Defined in Data.X509.Validation

X509 Validation Cache

data ValidationCache #

Constructors

ValidationCache 

Fields

Instances
Default ValidationCache 
Instance details

Defined in Data.X509.Validation.Cache

exceptionValidationCache :: [(ServiceID, Fingerprint)] -> ValidationCache #

Key exchange group

data Group Source #

Instances
Eq Group Source # 
Instance details

Defined in Network.TLS.Crypto.Types

Methods

(==) :: Group -> Group -> Bool

(/=) :: Group -> Group -> Bool

Show Group Source # 
Instance details

Defined in Network.TLS.Crypto.Types

Methods

showsPrec :: Int -> Group -> ShowS

show :: Group -> String

showList :: [Group] -> ShowS