加密数据库 [英] Encrypting a database

查看:82
本文介绍了加密数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是关于编码的问题,而是关于方法论的问题。


我需要加密数据库。正在使用的数据库不包含任何加密功能,如TDE for SQL Server。因此,我制定了一种方法来进行对称加密和密钥存储等。


我的问题是我应该使用哪种方法来加密/解密和执行SQL语句。


我想加密数据库,然后在需要针对数据运行SQL语句时对其进行解密。在我执行SQL语句并获得我的返回集之后,我可以再次加密它。


我发现这个方法有问题,因为当数据库处于解密状态时,所有数据都在明文。如果系统在执行SQL语句时崩溃,数据库将保持明文状态,直到我再次加密它为止。这是不可接受的。


我不确定对数据库加密/解密和执行SQL语句的正确方法是什么。


任何想法或建议......特别是任何以前尝试过这种想法的人。


*****

新想法

我考虑过只加密和解密数据而不是数据库文件,但我不确定如果我有一个数据类型为DATE的列会发生什么。加密日期之后我会假设它不再像日期一样,系统如何在日期列中接受它?

谢谢....

This is NOT a question regarding coding, it is a question concerning methodology.

I need to encrypt a database. The database being used does not contain any encryption abilities like TDE for SQL Server. I have therefore worked out a method to do symetric encryption and key storage etc.

My question is which method should I use for the encryption/decryption and executing SQL statements.

I am thinking to encrypt the database and then decrypt it when I need to run an SQL statement against the data. After I execute the SQL statement and get my return set I can encrypt it again.

I see a problem with this method as when the database is in the decrypted state all the data is in clear text. If the system crashed when the SQL statement is being executed the database would be left in a clear text state until I could encrypt it again. This is not acceptable.

I am not sure what the proper method would be to encrypt/decrypt and execute SQL statements against the database.

Any ideas or suggestions.. especially from anyone who has attempted this before.

*****
New thought

I have thought about encrypting and decrypting just the data rather than the database file but am unsure what would happen if for instance I had a column with a data type of DATE. After I encrypt the date it would I assume no longer look like a date and how would the system accept it in a date column?
Thanks....

推荐答案

你知道ACCDB数据库是加密的吗?如果你给他们一个数据库密码?
Are you aware that ACCDB databases are encrypted if you give them a database password?


嘿NEO,


长时间...我没有使用MS Access数据库。这是我正在研究的宠物项目。我正在使用SQLite数据库和Python。有一些插件需要为SQLite购买加密,但我不想为它们付费。我有Python的代码来完成所有的加密和解密,我想我有一个正确的方法来隐藏密钥,但我坚持在数据库中保存和检索加密/解密数据的概念。
Hey NEO,

Long time... I am not using a MS Access database. This is a pet project that I am working on. I am using an SQLite database and Python. There are addons to buy for encryption for SQLite but I do not want to pay for them. I have the code for Python to do all the encryption and decryption and I think I have a proper method to hide the keys but I am stuck on the concept of saving and retrieving the encrypted/decrypted data in the database.


我试着让你开心,只是想着自己的事情;-)


如果我老实你的计划听起来有点像它可能有点每笔交易的间接费用,但它并不是我能帮助的地方。


当然还好运: - )
I was trying to keep you happy, just minding my own business ;-)

If I''m honest what you plan sounds like it could be a bit of an overhead for every transaction, but it''s not really an area I can help much with.

Best of luck anyway of course :-)

这篇关于加密数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆