I'm trying to implemented the sql chiper lib with an encrypted version of my db however I'm hitting a brick wall, the error i get is:
this is the way (currently) i try to read the encrypted db:
the problem is I dont know if i'm missing anything in the way i code it or the encrypted db is damaged, i've attached both db (encrypted and un encrypted) to this post inside the zip file.
Thank you all and happy passover.
Best,
Ram
B4X:
info.guardianproject.database.sqlcipher.SQLiteException: file is encrypted or is not a database: , while compiling: SELECT * FROM Version
this is the way (currently) i try to read the encrypted db:
B4X:
Sub Activity_Create(FirstTime As Boolean)
'clear old DB
If File.Exists(File.DirInternal ,"test.db") = True Then File.Delete(File.DirInternal,"test.db")
If File.Exists(File.DirInternal ,"test_encrypted.db") = True Then File.Delete(File.DirInternal,"test_encrypted.db")
'copy db's to the internal dir
File.Copy(File.DirAssets,"test.db",File.DirInternal,"test.db")
File.Copy(File.DirAssets,"test_encrypted.db",File.DirInternal,"test_encrypted.db")
'add the content of sqlcipher_native.zip to DirAssets
File.Copy(File.DirAssets,"icudt46l.dat",File.DirInternal,"icudt46l.dat")
File.Copy(File.DirAssets,"libdatabase_sqlcipher.so",File.DirInternal,"libdatabase_sqlcipher.so")
File.Copy(File.DirAssets,"libsqlcipher_android.so",File.DirInternal,"libsqlcipher_android.so")
File.Copy(File.DirAssets,"libstlport_shared.so",File.DirInternal,"libstlport_shared.so")
'testing the un encrypted db
SQL1.Initialize(File.DirInternal, "test.db", True )
Cursor1 = SQL1.ExecQuery("SELECT * FROM Version")
Cursor1.Position = 0
Msgbox(Cursor1.GetString("Release") & Chr(10) & "Release Date: " & Cursor1.GetString("Date"),"un encrypted db")
Cursor1.Close
SQL1.Close
'testing the encrypted db
SQLChip.Initialize(File.DirInternal, "test_encrypted.db", False, "test",File.DirInternal)
Cursor1 = SQLChip.ExecQuery("SELECT * FROM Version")
Cursor1.Position = 0
Msgbox(Cursor1.GetString("Release") & Chr(10) & "Release Date: " & Cursor1.GetString("Date"),"encrypted db")
Cursor1.Close
SQLChip.Close
End Sub
the problem is I dont know if i'm missing anything in the way i code it or the encrypted db is damaged, i've attached both db (encrypted and un encrypted) to this post inside the zip file.
Thank you all and happy passover.
Best,
Ram
Attachments
Last edited: