mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 19:11:39 -06:00
cipher: Fix attaching unencrypted DB if main is encrypted and vice-versa
When attaching another database, SQLCipher assumes that it shares passphrase and salt with the main database. Usually this isn't the case, though. With this commit SQLiteBrowser tries to open the database to attach before actually attaching it and asks for encryption details if needed. This allows the user to attach unencrypted databases to an encrypted master database and vice-versa. Note though, that attaching an encrypted database with a non-default (i.e. <> 1024) cipher page size doesn't seem to work - this however, is apparently a SQLCipher limitation. See issue #174.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <QMultiMap>
|
||||
#include <QByteArray>
|
||||
|
||||
class CipherDialog;
|
||||
class sqlite3;
|
||||
|
||||
enum
|
||||
@@ -45,6 +46,7 @@ public:
|
||||
explicit DBBrowserDB () : _db( 0 ) {}
|
||||
virtual ~DBBrowserDB (){}
|
||||
bool open ( const QString & db);
|
||||
bool attach(const QString& filename, QString attach_as = "");
|
||||
bool create ( const QString & db);
|
||||
bool close();
|
||||
bool setRestorePoint(const QString& pointname = "RESTOREPOINT");
|
||||
@@ -130,6 +132,8 @@ private:
|
||||
QStringList savepointList;
|
||||
|
||||
bool isEncrypted;
|
||||
|
||||
bool tryEncryptionSettings(const QString& filename, bool* encrypted, CipherDialog*& cipherSettings);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user