Results 1 to 5 of 5

Thread: SQLite database and password protection?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    487

    SQLite database and password protection?

    Is is possible to encrypt (password protect) an SQLite database? If so, can someone please point me in the right direction?

    I have installed the "System.Data.SQLite.Core" NuGet package (v1.0.114.3) and have a working application that uses an SQLite database.

    My research has been fruitless. I have seen mentions of "extensions" that can do this, but I am clueless as to how to use one.

    The following link looked promising, but I couldn't get it working with my application.

    https://stackoverflow.com/questions/...is-it-possible

    Here's my code (as per the above link)...

    Code:
    conString = String.Format(conString, appDB)
    con = New SQLiteConnection(conString)
    con.SetPassword("myPassword")
    con.Open()
    The SQLiteConnection.SetPassword method fails (the error details are below).

    HTML Code:
    Date:  8/21/2021 3:51:06 PM
    Exception:  System.IO.FileNotFoundException (err = 53)
    Message:  Could not load file or assembly 'System.Data.SQLite.SEE.License, Version=1.0.114.0, Culture=neutral, PublicKeyToken=433d9874d0bb98c5' or one of its dependencies. The system cannot find the file specified.
    Class:  RuntimeAssembly
    Procedure:  _nLoad
    File =  (line #0)
    The code complies and runs successfully when the SQLiteConnection.SetPassword method call is removed.

    The following link states that the "Password" connection string property is completely non-functional since release 1.0.113.0 due to changes in the underlying core library architecture:

    https://sqlite.org/forum/forumpost/d108466c39

    This following link from Microsoft states that "SQLite doesn't support encrypting database files".

    https://docs.microsoft.com/en-us/dot...bs=netcore-cli

    It would be great to see a tutorial or working example for how to use a password with an SQLite database...
    Last edited by Mark@SF; Aug 22nd, 2021 at 06:12 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: SQLite database and password protection?

    Not really a SQLite user myself but this package seems to apply to the SEE mentioned in the second page you linked to.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2013
    Location
    San Francisco, CA
    Posts
    487

    Re: SQLite database and password protection?

    jmc -

    Thanks for weighing in on this topic.

    I installed the package you referred to and now when the SQLiteConnection.SetPassword is called, the following error is raised.

    HTML Code:
    Date:  8/22/2021 10:06:58 AM
    Exception:  System.NotSupportedException (err = 13)
    Message:  {plugin file is not strong name signed or cannot be verified} {}
    Class:  SQLiteExtra
    Procedure:  InnerVerify
    File =  (line #0)
    And also, the following website is opened, stating that a license is required ($2,000 USD).

    https://www.sqlite.org/purchase/see?...ed%7D%20%7B%7D

    I'm not sure that SQLite is a viable option for me if I need to password protect my database.

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,872

    Re: SQLite database and password protection?


  5. #5
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: SQLite database and password protection?

    I'm not a .NET-ter, but...
    there is a difference between Encryption and User-Authentication.

    1) If you want User-Authentication (like you're used from MySQL or others), you have to compile the SQLite engine yourself with activated "USER_AUTHENTICATION"-Option --> https://www.sqlite.org/src/doc/trunk.../user-auth.txt

    2) AFAIK, Schmidt has SQLite-Encryption in his RC5/RC6 vbRichClient, but that one is for VB6 not NET. Maybe he would know how to apply encryption to .NET
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width