Hi all,
I finalised Jam changes to use encrypted sqlite database. It is actually very simple, copy sqlite.py into ie. sqlcipher.py file and modify sqlcipher.py with this:
import os
import sys
from sqlcipher3 import dbapi2 as sqlcipher
DATABASE = 'SQLCHIPER'
NEED_DATABASE_NAME = True
NEED_LOGIN = False
NEED_PASSWORD = True
.
.
def connect(database, user, password, host, port, encoding, server):
connection = sqlcipher.connect(database)
connection.create_function("UPPER", 1, sqlite_upper)
cursor = connection.cursor()
cursor.execute('PRAGMA key= %s' % password)
cursor.execute("PRAGMA foreign_keys = ON")
return connection
.
.
testing is the encryption key, which is the DB password.
Now, modify db_modules.py with:
SQLITE, FIREBIRD, POSTGRESQL, MYSQL, ORACLE, MSSQL, SQLCIPHER = range(1, 8)
DB_TYPE = ('Sqlite', 'FireBird', 'PostgreSQL', 'MySQL', 'Oracle', 'MSSQL', 'SQLCIPHER')
def get_db_module(db_type):
db = None
if db_type == SQLITE:
import jam.db.sqlite as db
elif db_type == POSTGRESQL:
import jam.db.postgres as db
elif db_type == MYSQL:
import jam.db.mysql as db
elif db_type == FIREBIRD:
import jam.db.firebird as db
elif db_type == ORACLE:
import jam.db.oracle as db
elif db_type == MSSQL:
import jam.db.mssql as db
elif db_type == SQLCIPHER:
import jam.db.sqlcipher as db
return db
That is IT. No other changes are needed except installing the library with:
pip install sqlcipher3-binary
Here it the Jam with simple Demo (pls note "DB Manual mode", it is more customised Jam). Just install above with pip and run with" python server.py in the unzipped folder:
Meaning one can completely protect the intellectual property and data.
Plus, it is absolutely possible to encrypt the current data:
Enjoy