Browse Source

fix(db): use SQLCipher 3.x crypto even with SQLCipher 4.x

Fix #5451
reviewable/pr5456/r1
Anthony Bilinski 7 years ago
parent
commit
e80dbe2d83
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 9
      src/persistence/db/rawdatabase.cpp

9
src/persistence/db/rawdatabase.cpp

@ -181,6 +181,15 @@ bool RawDatabase::open(const QString& path, const QString& hexKey) @@ -181,6 +181,15 @@ bool RawDatabase::open(const QString& path, const QString& hexKey)
return false;
}
// #5451 SQLCipher 4.x has new crypto defaults that won't work with DBs saved with 3.x.
// manually use existing 3.x defaults for now, until SQLCipher upgrade is functional.
if (!execNow("PRAGMA cipher_page_size = 1024; PRAGMA kdf_iter = 64000;"
" PRAGMA cipher_hmac_algorithm = HMAC_SHA1; PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA1;")) {
qWarning() << "Failed to prepare SQLCipher for version 3.x";
close();
return false;
}
if (!execNow("SELECT count(*) FROM sqlite_master")) {
qWarning() << "Database is unusable, check that the password is correct";
close();

Loading…
Cancel
Save