redbx
A simple, portable, high-performance, ACID, embedded key-value store with built-in AES encryption.
redbx is a fork of redb that provides transparent encryption for all user data. It's written in pure Rust and is loosely inspired by lmdb. Data is stored in a collection of copy-on-write B-trees with AES-256-GCM encryption. For more details, see the design doc
Key Features
- Built-in AES-256-GCM encryption for all user data
- PBKDF2-SHA256 key derivation with 100,000 iterations
- Transparent encryption/decryption at the storage layer
- Zero-copy, thread-safe,
BTreeMapbased API - Fully ACID-compliant transactions
- MVCC support for concurrent readers & writers, without blocking
- Crash-safe by default
- Savepoints and rollbacks
use ;
const TABLE: = new;
Features
- Zero-copy, thread-safe,
BTreeMapbased API - Fully ACID-compliant transactions
- MVCC support for concurrent readers & writer, without blocking
- Crash-safe by default
- Savepoints and rollbacks
- Built-in AES-256-GCM encryption for all user data
- PBKDF2-SHA256 key derivation with 100,000 iterations
- Transparent encryption/decryption at the storage layer
Development
To run all the tests and benchmarks a few extra dependencies are required:
# Install dependencies
# Run tests
# Run benchmarks
Known problem
- lack of performance, work in progress.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Security
redbx uses industry-standard cryptographic algorithms:
- AES-256-GCM for authenticated encryption
- PBKDF2-SHA256 with 100,000 iterations for key derivation
- Cryptographically secure random salt generation
All user data is encrypted at rest, while metadata remains unencrypted for performance and debugging purposes.
Migration from redb
redbx is designed to be a drop-in replacement for redb with the addition of password-based encryption:
// redb (unencrypted)
let db = create?;
// redbx (encrypted)
let db = create?;
The API is otherwise identical, making migration straightforward.