python中的加密文件或数据库

2021-12-20 00:00:00 python encryption sqlite

我有一个在 python 中插入/选择的 sqlite3 db.该应用程序运行良好,但我想对其进行调整,以便没有密码就无法从数据库中读取数据.我怎么能在python中做到这一点?请注意,我不知道从哪里开始.

I have a sqlite3 db which i insert/select from in python. The app works great but i want to tweak it so no one can read from the DB without a password. How can i do this in python? note i have no idea where to start.

推荐答案

您可以使用 SQLCipher.

You can use SQLCipher.

http://sqlcipher.net/

SQLite 的开源全数据库加密

Open Source Full Database Encryption for SQLite

SQLCipher 是一个 SQLite 扩展,它为数据库文件提供透明的 256 位 AES 加密.页面在写入磁盘之前被加密,并在读回时被解密.由于占用空间小且性能卓越,因此非常适合保护嵌入式应用程序数据库,也非常适合移动开发.

SQLCipher is an SQLite extension that provides transparent 256-bit AES encryption of database files. Pages are encrypted before being written to disk and are decrypted when read back. Due to the small footprint and great performance it’s ideal for protecting embedded application databases and is well suited for mobile development.

  1. 极快的性能,只需 5-15% 的开销对许多操作进行加密
  2. 数据库文件中的数据 100% 已加密 使用良好的安全性实践(CBC 模式,密钥派生)
  3. 零配置和应用级密码学广泛的平台
  4. 支持:适用于 C/C++、Obj-C、QT、Win32/.NET、Java、Python、Windows、Linux、iPhone/iOS 上的 Ruby 等……

相关文章