This Solution Will Work on Linux OS Only
Install sqlcipher:
sudo apt-get install sqlcipher
Install sqlcipher package:
pip install pysqlcipher3
Sample Code:
from pysqlcipher3 import dbapi2 as sqlite
conn = sqlite.connect('test.db')
c = conn.cursor()
c.execute("PRAGMA key='password'")
c.execute("PRAGMA cipher_compatibility = 3")
c.execute('''create table stocks (date text, trans text, symbol text, qty real, price real)''')
c.execute("""insert into stocks values ('2006-01-05','BUY','RHAT',100,35.14)""")
conn.commit()
c.close()
For Windows You Can Follow Below Links:
- Install pysqlcipher3 windows
- Compile SQLite with SQLCipher on Windows