开发者

Encrypting a Sqlite db file that will be bundled in a pyexe file

开发者 https://www.devze.com 2023-01-18 18:13 出处:网络
I have been working on developing this analytical tool to help interpret and analyze a database that is bundled within the package. It is very important for us to secure the database in a way that can

I have been working on developing this analytical tool to help interpret and analyze a database that is bundled within the package. It is very important for us to secure the database in a way that can only be accessed with our software. What is the best way of achieving it in Python?

I am aware that there may not be a definitive solution, but deterrence is what really matters here.

Thank 开发者_如何学Cyou very much.


Someone has gotten Python and SQLCipher working together by rebuilding SQLCipher as a DLL and replacing Python's sqlite3.dll here.


This question comes up on the SQLite users mailing list about once a month.

No matter how much encryption etc you do, if the database is on the client machine then the key to decrypt will also be on the machine at some point. An attacker will be able to get that key since it is their machine.

A better way of looking at this is in terms of money - how much would a bad guy need to spend in order to get the data. This will generally be a few hundred dollars at most. And all it takes is any one person to get the key and they can then publish the database for everyone.

So either go for a web service as mentioned by Donal or just spend a few minutes obfuscating the database. For example if you use APSW then you can write a VFS in a few lines that XORs the database content so regular SQLite will not open it, nor will a file viewer show the normal SQLite header. (There is example code in APSW showing how to do this.)

Consequently anyone who does have the database content had to knowingly do so.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号