-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Communications security description: A basic communications security package that provides confidentiallity, integrity and replay detection. -- -- Communications security description: A basic communications security -- package that provides confidentiallity, integrity and replay -- detection. @package commsec @version 0.1 -- | CommSec, for communications security. module Network.CommSec -- | A context useful for sending data. data OutContext Out :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word32 -> AESKey -> OutContext aesCtr :: OutContext -> {-# UNPACK #-} !Word64 saltOut :: OutContext -> {-# UNPACK #-} !Word32 outKey :: OutContext -> AESKey -- | A context useful for receiving data. data InContext In :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word32 -> AESKey -> InContext base :: InContext -> {-# UNPACK #-} !Word64 mask :: InContext -> {-# UNPACK #-} !Word64 saltIn :: InContext -> {-# UNPACK #-} !Word32 inKey :: InContext -> AESKey -- | Given at least 24 bytes of entropy, produce an in context that can -- communicate with an identically initialized out context. newInContext :: ByteString -> InContext -- | Given at least 24 bytes of entropy, produce an out context that can -- communicate with an identically initialized in context. newOutContext :: ByteString -> OutContext -- | Use an InContext to decrypt a message, verifying the ICV and -- sequence number. Message format: [ctr, ct, padding, tag]. recv :: InContext -> ByteString -> Either String (ByteString, InContext) -- | Use an OutContext to protect a message for transport. Message -- format: [ctr, ct, padding, tag]. send :: OutContext -> ByteString -> (ByteString, OutContext)