Newbie here trying to hook up Sqlcipher into a .NET Core (Windows) Sqlite application. We are also using DevExpress XPO.
I've tried mirroring the steps outlined in SQLCipher documentation page. It runs without errors or exceptions, but it doesn't to do the encryption.
Here is a sample snippet of my code:
var unitOfWork = new UnitOfWork(IDataLayer);
unitOfWork.ExecuteNonQuery($"PRAGMA key = '{myKeyValue}';");
unitOfWork.ExecuteNonQuery($"PRAGMA cipher_license = '{myCipherLicense}';");
unitOfWork.ExecuteNonQuery("CREATE TABLE IF NOT EXISTS Model(id, a,b);");
At this point, an encrypted DB file should be created.
I attempt to run the following without using key/cipher key:
try
{
var unitOfWork = new UnitOfWork(IDataLayer);
unitOfWork.ExecuteNonQuery(“INSERT INTO Model (id, a, b) VALUES (‘id’, ‘a’, ‘b’);”);
}
catch (Exception ex)
{
}
I would expect to throw an exception at this point indicated I tried to access DB without key/cipher license.
I am also able to open the generated DB in SqliteStudio and view data with no restrictions.
Here are the NuGet Packages I am referencing:
PackageReference Include=“DevExpress.Xpo” Version=“23.1.3”
PackageReference Include=“Microsoft.Data.Sqlite.Core” Version=“7.0.9”
PackageReference Include=“SQLitePCLRaw.bundle_e_sqlcipher” Version=“2.1.5”
PackageReference Include=“SQLitePCLRaw.bundle_zetetic” Version=“2.1.5”
PackageReference Include=“System.Data.SQLite” Version=“1.0.117”
PackageReference Include=“zetetic-sqlcipher-windows-fips” Version=“4.5.3”
I feel like I'm missing something somewhere either in setup steps or environment.
Can someone help get me pointed in the right direction?