in

System.Data.SQLite

An open-source, enhanced version of the SQLite database engine for Windows

Encrypting database

Last post 03-26-2008 1:40 PM by Nate. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-26-2008 9:00 AM

    Encrypting database

    Hello!

    I am creating a new project using SQLlite for the first time..

    I have the necessity to encrypt the database but I can't figure out how to manage it.

    I saw in the forum that sqllite uses RC4 encryption but encrypting the database file and providing password in the connection string it doen't work.

    Is there a way how to do it? thanks in advance.

    Regards, Giuseppe

  • 03-26-2008 10:00 AM In reply to

    • Nate
    • Top 10 Contributor
    • Joined on 08-28-2005
    • Fort Collins, CO
    • Posts 65

    Re: Encrypting database

     http://sqlite.phxsoftware.com/forums/t/130.aspx

  • 03-26-2008 10:11 AM In reply to

    Re: Encrypting database

    Hi Nate,

    I had a look in that post but it is not exactly what I was asking for.

    I created the DB, I connected and then ecrypted using RC4.

    When I set the password in the connection string  SQLite throws an error like "not a database"....

     

  • 03-26-2008 1:40 PM In reply to

    • Nate
    • Top 10 Contributor
    • Joined on 08-28-2005
    • Fort Collins, CO
    • Posts 65

    Re: Encrypting database

    I do something like this (because sometimes the database is encrypted, and other times not).

    private static void Open()
    {
        try
        {
            m_connection.Open();
        }
        catch (SQLiteException ex)
        {
            if (ex.ErrorCode == SQLiteErrorCode.NotADatabase)
            {
                m_connection.SetPassword("your password");
                Open();
            }
            else
            {
                throw;
            }
        }
    }

     

    Does this help?

Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems