Android and iOS

Local database encryption with SQLCipher

Key lifecycles, signatures, encryption and application data.

Keys and cryptography1 min readEditorial methods

SQLCipher encrypts SQLite data. Key management is as important as the database solution itself.

Evaluation approach

Do not embed keys in code. Coordinate database and key lifecycles during startup, backups, migrations and logout.

Application example

Test that switching accounts cannot reopen the previous database under the wrong account context.

Limits and considerations

Encryption does not prevent unauthorized queries while open or disclosures through logs.

The lifetime of an open connection

Queries still need business authorization after opening. Review connections and caches on logout; an encrypted file alone does not prevent displaying the previous user's records.

Checks and decisions

  • Protect keys
  • Test migration
  • Limit plaintext exposure

Sources

The primary references above provide the technical basis. Example workflows and evaluation suggestions are this publication’s explanations, not independent test results for a particular product.