# Use SQLCipher in Xamarin Shared Library

**URL:** <https://discuss.zetetic.net/t/use-sqlcipher-in-xamarin-shared-library/2794>\
**Category:** Issues\
**Created:** [April 24, 2018, 9:40am UTC](https://discuss.zetetic.net/t/use-sqlcipher-in-xamarin-shared-library/2794 "2018-04-24T09:40:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsp](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@nsp](https://discuss.zetetic.net/u/nsp)\
**Post date:** [April 24, 2018, 9:40am UTC](https://discuss.zetetic.net/t/use-sqlcipher-in-xamarin-shared-library/2794/1 "2018-04-24T09:40:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [April 24, 2018, 2:32pm UTC](https://discuss.zetetic.net/t/use-sqlcipher-in-xamarin-shared-library/2794/2 "2018-04-24T14:32:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dustincleveland](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@dustincleveland](https://discuss.zetetic.net/u/dustincleveland)\
**Post date:** [November 29, 2018, 3:48pm UTC](https://discuss.zetetic.net/t/use-sqlcipher-in-xamarin-shared-library/2794/3 "2018-11-29T15:48:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![developernotes](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/developernotes/32/1309_2.png) [@developernotes](https://discuss.zetetic.net/u/developernotes)\
**Post date:** [November 29, 2018, 8:01pm UTC](https://discuss.zetetic.net/t/use-sqlcipher-in-xamarin-shared-library/2794/4 "2018-11-29T20:01:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sjlombardo](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.zetetic.net/sjlombardo/32/3_2.png) [@sjlombardo](https://discuss.zetetic.net/u/sjlombardo)\
**Post date:** [December 11, 2018, 3:28am UTC](https://discuss.zetetic.net/t/use-sqlcipher-in-xamarin-shared-library/2794/5 "2018-12-11T03:28:07Z")

</div>

Hello @nsp and @dustincleveland - SQLCipher 4 was [recently released](https://www.zetetic.net/blog/2018/11/30/sqlcipher-400-release/) and offers a new sqlite-net compatible application interface. The [new integration approach](https://www.zetetic.net/sqlcipher/sqlcipher-for-dotnet/) is much more flexible. Please feel free to contact us if you’d like to try it out.
