abbat/pdo_sqlcipher

wrong header on unencrypted db

vincentkersten opened this issue · 2 comments

Dear Anton,
Hope this message finds you well!

today I needed the pdo_sqlcipher extension on a new box, so I got your script and made it again.
It works nicely for encrypted databases, but when I created a new unencrypted DB , it refused to open it later on.
After some investigation I found out that the header of the dblite file was wrong.

Originally the first 16 bytes in an unencrypted DB should read:
SQLite format 3

But, when i applied your latest patch, it read:
SQLCipher format
Hence, when i tried to open it later, sqlite and pdo_sqlcipher refused.

Scanning the build.sh script a little, I found that the sed lines have changed and now change the header of the database files as defined in sqlite3.c around line 12870:
DEFINE_SQLITE_HEADER="SQLite format 3" into DEFINE_SQLITE_HEADER="SQLCipher format 3"

Here:
c04d730
you delete all the sed magic and introduce this bug.

the previous version of the build script,
https://github.com/abbat/pdo_sqlcipher/blob/2103275301f0f18f5db6c3e9951b93a807f92f15/build.sh
does not have this problem and patches and works with encrypted and unencrypted databases.

Hope this will help pdo_sqlcipher forward once more,

regards,

Vincent

Would you check it now and reopen bug if problem still exists?

Dar Anton,
looking good here, (I use the "build.sh" file only, so did not check the debian.sh ) also outputs as it should now in the release folder.
The unencrypted works for me like a charm, Thank you very much!

Regards,

Vincent