Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Sqlcipher not encrypting the database. #1257

Open
SC-HeinrichG opened this issue Oct 23, 2024 · 4 comments
Open

Issue with Sqlcipher not encrypting the database. #1257

SC-HeinrichG opened this issue Oct 23, 2024 · 4 comments

Comments

@SC-HeinrichG
Copy link

Hi Guys,

I trust you are all well,

I used Gerald Versluis tutorial to originally setup a secure test database as per this link and your gitlab site.
https://www.google.com/search?q=maui+sqlite+sqlcipher+example&oq=Maui+SQL&gs_lcrp=EgZjaHJvbWUqBggAEEUYOzIGCAAQRRg7MgYIARBFGDkyBggCEEUYOzIGCAMQRRg7MgYIBBBFGDwyBggFEEUYPDIGCAYQRRg8MgYIBxAuGEDSAQkxMDYzNWowajGoAgCwAgA&sourceid=chrome&ie=UTF-8#fpstate=ive&vld=cid:01b06d9d,vid:O1UQfoh4710,st:0

We've been using sqlite-net-sqlcipher version 1.9.172 and versions from before in dotNet Maui 8.0.
The solution have multiple tables and we store encrypted data in the Mobile Application build for Android and iOS.
Lately it was requested that we add functionality for the User to be able to change the database encryption key.
This is when I noted that does not matter what key you pass into the database for login, it will always came back with the database as read ready.

I would have suspected as per normal that if a wrong key for the database login is provided an access or Security exception should be thrown. But NOT. Can you please have a look at this as a matter of urgency.

Currently on Visual Studio Community version 17.11.5 Example as per your github site or per above link. The original .pcl nuget was replaced with the .sqlcipher.

If you can create a database with key A and next login into it with a different key B then you hit the bug.

PS; In other native Android Java/Kotlin and iOS Swift in different projects the sql-ciper works flawless.

Kind regards
Heinrich

@sjlombardo
Copy link
Contributor

@SC-HeinrichG - Unfortunately it's very likely that your database is not actually encrypted. To see if SQLCipher is even being used at runtime, execute the query PRAGMA cipher_version; and retrieve the result set. If SQLCipher is being used it will return a value with the library version number. If there is no result set returned you're using standard SQLite and the database is unencrypted.

@SC-HeinrichG
Copy link
Author

SC-HeinrichG commented Oct 30, 2024 via email

@sjlombardo
Copy link
Contributor

Hello @SC-HeinrichG I'm not aware of any specific, up-to-date tutorials for this particular package. It seems like there could be some problem with your application setup or these nuget packages. Perhaps some other community members may chime in with other suggestions.

For reference only, if you're using SQLCipher commercially, compatible commercially supported packages are available directly from the SQLCipher site.

@SC-HeinrichG
Copy link
Author

SC-HeinrichG commented Oct 31, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants