Expand description
Cryptographic primitives library with constant-time implementation
This crate provides implementations of various cryptographic primitives
with a focus on constant-time operations and resistance to side-channel attacks.
The library is designed to be usable in both std
and no_std
environments.
§Security Features
This library implements comprehensive security patterns to protect sensitive cryptographic material, including:
- Secure memory handling with automatic zeroization
- Constant-time comparison operations
- Memory barrier utilities
- Secure operation patterns
Re-exports§
pub use error::validate;
pub use error::Error;
pub use error::Result;
pub use block::Aes128;
pub use block::Aes192;
pub use block::Aes256;
pub use block::Cbc;
pub use block::Ctr;
pub use hash::Blake2b;
pub use hash::Blake2s;
pub use hash::Sha1;
pub use hash::Sha224;
pub use hash::Sha256;
pub use hash::Sha384;
pub use hash::Sha3_224;
pub use hash::Sha3_256;
pub use hash::Sha3_384;
pub use hash::Sha3_512;
pub use hash::Sha512;
pub use hash::Shake128;
pub use hash::Shake256;
pub use aead::AeadCipher;
pub use aead::ChaCha20Poly1305;
pub use aead::ChaCha20Poly1305Cipher;
pub use aead::Gcm;
pub use aead::XChaCha20Poly1305;
pub use mac::Hmac;
pub use mac::Poly1305;
pub use stream::chacha::chacha20::ChaCha20;
pub use kdf::Argon2;
pub use kdf::Hkdf;
pub use kdf::KeyDerivationFunction;
pub use kdf::PasswordHashFunction;
pub use kdf::Pbkdf2;
pub use ec::p256;
pub use ec::p384;
pub use ec::p521;
pub use ec::P256Point;
pub use ec::P256Scalar;
pub use ec::P384Point;
pub use ec::P384Scalar;
pub use ec::P521Point;
pub use ec::P521Scalar;
pub use types::ByteSerializable;
pub use types::ConstantTimeEq;
pub use types::Digest;
pub use types::FixedSize;
pub use types::Nonce;
pub use types::RandomGeneration;
pub use types::Salt;
pub use types::Tag;
pub use types::algorithms::Aes128 as Aes128Algorithm;
pub use types::algorithms::Aes256 as Aes256Algorithm;
pub use types::algorithms::ChaCha20 as ChaCha20Algorithm;
pub use types::algorithms::ChaCha20Poly1305 as ChaCha20Poly1305Algorithm;
pub use types::algorithms::Ed25519 as Ed25519Algorithm;
pub use types::algorithms::P521 as P521Algorithm;
pub use types::algorithms::X25519 as X25519Algorithm;
pub use types::digest::Blake2bCompatible;
pub use types::digest::Sha256Compatible;
pub use types::digest::Sha512Compatible;
pub use types::key::AsymmetricPublicKey;
pub use types::key::AsymmetricSecretKey;
pub use types::key::SymmetricKey;
pub use types::nonce::AesCtrCompatible;
pub use types::nonce::AesGcmCompatible;
pub use types::nonce::ChaCha20Compatible;
pub use types::nonce::XChaCha20Compatible;
pub use types::salt::Argon2Compatible;
pub use types::salt::HkdfCompatible;
pub use types::salt::Pbkdf2Compatible;
pub use types::tag::ChaCha20Poly1305Compatible;
pub use types::tag::GcmCompatible;
pub use types::tag::HmacCompatible;
pub use types::tag::Poly1305Compatible;
pub use xof::Blake3Xof;
pub use xof::ExtendableOutputFunction;
pub use xof::ShakeXof128;
pub use xof::ShakeXof256;
pub use poly::ntt::montgomery_reduce;
pub use poly::ntt::CooleyTukeyNtt;
pub use poly::ntt::InverseNttOperator;
pub use poly::ntt::NttOperator;
pub use poly::params::DilithiumParams;
pub use poly::params::Kyber256Params;
pub use poly::params::Modulus;
pub use poly::params::NttModulus;
pub use poly::polynomial::Polynomial;
pub use poly::prelude;
pub use poly::sampling::CbdSampler;
pub use poly::sampling::DefaultSamplers;
pub use poly::sampling::GaussianSampler;
pub use poly::sampling::UniformSampler;
pub use poly::serialize::CoefficientPacker;
pub use poly::serialize::CoefficientUnpacker;
pub use poly::serialize::DefaultCoefficientSerde;
Modules§
- aead
- Authenticated Encryption with Associated Data (AEAD) with operation pattern
- barrier
- Memory barrier utilities
- block
- Block cipher implementations with advanced type-level guarantees
- code
- Code-Based Cryptography Primitives
- ec
- Elliptic Curve Primitives
- error
- Error handling for cryptographic primitives
- hash
- Cryptographic hash function implementations with enhanced type safety
- kdf
- Key Derivation Functions with operation pattern and type-level guarantees
- lattice
- Lattice Cryptography Primitives
- mac
- Message Authentication Code (MAC) implementations with type-safe interfaces
- mq
- Multivariate Quadratic (MQ) Cryptosystem Primitives
- poly
- Generic Polynomial Engine
- stream
- Stream cipher implementations
- types
- Type-safe wrappers for cryptographic types
- xof
- Extendable Output Functions (XOF)
Structs§
- Ephemeral
Secret - Ephemeral secret that is automatically zeroized after use
- Secret
Buffer - Fixed-size secret buffer that guarantees zeroization
- Secret
Bytes - A fixed-size array of bytes that is securely zeroed when dropped
- Secret
Vec - Variable-size secret vector that guarantees zeroization
- Secure
Operation Builder - Builder pattern for secure operations
- Zeroize
Guard - Guard type that ensures a value is zeroized when dropped
Traits§
- Result
Ext - Extension trait for Result types
- Secure
Compare - Trait for types that can be securely compared
- Secure
Error Handling - Trait for secure error handling to prevent timing attacks
- Secure
Operation - Trait for secure cryptographic operations
- Secure
Operation Ext - Extension trait for operations that produce a result
- Secure
Zeroing Type - Trait for types that can be securely zeroed and cloned