Expand description
Password hashing, authentication credentials, and user security models.
Structs§
- KekParams
- KEK derivation parameters to be stored in the SQLite table
users_key_encryption_key_paramsinusers.db. For now this is a stub structure that you can later wire to Argon2id properly.
Functions§
- derive_
kek - Derive a Key Encryption Key (KEK) from a password using Argon2id. Returns the derived KEK and the salt used in the derivation. The KEK is suitable for AES-256 encryption. It’s not clear if this is all correct. See: https://docs.rs/argon2/latest/argon2/#key-derivation https://rustcrypto.org/key-derivation/index.html https://cheatsheetseries.owasp.org/cheatsheets/Key_Management_Cheat_Sheet.html#key-encryption-keys (last two are basically blank.)
- derive_
kek_ with_ params - Derive a Key Encryption Key (KEK) from a password using specific
KekParams. - generate_
dek - Generate a cryptographically secure 32-byte Database Encryption Key (DEK) using the OS random number generator.
- open_
bytes - Open sealed bytes (decrypt and verify authentication) using AES-256-GCM. Expects the 12-byte nonce prepended to the ciphertext.
- seal_
bytes - Seal bytes (encrypt and authenticate) using AES-256-GCM. Returns the nonce (12 bytes) prepended to the ciphertext.
- unwrap_
key - Unwrap the DEK using the KEK (Key Encryption Key) and AES-256-GCM. Expects the 12-byte nonce prepended to the ciphertext.
- wrap_
key - Wrap the DEK under a KEK (Key Encryption Key) using AES-256-GCM. Additional Authenticated Data (AAD) is used to prevent key substitution. Returns the nonce (12 bytes) prepended to the ciphertext.