When you modify some data in the database: you need to encrypt the whole file or just what was modified. #98
Replies: 1 comment 1 reply
-
SQLite reads and writes database pages of a fixed size to and from a database file. Encryption/Decryption happens pagewise. The default size of a database page is 4k bytes, but that can be changed (maximum 64k). When a new data row is added and committed to a database, SQLite will write the data to disk, and this may affect 1 or more database pages, depending on the total size of data of the new row. Only new or modified database pages will be encrypted. The
This applies to the rekey operation. The SQLCipher product supports In contrast, SQLite3 Multiple Ciphers supports However, just as the
Of course, encryption incurs some overhead. How much overhead, depends on the selected cipher and its implementation. Compared to the actual reading or writing to or from disk the encryption/decryption should usually be almost neglectable. However, opening a database can be expensive due to the key derivation process. That is, frequently opening and closing should be avoided for encrypted databases.
New data are encrypted and written, as soon as a |
Beta Was this translation helpful? Give feedback.
-
Hi, I did an application using SQLite3 Multiple Ciphers. This application essentially works in this way:
First, with my Linux script I execute this:
After, I run my C program and I am using sqlite3_key to decrypt my encrypt database.
However, I receive a question about my application that I am not understanding very well:
"Have you made any benchmark of the encrypted database on the target? I could not understand if when adding a new row to the table, if it needs to encrypt the complete file or if it would just encrypt the new row until VACCUM is called."
In the discussion (#72) I found in the answer this:
"Actually, the SQLite3 Multiple Ciphers project manages to get away without copying the database file by using a modified vacuum procedure to encrypt/recrypt/decrypt the database file in place."
Base on this response, then:
Beta Was this translation helpful? Give feedback.
All reactions