Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Background to question:

I am developing an app using MFC that needs embeded database. Initially I started using SQL server compact, but I had issues with creating passworded new database programatically, so I dumped it.

Next, I decided to use SQLite, but discovered it doesn't support passwording, at least not with native C/C++, so I wrote codes to encrypt strings values before writing them into database and codes for decrypting them after reading from database.

Now my concern is that , although the string content of my database cannot be determined anybody with appropriate software can access the database base and see all tables and fields in them and value of integer fields. More disturbing is the belief that such person can follow the design of the software by studying the databases' fields' and tables. In short, I dont want people to access my database again.

On noticing that .NET allows passwording of SQLite database using system.data.sqlite3.dll I decided to quickly learn C++/CLI.

I have seen sample c# codes for passwording, changing passwords and removing passwords; and I believe that with a little effort I can write the C++/CLI equivalent( although I have never written such programs before ).

The goal is to use .NET to password the database, open the database and close the database, while retaining the old native C++ code lines that I have already invested so much time in.

I believe I can rewrite all the database access codes in C++/CLI but that will almost be the same as starting the project all over again.

End of background





According to [^] system.data.sqlite3.dll can be used with C/C++. Please how can these be done.

1. Does it mean that if I replace the Sqlite3.dll developed for C/C++ from [^] with system.data.sqlite3.dll from [^], my c++ code will still run seamlessly.

2. If the answer to above question is YES, if I use system.data.sqlite3.dll, since normal C/C++ #includes header files, how do I include these file with my code.

3. Is it possible for me, using system.data.sqlite3.dl, to use .Net to simply open the data base file, then continue the database access program in normal c++. (Problem is : I have already gone far with this project using natve C/C++.
Posted

1 solution

You can use SQLite for ordinary C++/MFC; see http://www.sqlite.org/c3ref/intro.html[^]. Although you will have to manage the encryption yourself.
 
Share this answer
 
Comments
Gbenbam 6-Mar-15 13:14pm    
That is exactly what I am doing now, but people can still access my databases and see the tables and colunms but cannot decipher the encrypted string content.

For instance, I am still able to access my database using SQLite Analyzer.

Perhaps the right question is, how can I encrypt my database such that it cannot be accessed at all.
Richard MacCutchan 6-Mar-15 13:52pm    
Yes it's a shortcoming of SQLite that it does not support native encryption. I do recall reading somewhere about a version that encrypts everything but cannot recall whether it supports the C/C++ library; Google may find it for you. My choice for a database that requires encryption by password would be one of the Microsoft SQL implementations. I have used SQLCE for this and it works well (although in .NET).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900