cacophony-0.10.0: A library implementing the Noise protocol.

MaintainerJohn Galt <jgalt@centromere.net>
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Crypto.Noise.Internal.SymmetricState

Description

 

Synopsis

Documentation

ssck :: forall c h. Lens' (SymmetricState c h) (ChainingKey h) Source #

symmetricState :: forall c h. (Cipher c, Hash h) => ScrubbedBytes -> SymmetricState c h Source #

Creates a new SymmetricState from the given protocol name.

mixKey :: (Cipher c, Hash h) => ScrubbedBytes -> SymmetricState c h -> SymmetricState c h Source #

Mixes keying material in to the SymmetricState.

mixHash :: Hash h => ScrubbedBytes -> SymmetricState c h -> SymmetricState c h Source #

Mixes arbitrary data in to the SymmetricState.

mixKeyAndHash :: (Cipher c, Hash h) => ScrubbedBytes -> SymmetricState c h -> SymmetricState c h Source #

Mixes key material and arbitrary data in to the SymmetricState. Note that this is not isomorphic to mixHash . mixKey.

encryptAndHash :: (MonadThrow m, Cipher c, Hash h) => Plaintext -> SymmetricState c h -> m (Ciphertext c, SymmetricState c h) Source #

Encrypts the given Plaintext. Note that this may not actually perform encryption if a key has not been established yet, in which case the original plaintext is returned.

decryptAndHash :: (MonadThrow m, Cipher c, Hash h) => Ciphertext c -> SymmetricState c h -> m (Plaintext, SymmetricState c h) Source #

Decrypts the given Ciphertext. Note that this may not actually perform decryption if a key as not been established yet, in which case the original ciphertext is returned.

split :: (Cipher c, Hash h) => SymmetricState c h -> (CipherState c, CipherState c) Source #

Returns a pair of CipherStates for encrypting transport messages. The first CipherState is for encrypting messages from the Initiator to the Responder, and the second is for encrypting messages from the Responder to the Initiator.

sshBytes :: Hash h => Either ScrubbedBytes (Digest h) -> ScrubbedBytes Source #

Utility function to convert the hash state to ScrubbedBytes.