I am currently using hibernate-sqlite.
To access dynamically created sqlite databases, this works perfectly. Now I want to secure the sqlite files. After some research I found out the way to go is (AES) encryption. Can anyone explain to me if this is possible using hibernate? And If so, how? If this doesn't work, is there any other solution for securing the data in the files?
You know about SQLite's Encryption Extension, right?
You can use the built-in encryption of the sqlite (System.Data.SQLite). See more details at http://sqlite.phxsoftware.com/forums/t/130.aspx
You can also Use SQLCipher, it's an opensource extension for SQLite that provides transparent 256-bit AES encryption of database files. http://sqlcipher.net
and as you need hibernate
you can use FluentNHibernate, you can use following configuration code:
private ISessionFactory createSessionFactory()
{
return Fluently.Configure()
.Database(SQLiteConfiguration.Standard.UsingFileWithPassword(filename, password))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<DBManager>())
.ExposeConfiguration(this.buildSchema)
.BuildSessionFactory();
}
private void buildSchema(Configuration config)
{
if (filename_not_exists == true)
{
new SchemaExport(config).Create(false, true);
}
}
Method UsingFileWithPassword(filename, password)
encrypts a database file and sets password.
It runs only if the new database file is created. The old one not encrypted fails when is opened with this method.
EDIT :
more options for you
The SEE and SQLiteCrypt require the purchase of a license.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With