Maintainer | John Galt <jgalt@centromere.net> |
---|---|
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- data CipherState c = CipherState {
- _csk :: Maybe (SymmetricKey c)
- _csn :: Nonce c
- csn :: forall c. Lens' (CipherState c) (Nonce c)
- csk :: forall c. Lens' (CipherState c) (Maybe (SymmetricKey c))
- cipherState :: Cipher c => Maybe (SymmetricKey c) -> CipherState c
- encryptWithAd :: (MonadThrow m, Cipher c) => AssocData -> Plaintext -> CipherState c -> m (Ciphertext c, CipherState c)
- decryptWithAd :: (MonadThrow m, Cipher c) => AssocData -> Ciphertext c -> CipherState c -> m (Plaintext, CipherState c)
- rekey :: Cipher c => CipherState c -> CipherState c
- validNonce :: Cipher c => CipherState c -> Bool
Documentation
data CipherState c Source #
CipherState | |
|
Show (CipherState c) Source # | |
csk :: forall c. Lens' (CipherState c) (Maybe (SymmetricKey c)) Source #
cipherState :: Cipher c => Maybe (SymmetricKey c) -> CipherState c Source #
Creates a new CipherState with an optional symmetric key and a zero nonce.
encryptWithAd :: (MonadThrow m, Cipher c) => AssocData -> Plaintext -> CipherState c -> m (Ciphertext c, CipherState c) Source #
Encrypts the provided plaintext and increments the nonce. If this CipherState does not have a key associated with it, the plaintext will be returned.
decryptWithAd :: (MonadThrow m, Cipher c) => AssocData -> Ciphertext c -> CipherState c -> m (Plaintext, CipherState c) Source #
Decrypts the provided ciphertext and increments the nonce. If this
CipherState does not have a key associated with it, the ciphertext
will be returned. If the CipherState does have a key and decryption
fails, a DecryptionError
will be returned.
rekey :: Cipher c => CipherState c -> CipherState c Source #
Rekeys the CipherState. If a key has not been established yet, the CipherState is returned unmodified.
validNonce :: Cipher c => CipherState c -> Bool Source #
Tests whether the Nonce contained within a CipherState is valid (less than the maximum allowed).