Module types

Module types 

Source
Expand description

Type-safe wrappers for cryptographic types

This module provides domain-specific types with compile-time and runtime guarantees for cryptographic operations, designed to be ergonomic while preventing common mistakes.

Re-exports§

pub use digest::Digest;
pub use key::AsymmetricPublicKey;
pub use key::AsymmetricSecretKey;
pub use key::SymmetricKey;
pub use nonce::Nonce;
pub use salt::Salt;
pub use tag::Tag;
pub use nonce::AesCtrCompatible;
pub use nonce::AesGcmCompatible;
pub use nonce::ChaCha20Compatible;
pub use nonce::XChaCha20Compatible;
pub use salt::Argon2Compatible;
pub use salt::HkdfCompatible;
pub use salt::Pbkdf2Compatible;
pub use digest::Blake2bCompatible;
pub use digest::Sha256Compatible;
pub use digest::Sha512Compatible;
pub use tag::ChaCha20Poly1305Compatible;
pub use tag::GcmCompatible;
pub use tag::HmacCompatible;
pub use tag::Poly1305Compatible;
pub use algorithms::Ed25519;
pub use algorithms::P256;
pub use algorithms::P384;
pub use algorithms::P521;
pub use algorithms::X25519;
pub use algorithms::Aes128;
pub use algorithms::Aes256;
pub use algorithms::ChaCha20;
pub use algorithms::ChaCha20Poly1305;
pub use key::AsymmetricAlgorithm;
pub use key::SymmetricAlgorithm;
pub use algorithms::Aes128Key;
pub use algorithms::Aes256Key;
pub use algorithms::ChaCha20Key;
pub use algorithms::ChaCha20Poly1305Key;
pub use algorithms::Ed25519PublicKey;
pub use algorithms::Ed25519SecretKey;
pub use algorithms::P256PublicKeyCompressed;
pub use algorithms::P256PublicKeyUncompressed;
pub use algorithms::P256SecretKey;
pub use algorithms::P384PublicKeyCompressed;
pub use algorithms::P384PublicKeyUncompressed;
pub use algorithms::P384SecretKey;
pub use algorithms::P521PublicKeyCompressed;
pub use algorithms::P521PublicKeyUncompressed;
pub use algorithms::P521SecretKey;
pub use algorithms::X25519PublicKey;
pub use algorithms::X25519SecretKey;

Modules§

algorithms
Algorithm definitions for type-safe cryptography
digest
Type-safe digest implementation with size guarantees
key
Type-safe key implementations with algorithm binding
nonce
Type-safe nonce implementation with generic size parameter
salt
Type-safe salt implementation with validation
tag
Type-safe authentication tag implementation with size guarantees

Structs§

Ciphertext
Wrapper for ciphertext data
EphemeralSecret
Ephemeral secret that is automatically zeroized after use
Key
Base key type that provides secure memory handling
SecretBuffer
Fixed-size secret buffer that guarantees zeroization
SecretBytes
A fixed-size array of bytes that is securely zeroed when dropped
SecretVec
A variable-length vector of bytes that is securely zeroed when dropped
ZeroizeGuard
Guard type that ensures a value is zeroized when dropped

Traits§

AlgorithmCompatible
Trait for types compatible with algorithms that have specific size requirements
ByteSerializable
Trait for types that can be serialized to a byte representation
ConstantTimeEq
Trait for cryptographic types with constant-time equality
FixedSize
Trait for types that have a fixed size
RandomGeneration
Trait for cryptographic types that can be randomly generated
SecureZeroingType
Trait for types that can be securely zeroed and cloned
ValidKeySize
Marker trait for validating symmetric key sizes for specific algorithms.
ValidPublicKeySize
Marker trait for validating asymmetric public key sizes for specific algorithms.
ValidSecretKeySize
Marker trait for validating asymmetric secret key sizes for specific algorithms.