mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 17:56:13 -04:00
Made encryption test static and fixed the encryption docs
This commit is contained in:
parent
02f8fe19c0
commit
823828fc9e
@ -373,10 +373,8 @@ public:
|
|||||||
* @brief Set the key for the current sqlite database instance.
|
* @brief Set the key for the current sqlite database instance.
|
||||||
*
|
*
|
||||||
* This is the equivalent of the sqlite3_key call and should thus be called
|
* This is the equivalent of the sqlite3_key call and should thus be called
|
||||||
* directly after opening the database. If the database is unencrypted,
|
* directly after opening the database.
|
||||||
* this methods encrypts it immediately.
|
* Open encrypted database -> call db.key("secret") -> database ready
|
||||||
* Normal database -> call db.key("secret") -> encrypted database, database ready
|
|
||||||
* Encrypted database -> call db.key("secret") -> database ready
|
|
||||||
*
|
*
|
||||||
* @param[in] aKey Key to decode/encode the database
|
* @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
|
* 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
|
* after the database has been opened with a valid key. To decrypt a
|
||||||
* database, call this method with an empty string.
|
* database, call this method with an empty string.
|
||||||
* Encrypted database -> call db.key("secret") -> call db.rekey("newsecret") -> change key, database ready
|
* Open normal database -> call db.rekey("secret") -> encrypted database, database ready
|
||||||
* Encrypted database -> call db.key("secret") -> call db.rekey("") -> decrypted 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
|
* @param[in] aNewKey New key to encode the database
|
||||||
*
|
*
|
||||||
@ -413,7 +412,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @throw SQLite::Exception in case of error
|
* @throw SQLite::Exception in case of error
|
||||||
*/
|
*/
|
||||||
const bool isUnencrypted(const std::string& aFilename) const;
|
static const bool isUnencrypted(const std::string& aFilename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @{ Database must be non-copyable
|
/// @{ Database must be non-copyable
|
||||||
|
@ -264,7 +264,7 @@ void Database::rekey(const std::string& aNewKey) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Test if a file contains an unencrypted database.
|
//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) {
|
if (aFilename.length() > 0) {
|
||||||
std::ifstream fileBuffer(aFilename, std::ios::in | std::ios::binary);
|
std::ifstream fileBuffer(aFilename, std::ios::in | std::ios::binary);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user