class=”markdown_views prism-dracula”>
Article directory
sqlite database encryption
There are two ways to encrypt the database:
-
Encrypt the content and then write it into the database: This method is simple to use. You only need to perform corresponding encryption and decryption operations on the fields when entering/exiting the database, which solves the problem of nakedly exposing the data to a certain extent. question. However, this method is not completely encrypted, because information such as the table structure of the database can still be viewed. In addition, after the content written to the database is encrypted, searching is also a problem.
-
Encrypt the database file: Encrypt the entire file of the entire database. This method can basically solve the information security problem of the database. The existing SQLite encryption is basically implemented in this way.
QtCipherSqlitePlugin plugin encrypts sqlite database
QtCipherSqlitePlugin-GITHUB address
devbean compiles the QtCipherSqlitePlugin plugin
The downloaded file contains the source file compiled by QtCipherSqlitePlugin and the test program file
sqlitecipher: the source code folder of the plug-in compiled library file
test: the test program folder
Compile
- Enter the downloaded folder and use Qt Creator to build the source file (be careful not to run it, because the library file is generated directly)
- After compiling, the sqlitecipher.dll and sqlitecipherd.dll files are generated, corresponding to the libraries under the debug and release versions respectively;
- Copy the dynamic library file to the Qt plugin directory plugins/sqldrivers
use