crypto-sodium-0.0.4.0: Easy-and-safe-to-use high-level cryptography based on Sodium
Safe HaskellNone
LanguageHaskell2010

Crypto.Encrypt.Symmetric.Stream

Contents

Description

Symmetric authenticated encryption for streams.

This module provides generic types for Sodium-based streaming encryption. It does not provide any functionality itself.

There are separate packages that actually implement this functionality for specific streaming libraries:

  • crypto-sodium-streamly for streamly streams.
Synopsis

Keys

type Key a = SizedByteArray CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_KEYBYTES a Source #

Encryption key that can be used for streaming symmetric encryption.

This type is parametrised by the actual data type that contains bytes. This can be, for example, a ByteString, but, since this is a secret key, it is better to use ScrubbedBytes.

toKey :: ByteArrayAccess ba => ba -> Maybe (Key ba) Source #

Make a Key from an arbitrary byte array.

This function returns Just if and only if the byte array has the right length to be used as a key with a streaming symmetric encryption.