Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

SqliteForUnity3D with Encryption (C#)

Discussion in 'Assets and Asset Store' started by shrey-malhotra, Mar 7, 2015.

  1. shrey-malhotra

    shrey-malhotra

    Joined:
    Jan 27, 2013
    Posts:
    11
    Sqlite3 for Unity3d with AES encryption

    After trying out alot of sqlite3 libs/plugins (c# ones) for Unity3D, I couldn't find any that supported encryption, was free and was easy to use. However there were some good ones out there that I forked and added encryption support to it.

    Repo
    https://github.com/shreks7/SqliteForUnity3D
    Unity Packages
    https://github.com/shreks7/SqliteForUnity3D/tree/master/UnityPackages
    Asset Store Link (Only for 5.0)
    Coming Soon

    Info
    • SqliteForUnity3D provides sqlite support for Unity3D (5.0 & 4.6 Pro only) with encryption
    • Download project folders to try out the sample scenes Unity 5 | Unity 4.6 Pro
    • Support for x86/x64/Android
    • Plugins folder contains SqliteForUnity3D.dll,libsqlite3.so(for Android),sqlite.dll(both x86/x64) with encryption support
    Shout Out
    @CodeCoding
    @praeclarum
    @rindeal

    SqliteForUnity3D is a fork of https://github.com/codecoding/SQLite4Unity3d by @CodeCoding. A wrapper around the great c# client for sqlite - sqlite-net by @praeclarum

    x86/x64 Encryption The encryption is based on AES similiar to the one used by https://github.com/rindeal/SQLite3-Encryption (Infact you can use sqlite3.dll by @rindeal too).

    Android Encryption For Android I compiled the sqlite3 src with the encryption from @rindeal for both armeabi & x86 platform. I have included the source here.

    Screenshots (Android)





    Example Scene:
    Includes an example scene, to use -
    1. Make sure you change your DB KEY in the "CreateDB" GameObject to whatever you like.
    2. Run the sample in editor. Hit Create Tables to generate tables. (One time only).
    3. Type your password (DB_KEY) and hit submit.
    4. List of levels are generated.

    To rest database-
    1. Delete the game.db from the StreamingAssets folder.
    2. Mark Reset Database in the "CreateDB" Game Object.

    ## The tables are generated by code in the example.

    TODO
    1. To add support for Windows Phone 8.1/8
    2. To test it on iOS
    PS - My first useful Asset Bundle I guess :p. Let me know what you think & feel free to contribute and help me build it on all platforms. This is for those who couldn't find a free SQlite encrypted solution.
     
  2. MDragon

    MDragon

    Joined:
    Dec 26, 2013
    Posts:
    329
    Thanks for sharing this!

    Out of curiosity (and as I'll need to work with iOS soon at the same time), how is iOS support going so far? I know @CodeCoding's repo supports iOS (more or less). Is the encryption the problem with supporting iOS and Windows Phone at the moment?
     
    Zergsbo likes this.
  3. Zergsbo

    Zergsbo

    Joined:
    Mar 21, 2014
    Posts:
    4
    This is awsome, but as MDragon, I'll need to work this out on iOS also. For the iOS version to work are there any other lib required? Like an sqlite + encryption dylib to export on iOS? Thanks for the great work!
     
  4. MDragon

    MDragon

    Joined:
    Dec 26, 2013
    Posts:
    329
    For the iOS version, you may want to read CodeCoding's notes (as I'm assuming this has the same particularities):
    https://github.com/codecoding/SQLite4Unity3d

    I haven't personally tested anything out on iOS specifically (as my team is moving onto something else now), but it seems we'll have to use good ol' fashion SQLite queries for iOS with this library.
     
  5. robertohuertasm

    robertohuertasm

    Joined:
    Aug 29, 2014
    Posts:
    44
    Hi @MDragon , check my latest notes at @Codecoding. I've just uploaded a version with linq support for iOS so hopefully you will be able to write your queries using linq syntax for almost all your queries.

    Best regards,

    Roberto.
     
  6. cristoph21

    cristoph21

    Joined:
    Oct 6, 2014
    Posts:
    2
    You can use now CryptonorDB, it is designed with privacy in mind: it encrypts data using AES or Camellia and is available for most Unity platforms (WindowsPhone, Android and iOS, etc).