Skip to main content

Module sanctuary_crypto

Module sanctuary_crypto 

Source
Expand description

Sanctuary lane cryptography.

This module derives 48 bytes of key material from a user PIN, splits it into a 32-byte AEAD key plus a 16-byte volume tweak, and performs zero-heap encryption and decryption using deterministic, domain-separated nonces.

Structs§

SanctuaryKeyMaterial
Derived sanctuary key material.

Enums§

SanctuaryAeadAlgorithm
SanctuaryCryptoError

Constants§

ARGON2_M_COST_KIB
Argon2id defaults (memory-hard KDF; ADR D1). 64 MiB, 3 passes, 1 lane. Memory-hardness is what PBKDF2 lacks — it blunts GPU/ASIC offline brute-force of a weak PIN, the vault’s real weak link.
ARGON2_P_COST
ARGON2_T_COST
DEFAULT_PBKDF2_ITERATIONS
SANCTUARY_CIPHER_KEY_BYTES
SANCTUARY_GCM_NONCE_BYTES
SANCTUARY_KEY_MATERIAL_BYTES
SANCTUARY_TAG_BYTES
SANCTUARY_TWEAK_BYTES
SANCTUARY_XCHACHA_NONCE_BYTES

Functions§

decrypt_sanctuary_chunk
Copy ciphertext into a caller-supplied output buffer, then decrypt in place.
decrypt_sanctuary_chunk_in_place
Decrypt the caller-owned buffer in place without heap allocation.
derive_chacha_nonce
Derive a 96-bit nonce for ChaCha20-Poly1305.
derive_chunk_nonce
Derive a 96-bit nonce for AES-256-GCM.
derive_lane_cipher_key
Convenience wrapper for call sites that only need the 32-byte cipher key.
derive_sanctuary_key_material
Derive 48 bytes of sanctuary key material from a PIN and salt.
derive_sanctuary_key_material_argon2
Derive the 48-byte sanctuary key material with Argon2id (memory-hard), same output layout as derive_sanctuary_key_material: [0..32] cipher key, [32..48] volume tweak.
derive_xchacha_nonce
Derive a 192-bit nonce for XChaCha20-Poly1305.
encrypt_sanctuary_chunk
Copy plaintext into a caller-supplied output buffer, then encrypt in place.
encrypt_sanctuary_chunk_in_place
Encrypt the caller-owned buffer in place without heap allocation.