This article specifically describes how to extend the encryption portion of the SQLite database that is currently becoming more and more prevalent, SQLite is "an Embedded SQL database without any configuration deployment." The following is the directory for this article:
• background
• Technical specification of this extension module
• Installation and use
• download
• Warning and copyright restrictions
• Acknowledgement
• Relevant legal instructions
Background
Why should I write this extension? To meet some of my own crazy ideas.:) Okay, no kidding. Not long ago I wanted to write a program to store some personal information (a project of my own). I don't want to use those big open source databases, such as MySQL, because they are really too big to take up a lot of space and have to be deployed separately. And then I found SQLite, It is very small and very fast, and its API function is very simple, in my C + + program can be very convenient to use. There is a problem, presumably because it has to be kept simple so it does not support any authentication and encryption. It makes me feel insecure.
So I started looking for SQLite encryption solutions. I've found two, but they're all commercial software. SQLite's author, Mr. D.richard Hipp, provides a reinforced version of the database file that can be fully encrypted sqlite. That's the business software called Sqlcrypt (tm). It realizes the transparent encryption of the data storage layer. Unfortunately they are too expensive for us ordinary people, especially for my non-commercial purpose just to use SQLite to develop some small applications to play with. But I do need to encrypt the database- Transparent encryption of the entire database file at the database level. All developers and users simply need to provide a password when they open the database. And then the next thing is all over to the database to do. This approach will be much easier and more convenient than the encryption on data and fields. Otherwise, the fields you need to encrypt are designed as blobs or string types.
After I searched the sqlite mailing list and searched Google for a free sqlite plugin or extension, I found that it didn't meet my needs, so I decided to write one myself. I've been inspired by some of the API interfaces reserved by the SQLite author to support database encryption and decryption, And I found that someone actually wrote a SQLite encryption library (SQLCRYPT). I spent a few days researching some cryptographic algorithms, I'm going to pick one that uses (the AES (Rijndael) block cipher, and the other is how to generate a password, The most important thing, of course, is how I can embed the code I used to complete the encryption and decryption database into the core of SQLite.