From e50c44740f47c7f976a5bbf1ba1170b96f845948 Mon Sep 17 00:00:00 2001 From: Jens Alfke Date: Wed, 10 Jul 2024 17:28:50 -0700 Subject: [PATCH] Changed use_encryption_key to use_password because SQLCipher interprets it as one, i.e. it uses key derivation --- include/sqnice/database.hh | 8 ++++---- src/database.cc | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/sqnice/database.hh b/include/sqnice/database.hh index f646fef..09acfe3 100644 --- a/include/sqnice/database.hh +++ b/include/sqnice/database.hh @@ -442,20 +442,20 @@ namespace sqnice { static const bool encryption_available; /// Unlocks an encrypted database, or makes a newly-created database encrypted, - /// by providing the key to use to encrypt/decrypt data. + /// by providing the password to use to encrypt/decrypt data. /// /// This should be called immediately after opening the database, since no data can be /// read from an encrypted database without the key, and encryption can't be enabled in /// a new database once data has been written to it. /// @note This function requires SQLCipher or the SQLite Encryption Extension. /// Otherwise it returns/throws status::error. - status use_encryption_key(std::span key); + status use_password(std::string_view password); - /// Changes the encryption key of an already-encrypted database. + /// Changes the encryption password of an already-encrypted database. /// Will not encrypt an existing unencrypted database! /// @note This function requires SQLCipher or the SQLite Encryption Extension. /// Otherwise it returns/throws status::error. - status rekey(std::span newKey); + status rekey(std::string_view newPassword); #pragma mark - LOGGING diff --git a/src/database.cc b/src/database.cc index 1dcbb7a..5c186e0 100644 --- a/src/database.cc +++ b/src/database.cc @@ -585,12 +585,12 @@ namespace sqnice { const bool database::encryption_available = true; - status database::use_encryption_key(std::span key) { - return check(sqlite3_key(check_handle(), key.data(), int(key.size()))); + status database::use_password(std::string_view password) { + return check(sqlite3_key(check_handle(), password.data(), int(password.size()))); } - status database::rekey(std::span newKey) { - return check(sqlite3_rekey(check_handle(), newKey.data(), int(newKey.size()))); + status database::rekey(std::string_view newPassword) { + return check(sqlite3_rekey(check_handle(), newPassword.data(), int(newPassword.size()))); } #else