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

"panic: file is not a database" #32

Open
MasterGroosha opened this issue Feb 23, 2022 · 0 comments
Open

"panic: file is not a database" #32

MasterGroosha opened this issue Feb 23, 2022 · 0 comments

Comments

@MasterGroosha
Copy link

MasterGroosha commented Feb 23, 2022

Hello and excuse me for a strange question.

I've started maintaining our company's small project written in Go. It uses SQLite3 and your go-sqlcipher, also Gorm v1 and labstack/echo as a simple web server.

I have an old binary build which works this way:

  1. During the first run, the database is ciphered with a random key. 3 subkeys are computed and printed (2 of them are enough to reproduce the key). PRAGMA key ... is issued and application runs fine.
  2. During the other runs, the application opens the database, but since it is encrypted, it justs waits for keys to be put via HTTP request to unseal the DB file.

However, on the second run, I get "panic: file is not a database" error. The easiest way to reproduce this is to use your encrypto example: https://github.com/xeodou/go-sqlcipher/blob/master/_example/encrypto/encrypto.go
Run it once, everything is fine. Run it twice without ?key=123456, you get the error. To skip the error, you need to pass ?key=123456 with db path. However, the app I'm maintaining used to work without this addition.

So my question is: which version of go-sqlcipher should I use to keep the old behavior?

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