Accessing an encrypted SQLite3 database in Python (I have the Key)

1.9k views Asked by At

I apologize if its redundant but I couldn't seem to find answer anywhere. I set up a password(encryption key) for my database using DB browser for SQLite3. It uses sqlcipher. Now I cannot access it. I'm not able to provide password\key. Here's my code:

import sqlite3
from Data.Item import item
import sys


conn = sqlite3.connect('maindb.db')
c = conn.cursor()
c.execute("PRAGMA KEY = 'password'")

def items():
      c.execute("SELECT * FROM Item")
      data=c.fetchall()

details=items()

My platform is Windows. I've tried pysqlcipher, It does not gets installed throws an error. How do I proceed from here? What should I do? My goal is to make my database file unreadable for some obvious reasons.

I get the following error: c.execute("SELECT * FROM Item") sqlite3.DatabaseError: file is encrypted or is not a database

0

There are 0 answers