Sqlite3_key confused comments

I see the following comments in the source … what does this mean?
For the public release do we have to use PRAGMA key = ‘password’ instead?

** Specify the key for an encrypted database. This routine should be
** called right after sqlite3_open().
** The code to implement this API is not available in the public release
** of SQLite.
SQLITE_API int sqlite3_key(
sqlite3 db, / Database to be rekeyed */
const void pKey, int nKey / The key */
SQLITE_API int sqlite3_key_v2(
sqlite3 db, / Database to be rekeyed */
const char zDbName, / Name of the database */
const void pKey, int nKey / The key */

Hello @mtissington - those comments in sqlite.h.in are referring to the public release of SQLite. That does not include any encrypted database implementation. SQLCipher does provide the code that implements the sqlite3_key API.

Sorry I’m really confused by this … your docs say that PRAGMA key calls the internal implementation of sqlite3_key API …

If I build the community version of sqlcipher should it have sqlite3_key?
Or is the only way to specify the key by PRAGMA?


The comment you referred to originates in the SQLite source. It is saying that encryption functionality and sqlite3_key is not present in the public release of SQLite (i.e. the one you’d download from sqlite.org).

SQLCipher, on the other hand, is an extension that exists specifically to implement encryption functionality. Thus, both sqlite3_key and PRAGMA key will work when using SQLCipher (including when built from the community edition sources of SQLCipher).

Let me know if that clears things up.

Great, thanks - that does it.