Feb 13, 2012 Replies: 163 Edit: this library isn't compatible with the 16KB page size requirement. Don't use it. SQLCipher is an open source project that extends SQLite and adds full database encryption. License: https://www.zetetic.net/sqlcipher/open-source/ 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: Code: Copy SQL1.Initialize(File.DirRootExternal, "1.db", True, DB_PASSWORD, "") V1.70 Based on SQLCipher v4.5.4: https://www.zetetic.net/blog/2023/04/27/sqlcipher-4.5.4-release/ V1.60 Based on SQLCipher v4.00: https://www.zetetic.net/blog/2018/11/30/sqlcipher-400-release/ Includes 64 bit binaries and emulator binaries. Requires B4A v8+. Library is attached. Not compatible by default with databases created with older versions. See this link: https://www.zetetic.net/blog/2018/11/30/sqlcipher-400-release/#compatibility V1.50 Based on SQLCipher v3.59 Supports targetSdkVersion 26. The icu.zip 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: www.b4x.com/android/files/SQLCipher150.zip Depends on: https://repo1.maven.org/maven2/net/...er/4.5.4/android-database-sqlcipher-4.5.4.aar You should download and copy it to the additional libraries folder. Attachments SQLCipher.zip SQLCipher.zip 37.2 KB · Views: 1,364 Last edited: Jul 20, 2025 Click to expand...
Edit: this library isn't compatible with the 16KB page size requirement. Don't use it. SQLCipher is an open source project that extends SQLite and adds full database encryption. License: https://www.zetetic.net/sqlcipher/open-source/ 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: Code: Copy SQL1.Initialize(File.DirRootExternal, "1.db", True, DB_PASSWORD, "") V1.70 Based on SQLCipher v4.5.4: https://www.zetetic.net/blog/2023/04/27/sqlcipher-4.5.4-release/ V1.60 Based on SQLCipher v4.00: https://www.zetetic.net/blog/2018/11/30/sqlcipher-400-release/ Includes 64 bit binaries and emulator binaries. Requires B4A v8+. Library is attached. Not compatible by default with databases created with older versions. See this link: https://www.zetetic.net/blog/2018/11/30/sqlcipher-400-release/#compatibility V1.50 Based on SQLCipher v3.59 Supports targetSdkVersion 26. The icu.zip 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: www.b4x.com/android/files/SQLCipher150.zip Depends on: https://repo1.maven.org/maven2/net/...er/4.5.4/android-database-sqlcipher-4.5.4.aar You should download and copy it to the additional libraries folder.
Erel B4X founder Staff member Licensed User Longtime User Jun 14, 2013 #61 I will update it next week.
Erel B4X founder Staff member Licensed User Longtime User Jun 16, 2013 #62 SQLCipher v1.10 is released. This update is based on the native SQLCipher v2.1.1 library. Note that there might be backwards compatibility issues with databases created with the previous versions. This update should be used by new projects only.
SQLCipher v1.10 is released. This update is based on the native SQLCipher v2.1.1 library. Note that there might be backwards compatibility issues with databases created with the previous versions. This update should be used by new projects only.
MotoMusher Active Member Licensed User Longtime User Jul 7, 2013 #63 Thank you Erel, This is fantastic. Thank you very much. I was starting to hack my way around randomaccessfile when I stumbled upon this. Problem solved
Thank you Erel, This is fantastic. Thank you very much. I was starting to hack my way around randomaccessfile when I stumbled upon this. Problem solved
H hypergreatthing Member Licensed User Longtime User Jul 23, 2013 #64 Erel said: SQLCipher v1.10 is released. This update is based on the native SQLCipher v2.1.1 library. Note that there might be backwards compatibility issues with databases created with the previous versions. This update should be used by new projects only. Click to expand... Just fyi. I really wanted to try and leverage the batch queries support 1.10 gives. I was willing to recreate the databases using the new updated library. The problem was that my app kept on crashing on initialize with the following error: java.lang.NoClassDefFoundError: info/guardianproject/database/CursorWindow So i created a new test program and found that worked fine. I'm not sure why, but after about 15 minutes i found that uninstalling the program on the device and then compiling and installing cleaned out whatever else was refering to the old sqlcipher library and everything works again. So just putting this here to save some time in case someone else runs into the same problem.
Erel said: SQLCipher v1.10 is released. This update is based on the native SQLCipher v2.1.1 library. Note that there might be backwards compatibility issues with databases created with the previous versions. This update should be used by new projects only. Click to expand... Just fyi. I really wanted to try and leverage the batch queries support 1.10 gives. I was willing to recreate the databases using the new updated library. The problem was that my app kept on crashing on initialize with the following error: java.lang.NoClassDefFoundError: info/guardianproject/database/CursorWindow So i created a new test program and found that worked fine. I'm not sure why, but after about 15 minutes i found that uninstalling the program on the device and then compiling and installing cleaned out whatever else was refering to the old sqlcipher library and everything works again. So just putting this here to save some time in case someone else runs into the same problem.
Erel B4X founder Staff member Licensed User Longtime User Dec 5, 2013 #65 SQLCipher v1.20 is now available. The previous version crashes on Android 4.4. Starting from v1.20 the native libraries are included in the jar file. This means that you should delete sqlcipher_native.zip from the files tab. However you should add instead a file named icudt46l.zip. The last parameter in the Initialize method is not used anymore.
SQLCipher v1.20 is now available. The previous version crashes on Android 4.4. Starting from v1.20 the native libraries are included in the jar file. This means that you should delete sqlcipher_native.zip from the files tab. However you should add instead a file named icudt46l.zip. The last parameter in the Initialize method is not used anymore.
F FabioG Active Member Licensed User Longtime User Dec 10, 2013 #66 Erel said: SQLCipher v1.20 is now available. The previous version crashes on Android 4.4. Starting from v1.20 the native libraries are included in the jar file. This means that you should delete sqlcipher_native.zip from the files tab. However you should add instead a file named icudt46l.zip. The last parameter in the Initialize method is not used anymore. Click to expand... Hello Erel, I can not find the link for download the 1.20 version Last edited: Dec 10, 2013
Erel said: SQLCipher v1.20 is now available. The previous version crashes on Android 4.4. Starting from v1.20 the native libraries are included in the jar file. This means that you should delete sqlcipher_native.zip from the files tab. However you should add instead a file named icudt46l.zip. The last parameter in the Initialize method is not used anymore. Click to expand... Hello Erel, I can not find the link for download the 1.20 version
JohnD Active Member Licensed User Longtime User Dec 10, 2013 #67 He updated the original download page. http://www.b4x.com/android/forum/th...ryption-with-sqlcipher-library.14965/#content
He updated the original download page. http://www.b4x.com/android/forum/th...ryption-with-sqlcipher-library.14965/#content
JohnD Active Member Licensed User Longtime User Dec 12, 2013 #70 You may have components from the old SQLCipher Lib still loaded in your project. Here's what I had to do for an old project: sqlcipher_native.zip needs to be removed from your project files tab. Save your project and unload SQLCipher. Reload your project and select SQLCipher in the libs tab. You should see Version 1.2 come up. Make sure you have added icudt46l.zip at your files tab - just putting it in your files folder is not enough. SQL1.Initialize(Directory, dbfile , true, pwd, "") is the correct new initialization string.
You may have components from the old SQLCipher Lib still loaded in your project. Here's what I had to do for an old project: sqlcipher_native.zip needs to be removed from your project files tab. Save your project and unload SQLCipher. Reload your project and select SQLCipher in the libs tab. You should see Version 1.2 come up. Make sure you have added icudt46l.zip at your files tab - just putting it in your files folder is not enough. SQL1.Initialize(Directory, dbfile , true, pwd, "") is the correct new initialization string.
alwaysbusy Expert Licensed User Longtime User Dec 12, 2013 #71 @JohnD Thanks for the reply! I never had the old version on my PC. (Both SQL and SQLCipher are 1.20) This is the first time I used this library, I just downloaded it from the first page. icudt46l.zip is the only one in the files folder, no sqlcipher_native.zip . It is also in the files tab. Cleaned the project and files folder but no result. When I decompile the generated apk, all files seem to be in it. Weird. So, no solution yet, but we'll keep searching btw. I moved this question to Questions (seemed more suitable)
@JohnD Thanks for the reply! I never had the old version on my PC. (Both SQL and SQLCipher are 1.20) This is the first time I used this library, I just downloaded it from the first page. icudt46l.zip is the only one in the files folder, no sqlcipher_native.zip . It is also in the files tab. Cleaned the project and files folder but no result. When I decompile the generated apk, all files seem to be in it. Weird. So, no solution yet, but we'll keep searching btw. I moved this question to Questions (seemed more suitable)
H hypergreatthing Member Licensed User Longtime User Dec 19, 2013 #73 just fyi, if i'm reading this right: https://groups.google.com/forum/#!topic/sqlcipher/H9XirICbZUw There is an issue with sqlcipher and android 4.4 kitkat where this error appears: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN7android10MemoryBaseC1ERKNS_2spINS_11IMemoryHeapEEElj" referenced by "libdatabase_sqlcipher.so"... which i believe they have possibly fixed in the latest build of sqlcipher. Thank you in advanced for a possible version update Erel =)
just fyi, if i'm reading this right: https://groups.google.com/forum/#!topic/sqlcipher/H9XirICbZUw There is an issue with sqlcipher and android 4.4 kitkat where this error appears: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN7android10MemoryBaseC1ERKNS_2spINS_11IMemoryHeapEEElj" referenced by "libdatabase_sqlcipher.so"... which i believe they have possibly fixed in the latest build of sqlcipher. Thank you in advanced for a possible version update Erel =)
Erel B4X founder Staff member Licensed User Longtime User Dec 20, 2013 #74 Already fixed. See post #65.
H hypergreatthing Member Licensed User Longtime User Dec 20, 2013 #75 Erel said: Already fixed. See post #65. Click to expand... My bad, missed that. Thank you very much =)
Erel said: Already fixed. See post #65. Click to expand... My bad, missed that. Thank you very much =)
tufanv Expert Licensed User Longtime User Apr 15, 2014 #76 I read all the posts for this topic. I cant still understand how to convert old normal databases to new passwrod protected databases. Can anyone help do we still need to write a small program to convert or new version can convert it directly =? Last edited: Apr 15, 2014
I read all the posts for this topic. I cant still understand how to convert old normal databases to new passwrod protected databases. Can anyone help do we still need to write a small program to convert or new version can convert it directly =?
MotoMusher Active Member Licensed User Longtime User Apr 15, 2014 #77 tufanv said: I read all the posts for this topic. I cant still understand how to convert old normal databases to new passwrod protected databases. Can anyone help do we still need to write a small program to convert or new version can convert it directly =? Click to expand... I believe you still need to convert with code. That is what I did.
tufanv said: I read all the posts for this topic. I cant still understand how to convert old normal databases to new passwrod protected databases. Can anyone help do we still need to write a small program to convert or new version can convert it directly =? Click to expand... I believe you still need to convert with code. That is what I did.
H hypergreatthing Member Licensed User Longtime User May 2, 2014 #78 So FYI: I was having a problem with sqlcipher 1.20. The it wouldn't read any databases generated by my linux build. This was probably due to version differences. When i read the databases on the linux side i had to migrate them first. I downloaded the new build of sqlcipher for android (3.1.0), replaced the jar files in 1.20 with the ones in the build and recompiled the SQLCipher.jar file with the new .so files in the build. Works well far. It's not compatible with files generated under 1.20. If you're interested Erel, i can post it here.
So FYI: I was having a problem with sqlcipher 1.20. The it wouldn't read any databases generated by my linux build. This was probably due to version differences. When i read the databases on the linux side i had to migrate them first. I downloaded the new build of sqlcipher for android (3.1.0), replaced the jar files in 1.20 with the ones in the build and recompiled the SQLCipher.jar file with the new .so files in the build. Works well far. It's not compatible with files generated under 1.20. If you're interested Erel, i can post it here.
Erel B4X founder Staff member Licensed User Longtime User May 4, 2014 #79 hypergreatthing said: So FYI: I was having a problem with sqlcipher 1.20. The it wouldn't read any databases generated by my linux build. This was probably due to version differences. When i read the databases on the linux side i had to migrate them first. I downloaded the new build of sqlcipher for android (3.1.0), replaced the jar files in 1.20 with the ones in the build and recompiled the SQLCipher.jar file with the new .so files in the build. Works well far. It's not compatible with files generated under 1.20. If you're interested Erel, i can post it here. Click to expand... Please upload it. It will be useful.
hypergreatthing said: So FYI: I was having a problem with sqlcipher 1.20. The it wouldn't read any databases generated by my linux build. This was probably due to version differences. When i read the databases on the linux side i had to migrate them first. I downloaded the new build of sqlcipher for android (3.1.0), replaced the jar files in 1.20 with the ones in the build and recompiled the SQLCipher.jar file with the new .so files in the build. Works well far. It's not compatible with files generated under 1.20. If you're interested Erel, i can post it here. Click to expand... Please upload it. It will be useful.
H hypergreatthing Member Licensed User Longtime User May 5, 2014 #80 Erel said: Please upload it. It will be useful. Click to expand... Ok. I changed the version to be 3.10 to coincide with the sqlcipher version. Also, in reading the forums there might be some performance differences with this new version. It seems noticeably slower when first opening a file. I'm having trouble uploading (max 512k it says). I'll try a private message or hosting it somewhere.
Erel said: Please upload it. It will be useful. Click to expand... Ok. I changed the version to be 3.10 to coincide with the sqlcipher version. Also, in reading the forums there might be some performance differences with this new version. It seems noticeably slower when first opening a file. I'm having trouble uploading (max 512k it says). I'll try a private message or hosting it somewhere.