Made encryption test static and fixed the encryption docs

This commit is contained in:
Jorrit Wronski 2016-12-23 13:52:59 +01:00
parent 02f8fe19c0
commit 823828fc9e
2 changed files with 7 additions and 8 deletions

View File

@ -373,10 +373,8 @@ public:
* @brief Set the key for the current sqlite database instance.
*
* This is the equivalent of the sqlite3_key call and should thus be called
* directly after opening the database. If the database is unencrypted,
* this methods encrypts it immediately.
* Normal database -> call db.key("secret") -> encrypted database, database ready
* Encrypted database -> call db.key("secret") -> database ready
* directly after opening the database.
* Open encrypted database -> call db.key("secret") -> database ready
*
* @param[in] aKey Key to decode/encode the database
*
@ -390,8 +388,9 @@ public:
* This is the equivalent of the sqlite3_rekey call and should thus be called
* after the database has been opened with a valid key. To decrypt a
* database, call this method with an empty string.
* Encrypted database -> call db.key("secret") -> call db.rekey("newsecret") -> change key, database ready
* Encrypted database -> call db.key("secret") -> call db.rekey("") -> decrypted database, database ready
* Open normal database -> call db.rekey("secret") -> encrypted database, database ready
* Open encrypted database -> call db.key("secret") -> call db.rekey("newsecret") -> change key, database ready
* Open encrypted database -> call db.key("secret") -> call db.rekey("") -> decrypted database, database ready
*
* @param[in] aNewKey New key to encode the database
*
@ -413,7 +412,7 @@ public:
*
* @throw SQLite::Exception in case of error
*/
const bool isUnencrypted(const std::string& aFilename) const;
static const bool isUnencrypted(const std::string& aFilename);
private:
/// @{ Database must be non-copyable

View File

@ -264,7 +264,7 @@ void Database::rekey(const std::string& aNewKey) const
}
//Test if a file contains an unencrypted database.
const bool Database::isUnencrypted(const std::string& aFilename) const
const bool Database::isUnencrypted(const std::string& aFilename)
{
if (aFilename.length() > 0) {
std::ifstream fileBuffer(aFilename, std::ios::in | std::ios::binary);