Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Turso 11 min read Deep dive mediumAdept

SQLite Doesn't Come With Encryption. Here's What Developers Actually Use.

SQLite ships without encryption, and since SQLite 3.32.0 removed the undocumented SQLITE_HAS_CODEC hook in 2020, the options are SQLCipher (mature but painful across major versions, AES-256-CBC+HMAC only), the proprietary $2,000 SEE from the SQLite team, and SQLite3MultipleCiphers (community successor that can read SQLCipher formats). All of them use page-level AEAD encryption: each 4 KiB page is encrypted independently with a unique nonce, the 100-byte header stays plaintext, and the nonce and auth tag (roughly 28–48 bytes, about 1% of the page) live in SQLite's reserved page space. The cipher guidance is AES-GCM for compliance, AEGIS for speed on AES-NI hardware (not yet NIST-approved), and ChaCha20-Poly1305 for hardware without AES instructions. Teams with a working SQLCipher deployment should stay on it, while new cloud-native or multi-tenant projects needing BYOK should evaluate newer engines such as Turso.

Related posts

  • Encrypting SQLite Databases with Turso: Local, Cloud, and BYOK

    Turso mediumAdept

    Turso offers two SQLite encryption models: native, open-source page-level encryption in its Rust rewrite of SQLite (still behind an --experimental-encryption flag, hex keys) and production-ready BYOK on Turso Cloud, where a base64 key is supplied per connection and never persisted by Turso. Both use AEAD ciphers (AEGIS, AES-GCM, plus ChaCha20-Poly1305 in Cloud only) and encrypt every page and the WAL. AEGIS-256 benchmarks show 0.5–2.8% mixed-workload overhead and roughly 9–14% write overhead. The guide recommends aes256gcm when compliance needs a NIST-approved cipher and aegis256 otherwise, and shows per-tenant databases with separate keys for cryptographic multi-tenant isolation. Native rekeying isn't supported yet, so key rotation means a dump-and-reimport into a new database.

  • SQLite Encryption in Production: Key Management, Migration, and Real-World Use Cases

    Turso mediumAdept

    Production SQLite encryption with Turso fails most often at the key, not the cipher. Generate keys from a CSPRNG (hex for local Turso Database, base64 for Turso Cloud, a common gotcha), keep them in a secret manager, and use one key per tenant. Rotation currently means export, reimport and a brief cutover window because native rekeying isn't available. Migrations from SQLCipher, SEE or plaintext SQLite are dump-and-reimport. AES-256-GCM is recommended over AEGIS for HIPAA and PCI-DSS because auditors expect a NIST-approved cipher, alongside a checklist of the key-management artifacts auditors want to see.

  • Introducing Fast, Native Encryption in Turso Database

    Turso mediumAdept

    Turso Database, a Rust rewrite of SQLite, now supports native encryption at rest using AEAD ciphers (AEGIS-256 and AES-GCM). Each page is encrypted individually with a fresh nonce, and the nonce and auth tag are stored in SQLite's per-page reserved space. Database and WAL files are encrypted, while the 100-byte header is not. Keys are supplied per connection via URI and kept only in memory. Benchmarks with AEGIS-256 show about 6% read and 14% write latency overhead on larger databases and under 3% on total runtime, with key derivation, rekeying and encrypting existing databases still planned.

  • Why we chose Turso to secure AI credentials

    Turso mediumAdept

    Eden, a gateway and control plane for database, API and AI traffic, uses Turso's in-process SQLite-compatible storage with AES-256-GCM whole-database encryption so a single Rust binary can run beside the workloads it governs without a separate Postgres. Whole-database encryption was chosen over column-level encryption, which is fragile across migrations and still leaks schema and row counts. To avoid forking the product, a compatibility layer (TursoPool, TursoConnection) mimics the tokio_postgres client surface and rewrites Postgres SQL at the connection boundary: bind parameters, NOW(), row locks, INTERVAL arithmetic, casts, JSON aggregation and ON CONFLICT predicates. File-backed deployments refuse to start without a 64-hex-character key and run with WAL and synchronous=NORMAL, and tests assert the on-disk file has no plaintext SQLite header.

  • Introducing BYOK Encryption in Turso Cloud

    Turso mediumAdept

    Bring-Your-Own-Key encryption, previously Enterprise-only, is now available to self-service Turso Cloud customers starting on the Pro Plan. The database file and WAL are encrypted on disk and in S3, with each 4 KiB page encrypted individually under a unique nonce using AEAD ciphers (AEGIS, AES-GCM, ChaCha20-Poly1305). Keys are supplied per connection, held only in memory and never stored by Turso, so a lost key means a lost database. Encrypted databases are created and opened via CLI flags and support branching and point-in-time recovery with the same key and cipher.

The quest for software engineering knowledge.

Look:
Layout: