Hi there, I’m in the midst of evaluating the commercial version of SQLCipher and am trying to use the table level encryption. I think I’ve followed the directions correctly. The table (and it’s shadow partner) create properly but whenever I go to try to insert a row into the table a SQLiteException gets thrown with the message ‘SQL Logic error’. I know the SQL being executed is correct so I feel like I’ve done something wrong in either setting up the encrypted table or how I’m addressing it. Any help would be appreciated.
Thanks!
On app launch:
-
Set license
PRAGMA cipher_license = ‘my_trial_key’ -
creating the virtual table with:
CREATE VIRTUAL TABLE IF NOT EXISTS MyTable USING sqlcipher_vle(CREATE TABLE IF NOT EXISTS MyTable_shadow
(
Field1 TEXT NOT NULL,
Field2 TEXT NOT NULL,
Field3 TEXT NOT NULL,
Field4 TEXT NOT NULL,
Field5 NUMERIC,
Field6 INTEGER,
Field7 TEXT,
Field8 TEXT,
Field9 INTEGER,
Field10 INTEGER,
Field11 BLOB,
Field12 TEXT,
Field13 INTEGER NOT NULL,
Field14 INTEGER NOT NULL,
PRIMARY KEY(Field1,Field2,Field3,Field4), ‘1,2,3,4,5,6,11,12,13,14’);
- Set VLE level password before attempting any operations on above table
SELECT sqlcipher_vle_key(‘mypassword’);
Later in the code on some user event happening…
- Attempt to insert row
INSERT INTO [MyTable] ([Field1],[Field2],[Field3],[Field4]) VALUES(?,?,?,?)
(Prepared statement)
Error:
SQL Logic error at SQLite.SQLiteCommand.ExecuteNonQuery
I know the SQL I’m trying to execute works as I’ve been able to run it in SQLiteBrowser app.
Does sqlcipher_vle_key have to be run before every operation on the table? I’m only calling that once at app start.