praeclarum / sqlite-net

Simple, powerful, cross-platform SQLite client and ORM for .NET
MIT License
4.09k stars 1.42k forks source link

sqlcipher 4 #813

Open mike12121212 opened 5 years ago

mike12121212 commented 5 years ago

Passing a key in the connectionstring seems to create a database with sqlcipher 3 encryption. How do we create a database with sqlcipher 4 encryption?

ericsink commented 5 years ago

The unofficial sqlcipher builds provided with SQLitePCL.raw (which is used by sqlite-net) currently only support sqlcipher 3.

See ericsink/SQLitePCL.raw#244

You can, however, use the official builds from Zetetic with SQLitePCLRaw.bundle_zetetic.

clawrenceks commented 5 years ago

@ericsink Just following up on your last response on this issue. I can see that passing in a connection string to the constructor still creates a database with sqlcipher3 encryption.

You refer to being able to "use the official builds from Zetetic with SQLitePCLRaw.bundle_zetetic.". I have to be honest, I am not sure what you are referring to here. Is there any further guidance on the subject that you are referring to?

ericsink commented 5 years ago

Zetetic is the company that develops SQLCipher. Their website is:

https://www.zetetic.net/sqlcipher/

The nuget package that bridges the gap between SQLitePCL.raw and Zetetic's builds is:

https://www.nuget.org/packages/SQLitePCLRaw.bundle_zetetic/

clawrenceks commented 5 years ago

Thanks for the response @ericsink - I should have been clearer in my original question. I can see the Nuget package that you refer to, but I can't say that I am sure what is supposed to be done with that pacakge. Perhaps I am trying to do something that just isn't going to work. What I was hoping to do was use the sqlite-net package, but use v4 of sqlcipher, rather than v3.

ericsink commented 5 years ago

Zetetic sells official builds of sqlcipher. You can buy a v4 build from them, and their support folks will help you use it with bundle_zetetic.

clawrenceks commented 5 years ago

That's the route I was looking at taking, will go for that route.

sjlombardo commented 5 years ago

@clawrenceks to provide a bit of additional clarity, the "official builds" are commercially licensed and supported by Zetetic. Specifically the SQLCipher for Xamarin.iOS, SQLCipher for Xamarin.Android, SQLCipher for Windows .NET, and SQLCipher for macOS .NET packages are all compatible with SQLitePCLRaw.bundle_zetetic. These are all based on the most recent version of SQLCipher, currently 4.1.0. Updates are always in lock-step with the most recent release of SQLCipher and are usually made available to customers the same day as the public announcement. These packages are supported by the SQLCipher development team. You can obtain free trials of any of the Commercial Edition packages at the site.

In order to use one of the official builds, you would just need to go to the SQLCipher site above, and either request a trial or purchase one or more of the Commercial Edition packages. You would then add the packages to your project and, in conjunction with SQLitePCLRaw.bundle_zetetic, they can be used with sqlite-net and other libraries that rely on the SQLitePCLRaw bundles (e.g. Microsoft.Data.SQLite, Entity Framework Core 2, etc).

If you have any other questions about the Commercial Edition builds I would encourage you to either visit the SQLCipher discussion site or send us an email at Zetetic Support.

clawrenceks commented 5 years ago

@sjlombardo Thanks for the additional information. I have requested a trial to look at integrating 4.1 into my project.

jlcool commented 5 years ago

Can't there be two versions? Use the new version of 4.x and the old version of 3.x. Isn't that okay?