I'm trying to switch my app over from access to SQLite, and id like to have encryption. I am trying to use "Microsoft.data.sqlite" with "SQLitePCLRaw.bundle_e_sqlcipher", but setting the password seemingly does nothing. Following the official guide : from here
it set it up like this : Public DBConnection As String = "Data Source=" & Environment.CurrentDirectory & "\test.db;Mode=ReadWriteCreate;Password=testtest123"
and opened the connection and i also tried doing this :
Dim DBConnection As String = "Data Source=" & Environment.CurrentDirectory & "\test.db;Mode=ReadWriteCreate"
Try
Using dbconn As New SqliteConnection(DBConnection)
dbconn.Open()
Dim command = dbconn.CreateCommand()
command.CommandText = "SELECT quote($password);"
command.Parameters.AddWithValue("$password", "testtest123")
Dim quotedpsw = New String(command.ExecuteScalar)
command.CommandText = "PRAGMA key = " & quotedpsw
command.Parameters.Clear()
command.ExecuteNonQuery()
End Using
Catch ex As Exception
MsgBox(ex.Message)
End Try
I tried these methods with setting SQLitePCL.raw.SetProvider(New SQLitePCL.SQLite3Provider_e_sqlcipher())
before the connection is used, none of them encrypted it and also didn't give exceptions.
I also tried using "SQLitePCLRaw.bundle_sqlcipher" but it gives this exception: Method not found βInt32 SQLitePCL.ISQLite3Provider.sqlite3_win32_set_directory(Int32, System.String)β.'
I also tried encrypting the database outside with DB Browser for SQLite both with SQLCipher 3 and 4 but neither of those ways could I then connect to the db from my app... Thanks!
EDIT.: I thought I'd restart so i removed every package and redownloaded the two I mentioned originally(+ the provider package), and now when i set SQLitePCL.raw.SetProvider(New SQLitePCL.SQLite3Provider_e_sqlcipher())
every time it gives an exception : "e_sqlcipher" DLL couldn't be loaded. The specified module couldn't be found. Id also be open to using another solution if anyone has good experiences with another one.