Core Data Encryption Class - ios

I'm trying to use this wonderful git inside my xcode project:
https://github.com/project-imas/encrypted-core-data
It's fully functional when creating a new empty sqlite db.
But, how can I use an existing populated regular database?
I need to encrypt my sqlite file and use with the class provided from the git.
Thanks to all!

You need to use the SQLCipher convenience function sqlcipher_export. In particular, look at example number 1 for a plaintext migration.

Related

How to initialize a Realm DB

I want my app to ship out with a pre-initialized DB.
In SQL, I would create a DB, do the necessary inserts, pg_dump to a file, and load from that file. I'm sure Realm has an equivalent method, but I'm not sure what it is and I couldn't find it in the documentation.
(Disclaimer: I work for Realm)
There's no pg_dump-like functionality in Realm, but you can distribute a pre-built Realm file along with your app and that'll work just fine. :)
At the moment, the best way to create a pre-made Realm file is to simply make a small sample app to generate and then populate the file, but we're working on adding that functionality to Realm Browser as well.

How can I encrypt one exist sqlite db in iOS Project with sqlcipher?

How can I encrypt one exist sqlite db in iOS Project with sqlcipher?SQLCipher give an method to use command line to encrypt,But no Objective-c API。
Check out this encrypted-core-data. It integrates SQL cipher and core data and work quite well. You can use command line to encrypt the db and then load it using NSIncrementalStore.

How to use Sqlite for Xamarin.Android

I am new to Sqlite. This what I understand so far.
Please help to confirm my understanding.
1) Sqlite engine is built into the Android-OS System
so, I dont need to download and install this Sqlite engine from its website.
Now, I have these questions :
2) If I include a Sqlite Database( With data in it) in the Project, Do I need to read ( use memorystream to read into a buffer, this is based on WP on SlqCe ) it INTO the folder or directory under the Sqlite engine?
3) Is there any tutorial on Create table, Add, Insert, update for Sqlite, setUp relationship
4) Is referential integrity supported? Like If I delete the Primary Key , all the Foreign Key will be deleted as well.
Thanks
One application which has helped me greatly in building SQLite Databases is this
SQLite Expert, http://www.sqliteexpert.com/ which is a standalone piece of sofware with a GUI which you can design the databases with and then produce the SQL code to produce the database.
The thing about setting up a Database is you need to create a class from the Android.Database.Sqlite.SQLiteOpenHelper object and override the OnCreate(SQLiteDatabase db) and OnUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) methods. It is then up to you to write your insert methods and so forth.
Good Luck,
James.
Refer this sample project : https://github.com/Vaikesh/Android-Quiz
I think you ca enforce referential integrity in SQLite with Triggers.
Tutorial on about SQLite : http://www.grokkingandroid.com/sqlite-in-android/

What is the appropriate extention for creating database in iOS?

I am creating a database application using the SQLite3 library.
I have created a database file using each of the file extensions: .db, .sqlite, and .sql.
All are working fine for me, but my question is which extension should I use in general?
Is there any difference between these file extentions?
The Sqlite documentation seems to use the '.db' extension consistently, but I've seen plenty of Sqlite files that use '.sqlite' instead. Use whatever is meaningful to you. For example, if you're using Core Data to create the database, you might use '.cd' or .'coredata' to remind yourself not to modify the database outside of Core Data. Unless you're planning to transfer the file to some other machine (and really, even then) it won't matter.
The database will live in your application's sandbox, so users will never have to know about the filename or the extension, and other applications typically won't ever see it either. Just give it a distinct name so you can tell it apart from other files that your app might be saving to the same location.

Reverse-engineering Core Data db results in "Can't find model for source store" error

I have the task to re-engineer an iPhone app which makes use of Core Data to store some values. Unfortunately I do not have access to the original source code but I do have acces to old database files, copied directly from the device where the old version of the app is installed.
I have to create a new version of the app with some new functionality and I am trying to import the data from the Sqlite Db and migrate it to a new version.
I am already failing at the task to read the data from the old database. Though I can open the Sqlite file and such was able to exactly reproduce the data structure in my own datamodel, everytime I try to read the data, it fails with a
Can't find model for source store
error.
Ignoring the old data is not an option because there is important data stored there.
I googled for solutions and tried every recommended solution related to migrating data but it all fails. Maybe I can not use the Sqlite created by another app? Or so I overlook something in re-engineering the structure of the datamodel even when I used exactly the some field names and datatypes? Is there another way around this?
I could not solve the issue but I found a workaround. By using Sqlite directly, I was able to query the legacy data and import it into my newly created data model. A good starter point for using Sqlite is here:
http://www.techotopia.com/index.php/IOS_4_iPhone_Database_Implementation_using_SQLite

Resources