simplexmq-6.5.0.16: SimpleXMQ message broker
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simplex.Messaging.Crypto.Lazy

Synopsis

Documentation

sha256Hash :: LazyByteString -> ByteString Source #

SHA512 digest of a lazy bytestring.

sha512Hash :: LazyByteString -> ByteString Source #

SHA512 digest of a lazy bytestring.

pad :: LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString Source #

sbEncrypt :: SbKey -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString Source #

NaCl secret_box lazy encrypt with a symmetric 256-bit key and 192-bit nonce. The resulting string will be bigger than paddedLen by the size of the auth tag (16 bytes).

sbDecrypt :: SbKey -> CbNonce -> LazyByteString -> Either CryptoError LazyByteString Source #

NaCl secret_box decrypt with a symmetric 256-bit key and 192-bit nonce. The resulting string will be smaller than packet size by the size of the auth tag (16 bytes).

sbEncryptTailTag :: SbKey -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString Source #

NaCl secret_box lazy encrypt with a symmetric 256-bit key and 192-bit nonce with appended auth tag (more efficient with large files).

kcbEncryptTailTag :: KEMHybridSecret -> CbNonce -> LazyByteString -> Int64 -> Int64 -> Either CryptoError LazyByteString Source #

NaCl crypto_box lazy encrypt with with a shared hybrid KEM+DH 256-bit secret and 192-bit nonce with appended auth tag (more efficient with large strings/files).

sbDecryptTailTag :: SbKey -> CbNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString) Source #

NaCl secret_box decrypt with a symmetric 256-bit key and 192-bit nonce with appended auth tag (more efficient with large files). paddedLen should NOT include the tag length, it should be the same number that is passed to sbEncrypt / sbEncryptTailTag.

kcbDecryptTailTag :: KEMHybridSecret -> CbNonce -> Int64 -> LazyByteString -> Either CryptoError (Bool, LazyByteString) Source #

NaCl crypto_box lazy decrypt with a shared hybrid KEM+DH 256-bit secret and 192-bit nonce with appended auth tag (more efficient with large strings/files). paddedLen should NOT include the tag length, it should be the same number that is passed to sbEncrypt / sbEncryptTailTag.

fastReplicate :: Int64 -> Char -> LazyByteString Source #

secretBox :: ByteArrayAccess key => (SbState -> ByteString -> (ByteString, SbState)) -> key -> ByteString -> LazyByteString -> Either CryptoError (NonEmpty ByteString) Source #

secretBoxTailTag :: ByteArrayAccess key => (SbState -> ByteString -> (ByteString, SbState)) -> key -> ByteString -> LazyByteString -> Either CryptoError [ByteString] Source #

type SbState = (State, State) Source #

sbEncryptChunk :: SbState -> ByteString -> (ByteString, SbState) Source #

sbDecryptChunk :: SbState -> ByteString -> (ByteString, SbState) Source #

sbAuth :: SbState -> Auth Source #

type LazyByteString = ByteString Source #