We’re pleased to announce SQLCipher 4.7.0, which updates the baseline to SQLite 3.49.1 and includes several major improvements to memory management, library initialization, and cryptographic operations. This release represents the largest set of improvements since SQLCipher 4 and it should prove to be much faster and more efficient for most integrating applications.
The new version of SQLCipher incorporates a major build system change introduced by upstream SQLite’s transition to use autosetup
in version 3.48.0. This restructuring required corresponding changes to SQLCipher that substantially diverge from the historical build process. This resulted in several “breaking changes” to build flags and file output naming. We’ve taken advantage of this opportunity to introduce additional optimizations and security enhancements that also required major changes.
Since these changes mainly affect the library and executable build steps, they should primary affect integrators that are building from source (i.e. the Open Source Community Edition of SQLCipher). We have worked hard to minimize impact for Commercial and Enterprise customers; our official packages abstract away most of the underlying build system changes.
One notable inherited change from SQLite could affect all SQLCipher packages: the behavior of SELECT
statements on encrypted databases prior to keying. SQLCipher’s documentation has always stated that applications should provide a key to the database via sqlite3_key()
, sqlite3_key_v2()
, or PRAGMA key
as the first operation on a database connection. However, in previous versions of SQLCipher, it was technically possible to invoke schema-less statements (those that would not read from the database, e.g. SELECT 1
) prior to keying. That is no longer possible in this release. Applications now MUST set the key prior to executing these types of statements as they do read the database file. This new requirement stems from a change to SQLite’s internal query parsing logic. Note that this change should not affect well-behaved applications that previously adhered to SQLCipher integration guidelines, but it still presents potential as a breaking change in some limited cases.
The following summarizes the breaking changes required for alignment with upstream SQLite and other improvements:
All packages:
SELECT
statements (including schema independent queries like SELECT 1
) cannot be executed prior to setting the database key on encrypted databaseBuild system only:
configure
flag --enable-tempstore=yes
to --with-tempstore=yes
for alignment with SQLitesqlcipher
and libsqlcipher
to sqlite3
and libsqlite3
configure
flag --with-crypto-lib
(replace with appropriate -DSQLCIPHER_CRYPTO_*
CFLAG)SQLITE_EXTRA_INIT=sqlcipher_extra_init
and SQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown
at compile timeSQLITE_THREADSAFE
of 1 or 2) and temporary storage (i.e. SQLITE_TEMP_STORE
of 2 or 3) settings at compile timeThis release also includes a substantial change to the library initialization and cleanup to reduce overhead and improve performance. As part of this change, SQLCipher now allocates most required memory at startup. This approach is more efficient, improves memory locking on constrained platforms while reducing memory fragmentation. It should reduce or eliminate mlock
and VirtualLock
warnings on Android and Windows respectively.
Additional core changes and improvements include:
sqlcipher_provider
interface with init
and shutdown
functions.recover
shell command on corrupt databases with a full plaintext first pagesqlcipher_export()
and PRAGMA cipher_migrate
SQLCIPHER_CRYPTO_CUSTOM
macroSQLCipher for Android includes two major library changes:
Applications using SQLCipher for Android can expect to see measurable performance improvements with this upgrade, as evidenced by the following benchmarks:
UPDATE 2025-03-31: A 4.7.2 patch release is now available for the following: SQLCipher for Android (All Editions), SQLCipher for Android FIPS (Enterprise), and SQLCipher for React Native (Enterprise). It fixes two unpredictable defects in SQLCipher for Android 4.7.0’s new Cursor Window implementation that could cause a crash when a large query result set triggers a window resize with a fragmented heap. Applications using affected 4.7.0 packages should upgrade. Earlier versions of SQLCipher for Android below 4.7.0 are unaffected.
Most notably, the new version of SQLCipher Commercial and Enterprise packages include a massive performance improvement for multi-connection workloads. Applications with connection-heavy use cases that use multiple database handles to the same databases can expect to see a 100%+ speedup when establishing new connections. This can greatly enhance throughput for applications, especially with numerous concurrent connections or when using connection pools (e.g. on Java, Android, ADO.NET, EntityFrameworkCore, etc). These performance improvements are exclusive to Commercial and Enterprise builds.
For example, the following benchmarks show single and multi-threaded scenarios between 4.6.1 and 4.7.0, where each test executes 100 iterations, split up across threads, using a mixed set of operations. Numbers in parentheses reflect the number of threads and iterations per thread. While these were measured using EntityFrameworkCore in .NET, similar performance improvements are seen across all 4.7.0 packages.
In addition to the speed boost, there are a number of other improvements available solely to Commercial and Enterprise:
win10
to win
for improved compatibilityImportant Note: Official SQLCipher packages shield customers from most of the breaking changes in the community edition, but there are two changes that customers must be aware of:
SELECT
statements (including schema independent queries like SELECT 1
) should not be executed on encrypted databases prior to setting the database keySQLCipher 4.7.0 is available for download now. Due to the potentially breaking changes, we recommend testing your applications thoroughly with the new version before deploying to production.
Commercial and Enterprise - On-demand access to new releases of SQLCipher packages are available to all licensees with an active CipherCare support subscription from the Customer Downloads fulfillment site. Subscribers will also receive a separate email notification regarding the update and can contact us at any time for private support directly from the SQLCipher development team. Don’t forget to update your license code with this upgrade.
Community Edition - SQLCipher Community Edition source code is available on GitHub, via AAR packaging for Android, and CocoaPods for iOS.
For feedback and questions, please visit our Community Forum or private support channels.