Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open pysqlcipher-encrypted dictionary in command-line sqlcipher tool #20

Open
hermanschaaf opened this issue Jun 20, 2015 · 0 comments

Comments

@hermanschaaf
Copy link

I am able to create an encrypted database using pysqlcipher, and open it with pysqlcipher, but somehow I cannot open the same database using the sqlcipher tool installed on Mac OS X by installing sqlcipher. For installation, I followed the steps listed here: #17 (comment)

Test script:

from pysqlcipher import dbapi2 as sqlite
conn = sqlite.connect('test.db')
c = conn.cursor()
c.execute("PRAGMA key='test'")
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()


conn = sqlite.connect('test.db')
c = conn.cursor()
c.execute("PRAGMA key='test'")
c.execute("SELECT * FROM stocks;")
print(c.fetchall())
c.close()

Output:

$ python ciphertest.py
[(u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.14)]

Now, I attempt to open the test.db file using the sqlcipher command-line tool:

$ sqlcipher test.db
SQLCipher version 3.8.8.3 2015-02-25 13:29:11
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA key='test';
sqlite> SELECT * FROM stocks;
Error: file is encrypted or is not a database

Any advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant