Closed NoxFly closed 11 months ago
Sorry about the late response. Not at my workstation these days.
That's an unfortunate side-effect of encryption. The engine itself doesn't know if it's even a database if it can't be decrypted because there's no way to distinct an encrypted database from a random file. I know for a fact that non-legacy SQLCipher leaves some headers unencrypted so the engine knows all the metadata for decrypting it but that's about it. It still wouldn't provide you with a descriptive error. You can observe this same behavior in programs like DB4S (SQLCipher version).
I inform a wrong key, no error will be throw when connecting to the database.
That's because no decryption happens when you run just the PRAGMA
statement. Pages get decrypted when you actually need them, like when running a SELECT
or when you need to make any kind of change to the database.
Executing a request just to test that is not really appropriated.
This is the only way to do it. Just run an inexpensive statement.
Closing the issue since this is expected behavior.
Here a minimal example where script A is run 1 time, then script B is run after script A.
The 2 scripts will run well, and the data will be logged.
But, if in script B, I inform a wrong key, no error will be throw when connecting to the database. Instead, I'll have an error when I'll try to run a request, here the
SELECT
.The logs about the
db
variable are the same in the 2 cases :If "file is not a database", then you should probably put
open
property tofalse
.I've read the all documentation, nothing is mentionned about this.
How have I to do ? Executing a request just to test that is not really apropriated.