Safe conversions • Backups first
Migrate SQLite to SQLCipher (and Back)
Convert a plain SQLite database into an encrypted SQLCipher one, and decrypt encrypted databases back to plain SQLite. Use safe export/import flows and verify integrity on Windows.
Convert plain SQLite → SQLCipher (encrypted)
- Open the plain DB — open your .db/.sqlite file in DB Browser.
- Export to SQL — use Export → Database to SQL to create a dump.
- Create a new encrypted DB — File → New Database, then set a strong passphrase when prompted.
- Import the SQL dump — Import → Database from SQL into the encrypted DB.
- Verify integrity — run
PRAGMA cipher_integrity_check;and test queries.
Tip: Keep the old file until you validate row counts, schema objects, and application compatibility.
Decrypt SQLCipher → plain SQLite
- Open with key — open the encrypted DB using the correct passphrase and parameters.
- Export to SQL — Export → Database to SQL to dump schema and data.
- Create a new plain DB — File → New Database without encryption.
- Import the SQL dump — Import → Database from SQL.
- Validate — check object counts and sample data; run
PRAGMA integrity_check;.
Move between SQLCipher versions (v3 ↔ v4)
- Open the DB with a tool that matches the original version and settings.
- Export to SQL, then import into a new encrypted DB with the target version’s defaults.
- Re-test access in your apps and keep backups.
FAQ
Will views, triggers, and indexes migrate correctly?
Yes. The SQL export includes schema objects and data. After import, verify that triggers fire as expected and all indexes exist.
Can I migrate in-place without export/import?
For best safety and compatibility, use export/import. Direct PRAGMA rekey may not cover version/parameter changes between environments.
My app still can’t open the migrated DB.
Confirm SQLCipher parameters, and try migrating using the same tool/version as your app. See Troubleshooting.