Android Tutorial Android database encryption with SQLCipher library

Not open for further replies.
SQLCipher is an open source project that extends SQLite and adds full database encryption.

B4A SQLCipher is a special subtype of SQL object. There is almost no need to change any code in order to switch from regular SQL to SQLCipher.

The only difference between SQL API and SQLCipher API is the Initialize method.
SQLCipher.Initialize expects two additional values: Password and a second parameter that is not used (it was used in the past).

Password is the database password. You can pass an empty string if there is no password. Note that it is not possible to change the password (or set a new password) to an existing database.

Code changes required to convert from SQL to SQLCipher
- Declare the SQL object as SQLCipher.
- Change the initialize code to:
SQL1.Initialize(File.DirRootExternal, "1.db", True, DB_PASSWORD, "")

  • Based on SQLCipher v3.59
  • Supports targetSdkVersion 26.
  • The file is no longer required. You can delete it from the Files folder.
  • It is no longer required to disable the debugger virtual assets feature.
    Remove this line: #DebuggerForceStandardAssets: True
  • Old version:

Depends on:
You should download and copy it to the additional libraries folder.


    37.2 KB · Views: 80
Last edited:
Not open for further replies.