-
Is there an equivalent to: sqlcipher_export() Convenience function that can duplicate a database contents to an attached database with different settings. I'm attempting to convert an unencrypted to encrypted DB programmatically. I have everything working but the sqlcipher_export() I used previously avoided all the detailed programming. Thanks for any insights. J |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Yes. The
SQLite3 Multiple Ciphers allows to encrypt a plain unencrypted database in place by using a |
Beta Was this translation helpful? Give feedback.
-
Thanks Ulrich... took a few steps to implement but got it to work. On the other hand the rekey on unencrypted db never seems to work. The SQLcipher website confirms this and indicates that it's necessary to copy the db. Here's a Lazarus code snippet for anyone trying to use "vacuum into" (no error checking tho')
|
Beta Was this translation helpful? Give feedback.
-
This is simply not true. For example, if I enter the following SQL commands in the SQLite shell application (precompiled binaries provided with each release of SQLite3 Multiple Ciphers) for an unencrypted database I get a database file properly encrypted with the latest legacy SQLCipher encryption scheme: PRAGMA cipher='sqlcipher';
PRAGMA legacy=4;
PRAGMA rekey='passphrase'; On opening the encrypted database file the following SQL commands have to be executed: PRAGMA cipher='sqlcipher';
PRAGMA legacy=4;
PRAGMA key='passphrase';
I don't know why Zetetic, the creators of SQLCipher, chose that approach. Actually, the SQLite3 Multiple Ciphers project manages to get away without copying the database file by using a modified vacuum procedure to encrypt/recrypt/decrypt the database file in place. |
Beta Was this translation helpful? Give feedback.
-
Hmmm! my reply did not appear so I'll try again. Ulrich, Now I follow you solutions... everything is A-OK. Thanks, |
Beta Was this translation helpful? Give feedback.
Yes. The
VACUUM INTO
command of SQLite (see VACUUM command documentation) allows to create a copy of a database. By using an URI filename for the target of theVACUUM
command you can specify and configure the cipher scheme via URI parameters.SQLite3 Multiple Ciphers allows to encrypt a plain unencrypted database in place by using a
PRAGMA REKEY
command…