We have an existing application that runs on Windows desktop under .net 4.5. We are using System.Data.SQLite with a password to encrypt the database file. We have been working on modifying our application to run cross platform on Windows, Linux, and Mac.
I have been able to compile the native libSQLite.Interop.so library using these instructions. My test program works on Windows and Linux as long as no password is given. When I include a password in the connection string, running in Windows works as expected however, running on Linux results in an exception. My test code is an F# script:
#r "System.Data.SQLite.dll"
open System
open System.Data.SQLite
let dbFile = @"test.db"
let pw = "this is my super secure password"
let cnBuilder = SQLiteConnectionStringBuilder()
cnBuilder.DataSource <- dbFile
cnBuilder.Password <- pw
let cn = new SQLiteConnection(cnBuilder.ToString())
cn.Open()
...
Throws this exception:
System.EntryPointNotFoundException: sqlite3_key
at (wrapper managed-to-native) System.Data.SQLite.UnsafeNativeMethods.sqlite3_key(intptr,byte[],int)
at System.Data.SQLite.SQLite3.SetPassword (System.Byte[] passwordBytes) [0x0000b] in <226287aa71b9481b9dd405c36cfaba76>:0
at System.Data.SQLite.SQLiteConnection.Open () [0x005c5] in <226287aa71b9481b9dd405c36cfaba76>:0
at <StartupCode$FSI_0001>.$FSI_0001.main@ () [0x00041] in <d78f800532b445c4abcca81cff853dd6>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in <7b0d87324cab49bf96eac679025e77d1>:0
I assume the System.Data.SQLite source code would include the same encryption logic regardless of where it is compiled, therefore I am confused on why this doesn't work. Are there more compiler flags that need to be included to enable encryption, or does the system compiling the library need an additional dependency? Please help.