Module snapper_box::crypto[][src]

Expand description

Types and traits serving as the cryptographic primitives of snapper-box’s cryptosystem. HAZMAT

This module provides both originating keys (RootKey) and derived keys (DerivedKey) as well as nonce types and other hazardous material.

Originating keys (RootKey) are randomly generated, and have methods for their usage in generating derived keys, as well methods for encrypting the key with a password for safe at-rest storage.

Derived keys (DerivedKey) are generated via a KDF over the originating key’s entropy pool and a context string incorporating both a random nonce and a namespace.

This module also provides wrapper types for shuffling data back and forth between encrypted and unencrypted representations, as well as the ability to, optionally, transparently compress plaintext before encryption.

DANGER

This module deals in low level cryptographic details, and it can be incredibly dangerous to interact with directly. It is advisable to not deal with this module directly, and instead use a higher level API.

Structs

An encrypted plaintext, with associated data

An unencrypted blob of plaintext.

Thin wrapper around a const-generic array to make them work better with serde

A key that has been derived from a RootKey

A DerivedKey that has been encrypted with a RootKey

A RootKey that has been encrypted with an argon2 derivation of a users password

Nonce/Salt value used in encryption

Originating Key

Traits

Allows access to the subkeys of a key-like structure