Use SQLCipher in Xamarin Shared Library

Hello we’re developing a native app in Microsoft Xamaring.Forms using the sql-net-pcl v1.4.118.

Using nuget packages:
NETStandard.Library v2.01
Newtonsoft.JSON v11.0.1
Xamarin.Forms v2.5.1.444934
sqlite-net-pcl v1.4.118

The project is a Shared Library using NETStandard Library, with iOS and Android projects referencing the library/.dll.

We are using the trial SQLCipher libraries at the moment.

How do we implement the SQLCipher libraries with the sql-net-pcl nuget and do we encrypt the SQLite database with SQLCipher?

Hello @nsp

Thank you for your interest in SQLCipher for Xamarin. Our SQLCipher packages use a slightly different package, with a dependency on SQLite.Net.Core, not (praeclarum/sqlite-net), a PCL-based library. We have been working on migrating to use sqlite-net as an alternative package for the future, however this is an involved process due to the wide range of platforms and compatibility requirements. If using the current version of the packages is not feasible, we could certainly follow back up with you at a later date when the client library has been changed and offer a new trial at that point. We plan to support using .NET Standard in the future release.

Why not have the platform-specific components (e.g. SqliteConnection) implement an interface so that the interface can be programmed against from the Shared PCL library? Each platform could then dependency inject the implementation. This is what I do in my project, but it requires me maintaining a large set of facades to wrap all of the objects necessary. It would be nice if interfaces were just there, out-of-the-box, in a PCL-compatible library.

Hi @dustincleveland

Our current production package does effectively plugin via an interface, albeit to a different client library than the one requested above. We are nearing completion of our next release that will streamline this process for users who wish to use alternative client libraries to interface with SQLCipher.

Hello @nsp and @dustincleveland - SQLCipher 4 was recently released and offers a new sqlite-net compatible application interface. The new integration approach is much more flexible. Please feel free to contact us if you’d like to try it out.