Module sodiumoxide::crypto::secretstream::xchacha20poly1305[][src]

Expand description

crypto_secretstream_xchacha20poly1305

Structs

Header

An encrypted stream starts with a short header, whose size is HEADERBYTES bytes. That header must be sent/stored before the sequence of encrypted messages, as it is required to decrypt the stream.

Key

Key for symmetric authenticated encryption.

Pull

Represents the pull mode of a Stream.

Push

Represents the push mode of a Stream.

Stream

Stream contains the state for multi-part (streaming) computations. This allows the caller to process encryption of a sequence of multiple messages.

Enums

Tag

A tag is encrypted and attached to each message before the authentication code is generated over all data. A typical encrypted stream simply attaches 0 as a tag to all messages, except the last one which is tagged as Tag::Final. When decrypting the tag is retrieved and may be used.

Constants

ABYTES

Number of added bytes. The ciphertext length is guaranteed to always be message length + ABYTES.

HEADERBYTES

Number of bytes in a Header. An encrypted stream starts with a short header, whose size is HEADERBYTES bytes. That header must be sent/stored before the sequence of encrypted messages, as it is required to decrypt the stream.

KEYBYTES

Number of bytes in a Key.

Traits

StreamMode

The trait that distinguishes between the pull and push modes of a Stream.

Functions

gen_key

gen_key() randomly generates a secret key

messagebytes_max

Returns the maximum length of an individual message.