Coder Social home page Coder Social logo

Comments (6)

NathanaelA avatar NathanaelA commented on June 11, 2024
  1. This plugin supports both encryption and decryption.
  2. You can already use PRAGMA key='...'

from nativescript-sqlite.

kaustavlahiri avatar kaustavlahiri commented on June 11, 2024

PRAGMA key ='somekey' to set encryption on a non encrypted database does not work. If a database is already encrypted, I could decrypt with options:key and then add a new key with PRAGMA rekey = '';
Also the release notes specify:
"Please note the database itself MUST be created with encryption to use encryption. So if you create a plain database, you can not retroactively add encryption to it".

Thats the reason I was wondering if I could make this plugin use my paid SEE extension (sqlite3.c)

from nativescript-sqlite.

NathanaelA avatar NathanaelA commented on June 11, 2024

Yes, you have to create a new database with encryption (which you can do with a create database command or ship a encrypted db). You are correct it won't encrypt a un-encrypted database, however you can work around by just create a new database and copy all data from the old database and then delete the old un-encrypted version.

However, for security; if you are wanting to have encrypted db's it is better to start with a encrypted database rather than a unencrypted database.

from nativescript-sqlite.

kaustavlahiri avatar kaustavlahiri commented on June 11, 2024

Thanks for confirming.
What you are saying, is indeed one of my options: Ship an encrypted database with the app to begin with --> decrypt with your plugin --> rekey as needed.

I would have to explore the other approach you suggested aka create a new encrypted database and then copy over stuff from the old unencrypted one. Although, I don't want to put all this script in the app code. So most likely I won't go with this option. Still its good to know that your plugin can create a new db with encryption turned on.

Finally, just out of continued curiosity, is it possible to make use of a custom sqlite3 library in your plugin? The module.modulemap under platform/ios seems to specify the library. I was wondering if I could do something there to pick up my custom sqlite3.c?

from nativescript-sqlite.

NathanaelA avatar NathanaelA commented on June 11, 2024

Well, we could build you a custom version with your sqlite3.c file; it is basically just building a new aar (on android) and framework on ios to be linked in and using them as the native part. The rest of the code base (like the JS) would work with no other changes; so it is really just creating new native libraries using he SEE version of sqlite instead of SqlCipher.

from nativescript-sqlite.

kaustavlahiri avatar kaustavlahiri commented on June 11, 2024

Got it. Thats exactly what I was looking for. Infact, we have got around this use case by using open source SqlCipher to initially encrypt the database during the build phase and then use your paid plugin to decrypt and rekey as needed. So I am good now. Its still good to know that you can package a custom sqlite version, if needed. Thank you!

from nativescript-sqlite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.