In the fix for #218 (released with 2.2.5) the previously incorrect handling of SQLiteCipher key schemes was rectified.
However it leaves databases created during the time where this bug existed inaccessible if the SQLiteCipher key scheme was used.
I have attempted to provide the key to SQLite3MC via the various interfaces but all of them end up in GenerateKey*Cipher, where sqlite3mcExtractRawKey unconditionally, making it impossible to use strings of the form x'.....' as a passphrase instead of it being treated as raw key.
While I agree that the bug had to be fixed for the existing interfaces, there has to be a way to explicitly make use of the previous behavior to access databases created with versions prior to 2.2.5.
If such an interface already exists, I apologize. I have attempted:
- Pass passphrase to
PRAGMA key, as 'x''...''' (quoted ')
-> SQLite decodes the string correctly, sqlite3mcExtractRawKey extracts the key and sets bypass = 1
- Pass passphrase in hex encoding to
PRAGMA hexkey
-> The hex encoded string is decoded, sqlite3mcExtractRawKey extracts the key and sets bypass = 1
- Pass passphrase to
sqlite3_key.
-> Same as above.
As far as I have seen in the code, there is no way to avoid sqlite3mcExtractRawKey being called.
Unfortunately it's not possible to bypass this issue by running the KDF on the passphrase myself, as the salt is part of the db itself (default behavior). I could parse the database header to get it but this does not seem like a reasonable path forward to me.
I think a good way to solve this issue would be to provide a way to specify a passphrase without any kind of special string parsing / interpretation (either via a new pragma to provide the passphrase to or a pragma / option to disable sqlite3mcExtractRawKey).
I'm sorry to bring this up and I am well aware it can be annoying having to provide these kind of workarounds to keep compatibility with previously erroneous behavior but I need to access old databases with new versions of SQLite3(MC). Patching in the bug again is an option for the time being but I'd prefer there being a proper solution eventually.
Thank you for your work and best regards
In the fix for #218 (released with 2.2.5) the previously incorrect handling of SQLiteCipher key schemes was rectified.
However it leaves databases created during the time where this bug existed inaccessible if the SQLiteCipher key scheme was used.
I have attempted to provide the key to SQLite3MC via the various interfaces but all of them end up in
GenerateKey*Cipher, wheresqlite3mcExtractRawKeyunconditionally, making it impossible to use strings of the formx'.....'as a passphrase instead of it being treated as raw key.While I agree that the bug had to be fixed for the existing interfaces, there has to be a way to explicitly make use of the previous behavior to access databases created with versions prior to 2.2.5.
If such an interface already exists, I apologize. I have attempted:
PRAGMA key, as'x''...'''(quoted')-> SQLite decodes the string correctly,
sqlite3mcExtractRawKeyextracts the key and setsbypass = 1PRAGMA hexkey-> The hex encoded string is decoded,
sqlite3mcExtractRawKeyextracts the key and setsbypass = 1sqlite3_key.-> Same as above.
As far as I have seen in the code, there is no way to avoid
sqlite3mcExtractRawKeybeing called.Unfortunately it's not possible to bypass this issue by running the KDF on the passphrase myself, as the salt is part of the db itself (default behavior). I could parse the database header to get it but this does not seem like a reasonable path forward to me.
I think a good way to solve this issue would be to provide a way to specify a passphrase without any kind of special string parsing / interpretation (either via a new pragma to provide the passphrase to or a pragma / option to disable
sqlite3mcExtractRawKey).I'm sorry to bring this up and I am well aware it can be annoying having to provide these kind of workarounds to keep compatibility with previously erroneous behavior but I need to access old databases with new versions of SQLite3(MC). Patching in the bug again is an option for the time being but I'd prefer there being a proper solution eventually.
Thank you for your work and best regards